+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;
|
package dev.baseband.server.socket;
|
||||||
|
|
||||||
|
import com.sun.xml.internal.messaging.saaj.util.Base64;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.mindrot.jbcrypt.BCrypt;
|
import org.mindrot.jbcrypt.BCrypt;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.*;
|
||||||
import java.io.DataInputStream;
|
import java.net.URL;
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
public class ClientHandler extends Thread {
|
public class ClientHandler extends Thread {
|
||||||
|
@ -15,6 +15,8 @@ public class ClientHandler extends Thread {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
@ -33,7 +35,7 @@ public class ClientHandler extends Thread {
|
||||||
String password = key.decryptString(dis.readUTF());
|
String password = key.decryptString(dis.readUTF());
|
||||||
|
|
||||||
String hwid = 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();
|
boolean dump = dis.readBoolean();
|
||||||
String dumpString = key.decryptString(dis.readUTF());
|
String dumpString = key.decryptString(dis.readUTF());
|
||||||
String jarHash = key.decryptString(dis.readUTF());
|
String jarHash = key.decryptString(dis.readUTF());
|
||||||
|
@ -81,6 +83,26 @@ public class ClientHandler extends Thread {
|
||||||
return;
|
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")) {
|
if(type.contains("installer")) {
|
||||||
System.out.println("Installer detected.");
|
System.out.println("Installer detected.");
|
||||||
int typeInt = dis.readInt();
|
int typeInt = dis.readInt();
|
||||||
|
|
Loading…
Add table
Reference in a new issue