A2S.in - Make Money Online - Powered by vBulletin

User Tag List

Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Apr 2015
    Posts
    7
    Coins
    0
    Thumbs Up
    Received: 0
    Given: 1

    [Java] How to block decompiling?

    I want to make a java application for user panels from my minecraft server. The single problem is: The stats will be withdrawn from the server database. But i don't want players to decompile my application because they will get the database infos and password... How can i block this or how can i hide the database infos from a java application. Or would be better to make it in C#? I'm not sure because i heard that C# is as easy to decompile as Java.


    0 Not allowed! Not allowed!
    Last edited by robertforyou; 07-20-2015 at 02:02 PM.

  2. #2
    Coder Chillivanilli's Avatar




    Join Date
    Jul 2014
    Posts
    1,200
    Coins
    103
    Thumbs Up
    Received: 273
    Given: 128
    Quote Originally Posted by robertforyou View Post
    I want to make a java application for user panels from my minecraft server. The single problem is: The stats will be withdrawn from the server database. But i don't want players to decompile my application because they will get the database infos and password... How can i block this or how can i hide the database infos from a java application. Or would be better to make it in C#? I'm not sure because i heard that C# is as easy to decompile as Java.
    You can use obfuscators like proguard to obfuscate your code, but people will still see the database etc. What you need to do is setup a php script on a server where you send your requests to. So e.g. you are sending a GET request to myminecraftserver.com/stats.php?user=chillivanilli
    The php script will connect to your database and for example give you a response with the stats of the current user. That way people dont see your database settings unless they would hack your server and get the php file.

    Implementing the database directly into your java application is a high security issue.

    0 Not allowed! Not allowed!

  3. #3
    Member cүвεя_נυηкιε's Avatar
    Join Date
    Jun 2015
    Posts
    69
    Coins
    0
    Thumbs Up
    Received: 7
    Given: 1
    Well, i saw the thread name and thought i would see if I can offer some wisdom,
    but it seems Chillivanilli hit the nail on the head, using a php file/s would have been the way i would have done it.

    +1 to every word, great advice

    0 Not allowed! Not allowed!

  4. #4
    Member
    Join Date
    Apr 2015
    Posts
    7
    Coins
    0
    Thumbs Up
    Received: 0
    Given: 1
    Quote Originally Posted by Chillivanilli View Post
    You can use obfuscators like proguard to obfuscate your code, but people will still see the database etc. What you need to do is setup a php script on a server where you send your requests to. So e.g. you are sending a GET request to myminecraftserver.com/stats.php?user=chillivanilli
    The php script will connect to your database and for example give you a response with the stats of the current user. That way people dont see your database settings unless they would hack your server and get the php file.

    Implementing the database directly into your java application is a high security issue.
    Ok, will try this, but first i need to document about php, because i used it only one time to create a page, i'm not to good at this.
    I looked, it's not too hard PHP, but another problem. Wouldn't the database infos will be seen when someone will check "View page source"? Also i will need to learn how to do http requests for this xD It was easier getting the infos directly from the database, but now if i will do it with a php to prevent database info stolen, i need to do it with http requests. Do you know any good book/tutorial or something to learn http requests?

    Edit: I documented a bit on the internet, and the php code is hidden to users, so i can safe connect to the database. Now, my question is. If i have a /stats.php that connects to the database, how would i connect it to the java application, and how would i do a request from java to that php file to get something from the MySQL database?

    Edit2: Got it to work by making two jars, one client and one server, they send infos to each other using sockets. And the database infos are stored only on the server.

    0 Not allowed! Not allowed!
    Last edited by robertforyou; 07-23-2015 at 05:43 AM.

  5. #5
    Coder Chillivanilli's Avatar




    Join Date
    Jul 2014
    Posts
    1,200
    Coins
    103
    Thumbs Up
    Received: 273
    Given: 128
    Quote Originally Posted by robertforyou View Post
    Ok, will try this, but first i need to document about php, because i used it only one time to create a page, i'm not to good at this.
    I looked, it's not too hard PHP, but another problem. Wouldn't the database infos will be seen when someone will check "View page source"? Also i will need to learn how to do http requests for this xD It was easier getting the infos directly from the database, but now if i will do it with a php to prevent database info stolen, i need to do it with http requests. Do you know any good book/tutorial or something to learn http requests?

    Edit: I documented a bit on the internet, and the php code is hidden to users, so i can safe connect to the database. Now, my question is. If i have a /stats.php that connects to the database, how would i connect it to the java application, and how would i do a request from java to that php file to get something from the MySQL database?

    Edit2: Got it to work by making two jars, one client and one server, they send infos to each other using sockets. And the database infos are stored only on the server.
    Great you figured it out!
    Thread closed

    0 Not allowed! Not allowed!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •