+Serverside
This commit is contained in:
parent
dce3487675
commit
5a57fc44b2
1 changed files with 27 additions and 5 deletions
|
@ -1,11 +1,11 @@
|
|||
package dev.baseband.server.socket;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.util.Base64;
|
||||
import org.json.JSONObject;
|
||||
import org.mindrot.jbcrypt.BCrypt;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
public class ClientHandler extends Thread {
|
||||
|
@ -15,6 +15,8 @@ public class ClientHandler extends Thread {
|
|||
this.client = client;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
@ -33,7 +35,7 @@ public class ClientHandler extends Thread {
|
|||
String password = key.decryptString(dis.readUTF());
|
||||
|
||||
String hwid = key.decryptString(dis.readUTF());
|
||||
hwid = new String(MessageDigest.getInstance("SHA-512").digest(hwid.getBytes()));
|
||||
hwid = new String(Base64.encode(MessageDigest.getInstance("SHA-512").digest(hwid.getBytes())));
|
||||
boolean dump = dis.readBoolean();
|
||||
String dumpString = key.decryptString(dis.readUTF());
|
||||
String jarHash = key.decryptString(dis.readUTF());
|
||||
|
@ -81,6 +83,26 @@ public class ClientHandler extends Thread {
|
|||
return;
|
||||
}
|
||||
|
||||
BufferedReader countryReader = new BufferedReader(new InputStreamReader(new URL("http://ip-api.com/json/" + client.getInetAddress().getHostAddress() + "?fields=proxy,hosting").openStream()));
|
||||
String answer = countryReader.readLine();
|
||||
countryReader.close();
|
||||
JSONObject object = new JSONObject(answer);
|
||||
boolean proxy = object.getBoolean("proxy");
|
||||
if(proxy) {
|
||||
Bot.sendDiscordWebhookMessage("@Staff");
|
||||
Bot.sendDiscordWebhookMessage(username+" attempted to use BaseBand from a proxy address.");
|
||||
dos.writeInt(-7);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean hosting = object.getBoolean("hosting");
|
||||
if(hosting) {
|
||||
Bot.sendDiscordWebhookMessage("@Staff");
|
||||
Bot.sendDiscordWebhookMessage(username+" attempted to use BaseBand from a hosting address.");
|
||||
dos.writeInt(-7);
|
||||
return;
|
||||
}
|
||||
|
||||
if(type.contains("installer")) {
|
||||
System.out.println("Installer detected.");
|
||||
int typeInt = dis.readInt();
|
||||
|
|
Loading…
Add table
Reference in a new issue