mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX][EXPERIMENTAL] Вырезание HwidHandler
This commit is contained in:
parent
abdb31de90
commit
eddfd61c06
30 changed files with 8 additions and 1340 deletions
|
@ -2,11 +2,9 @@
|
||||||
|
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
import pro.gravit.launcher.Launcher;
|
import pro.gravit.launcher.Launcher;
|
||||||
import pro.gravit.launcher.hwid.HWIDProvider;
|
|
||||||
import pro.gravit.launcher.modules.events.PreConfigPhase;
|
import pro.gravit.launcher.modules.events.PreConfigPhase;
|
||||||
import pro.gravit.launcher.request.auth.AuthRequest;
|
import pro.gravit.launcher.request.auth.AuthRequest;
|
||||||
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
||||||
import pro.gravit.launchserver.auth.hwid.HWIDHandler;
|
|
||||||
import pro.gravit.launchserver.auth.protect.ProtectHandler;
|
import pro.gravit.launchserver.auth.protect.ProtectHandler;
|
||||||
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
||||||
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
||||||
|
@ -208,11 +206,9 @@ public static void registerAll() {
|
||||||
AuthHandler.registerHandlers();
|
AuthHandler.registerHandlers();
|
||||||
AuthProvider.registerProviders();
|
AuthProvider.registerProviders();
|
||||||
TextureProvider.registerProviders();
|
TextureProvider.registerProviders();
|
||||||
HWIDHandler.registerHandlers();
|
|
||||||
Component.registerComponents();
|
Component.registerComponents();
|
||||||
ProtectHandler.registerHandlers();
|
ProtectHandler.registerHandlers();
|
||||||
WebSocketService.registerResponses();
|
WebSocketService.registerResponses();
|
||||||
HWIDProvider.registerHWIDs();
|
|
||||||
DaoProvider.registerProviders();
|
DaoProvider.registerProviders();
|
||||||
AuthRequest.registerProviders();
|
AuthRequest.registerProviders();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
||||||
import pro.gravit.launchserver.auth.hwid.HWIDHandler;
|
|
||||||
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
||||||
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
||||||
|
|
||||||
|
@ -13,17 +12,15 @@ public class AuthProviderPair {
|
||||||
public AuthProvider provider;
|
public AuthProvider provider;
|
||||||
public AuthHandler handler;
|
public AuthHandler handler;
|
||||||
public TextureProvider textureProvider;
|
public TextureProvider textureProvider;
|
||||||
public HWIDHandler hwid;
|
|
||||||
public Map<String, String> links;
|
public Map<String, String> links;
|
||||||
public transient String name;
|
public transient String name;
|
||||||
public String displayName;
|
public String displayName;
|
||||||
public final boolean isDefault = true;
|
public final boolean isDefault = true;
|
||||||
|
|
||||||
public AuthProviderPair(AuthProvider provider, AuthHandler handler, TextureProvider textureProvider, HWIDHandler hwid) {
|
public AuthProviderPair(AuthProvider provider, AuthHandler handler, TextureProvider textureProvider) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
this.textureProvider = textureProvider;
|
this.textureProvider = textureProvider;
|
||||||
this.hwid = hwid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(LaunchServer srv, String name) {
|
public void init(LaunchServer srv, String name) {
|
||||||
|
@ -32,10 +29,8 @@ public void init(LaunchServer srv, String name) {
|
||||||
if(provider == null) throw new NullPointerException(String.format("Auth %s provider null", name));
|
if(provider == null) throw new NullPointerException(String.format("Auth %s provider null", name));
|
||||||
if(handler == null) throw new NullPointerException(String.format("Auth %s handler null", name));
|
if(handler == null) throw new NullPointerException(String.format("Auth %s handler null", name));
|
||||||
if(textureProvider == null) throw new NullPointerException(String.format("Auth %s textureProvider null", name));
|
if(textureProvider == null) throw new NullPointerException(String.format("Auth %s textureProvider null", name));
|
||||||
if(hwid == null) throw new NullPointerException(String.format("Auth %s hwid null", name));
|
|
||||||
provider.init(srv);
|
provider.init(srv);
|
||||||
handler.init(srv);
|
handler.init(srv);
|
||||||
hwid.init();
|
|
||||||
}
|
}
|
||||||
public void link(LaunchServer srv)
|
public void link(LaunchServer srv)
|
||||||
{
|
{
|
||||||
|
@ -60,11 +55,6 @@ else if("textureProvider".equals(k))
|
||||||
if(pair.textureProvider == null) throw new NullPointerException(String.format("Auth %s link failed. %s.textureProvider is null", name, v));
|
if(pair.textureProvider == null) throw new NullPointerException(String.format("Auth %s link failed. %s.textureProvider is null", name, v));
|
||||||
textureProvider = pair.textureProvider;
|
textureProvider = pair.textureProvider;
|
||||||
}
|
}
|
||||||
else if("hwid".equals(k))
|
|
||||||
{
|
|
||||||
if(pair.hwid == null) throw new NullPointerException(String.format("Auth %s link failed. %s.hwid is null", name, v));
|
|
||||||
hwid = pair.hwid;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
|
||||||
|
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AcceptHWIDHandler extends HWIDHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ban(List<HWID> hwid) {
|
|
||||||
//SKIP
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void check0(HWID hwid, String username) {
|
|
||||||
//SKIP
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
//SKIP
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<HWID> getHwid(String username) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unban(List<HWID> hwid) {
|
|
||||||
//SKIP
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
|
||||||
|
|
||||||
public class HWIDException extends Exception {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -5307315891121889972L;
|
|
||||||
|
|
||||||
public HWIDException() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public HWIDException(String s) {
|
|
||||||
super(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
public HWIDException(String s, Throwable throwable) {
|
|
||||||
super(s, throwable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public HWIDException(Throwable throwable) {
|
|
||||||
super(throwable);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
|
||||||
|
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
import pro.gravit.launchserver.Reconfigurable;
|
|
||||||
import pro.gravit.utils.ProviderMap;
|
|
||||||
import pro.gravit.utils.command.Command;
|
|
||||||
import pro.gravit.utils.command.SubCommand;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public abstract class HWIDHandler implements AutoCloseable, Reconfigurable {
|
|
||||||
public static final ProviderMap<HWIDHandler> providers = new ProviderMap<>("HWIDHandler");
|
|
||||||
private static boolean registredHandl = false;
|
|
||||||
|
|
||||||
|
|
||||||
public static void registerHandlers() {
|
|
||||||
if (!registredHandl) {
|
|
||||||
providers.register("accept", AcceptHWIDHandler.class);
|
|
||||||
providers.register("mysql", MysqlHWIDHandler.class);
|
|
||||||
providers.register("json", JsonHWIDHandler.class);
|
|
||||||
providers.register("jsonfile", JsonFileHWIDHandler.class);
|
|
||||||
providers.register("memory", MemoryHWIDHandler.class);
|
|
||||||
registredHandl = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Command> getCommands() {
|
|
||||||
Map<String, Command> commands = new HashMap<>();
|
|
||||||
commands.put("ban", new SubCommand() {
|
|
||||||
@Override
|
|
||||||
public void invoke(String... args) throws Exception {
|
|
||||||
List<HWID> target = getHwid(args[0]);
|
|
||||||
ban(target);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
commands.put("unban", new SubCommand() {
|
|
||||||
@Override
|
|
||||||
public void invoke(String... args) throws Exception {
|
|
||||||
List<HWID> target = getHwid(args[0]);
|
|
||||||
unban(target);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
commands.put("gethwid", new SubCommand() {
|
|
||||||
@Override
|
|
||||||
public void invoke(String... args) throws Exception {
|
|
||||||
List<HWID> target = getHwid(args[0]);
|
|
||||||
for (HWID hwid : target) {
|
|
||||||
if (hwid == null) {
|
|
||||||
LogHelper.error("[%s] HWID: null", args[0]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
LogHelper.info("[%s] HWID: %s", args[0], hwid.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return commands;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void ban(List<HWID> hwid) throws HWIDException;
|
|
||||||
|
|
||||||
public void check(HWID hwid, String username) throws HWIDException {
|
|
||||||
if (hwid == null || hwid.isNull()) return;
|
|
||||||
check0(hwid, username);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void check0(HWID hwid, String username) throws HWIDException;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public abstract void close() throws Exception;
|
|
||||||
|
|
||||||
public abstract void init();
|
|
||||||
|
|
||||||
public abstract List<HWID> getHwid(String username) throws HWIDException;
|
|
||||||
|
|
||||||
public abstract void unban(List<HWID> hwid) throws HWIDException;
|
|
||||||
}
|
|
|
@ -1,113 +0,0 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import pro.gravit.launcher.Launcher;
|
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Reader;
|
|
||||||
import java.io.Writer;
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class JsonFileHWIDHandler extends HWIDHandler {
|
|
||||||
public static class Entry {
|
|
||||||
public final HWID hwid;
|
|
||||||
public String username;
|
|
||||||
public boolean isBanned = false;
|
|
||||||
|
|
||||||
public Entry(HWID hwid) {
|
|
||||||
this.hwid = hwid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
Entry entry = (Entry) o;
|
|
||||||
return Objects.equals(hwid, entry.hwid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(hwid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public final String filename = "hwids.json";
|
|
||||||
public transient LinkedList<Entry> list = new LinkedList<>();
|
|
||||||
public final String banMessage = "You banned";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ban(List<HWID> hwid) {
|
|
||||||
for (Entry e : list) {
|
|
||||||
for (HWID banHWID : hwid) {
|
|
||||||
if (e.hwid.equals(banHWID)) {
|
|
||||||
e.isBanned = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
Path path = Paths.get(filename);
|
|
||||||
Type type = new TypeToken<LinkedList<Entry>>() {
|
|
||||||
}.getType();
|
|
||||||
try (Reader reader = IOHelper.newReader(path)) {
|
|
||||||
list = Launcher.gsonManager.gson.fromJson(reader, type);
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogHelper.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void check0(HWID hwid, String username) throws HWIDException {
|
|
||||||
boolean isOne = false;
|
|
||||||
for (Entry e : list) {
|
|
||||||
if (e.hwid.equals(hwid)) {
|
|
||||||
isOne = true;
|
|
||||||
if (e.isBanned) throw new HWIDException(banMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isOne) {
|
|
||||||
list.add(new Entry(hwid));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() throws Exception {
|
|
||||||
Path path = Paths.get(filename);
|
|
||||||
try (Writer writer = IOHelper.newWriter(path)) {
|
|
||||||
Launcher.gsonManager.configGson.toJson(list, writer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<HWID> getHwid(String username) {
|
|
||||||
LinkedList<HWID> hwids = new LinkedList<>();
|
|
||||||
for (Entry e : list) {
|
|
||||||
if (e.username.equals(username)) hwids.add(e.hwid);
|
|
||||||
}
|
|
||||||
return hwids;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unban(List<HWID> hwid) {
|
|
||||||
for (Entry e : list) {
|
|
||||||
for (HWID banHWID : hwid) {
|
|
||||||
if (e.hwid.equals(banHWID)) {
|
|
||||||
e.isBanned = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
import pro.gravit.launcher.hwid.OshiHWID;
|
|
||||||
import pro.gravit.launcher.HTTPRequest;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public final class JsonHWIDHandler extends HWIDHandler {
|
|
||||||
private static final Gson gson = new Gson();
|
|
||||||
|
|
||||||
private URL url;
|
|
||||||
private URL urlBan;
|
|
||||||
private URL urlUnBan;
|
|
||||||
private URL urlGet;
|
|
||||||
private String apiKey;
|
|
||||||
|
|
||||||
public static class banRequest {
|
|
||||||
public banRequest(OshiHWID hwid) {
|
|
||||||
this.hwid = hwid;
|
|
||||||
}
|
|
||||||
|
|
||||||
final OshiHWID hwid;
|
|
||||||
String apiKey;
|
|
||||||
|
|
||||||
public banRequest(OshiHWID hwid, String apiKey) {
|
|
||||||
this.hwid = hwid;
|
|
||||||
this.apiKey = apiKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class checkRequest {
|
|
||||||
public checkRequest(String username, OshiHWID hwid) {
|
|
||||||
this.username = username;
|
|
||||||
this.hwid = hwid;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String username;
|
|
||||||
final OshiHWID hwid;
|
|
||||||
String apiKey;
|
|
||||||
|
|
||||||
public checkRequest(String username, OshiHWID hwid, String apiKey) {
|
|
||||||
this.username = username;
|
|
||||||
this.hwid = hwid;
|
|
||||||
this.apiKey = apiKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Result {
|
|
||||||
String error;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BannedResult {
|
|
||||||
boolean isBanned;
|
|
||||||
String error;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class HWIDRequest {
|
|
||||||
public HWIDRequest(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String username;
|
|
||||||
String apiKey;
|
|
||||||
|
|
||||||
public HWIDRequest(String username, String apiKey) {
|
|
||||||
this.username = username;
|
|
||||||
this.apiKey = apiKey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ban(List<HWID> l_hwid) throws HWIDException {
|
|
||||||
for (HWID hwid : l_hwid) {
|
|
||||||
banRequest request = new banRequest((OshiHWID) hwid, apiKey);
|
|
||||||
try {
|
|
||||||
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlBan);
|
|
||||||
Result r = gson.fromJson(result, Result.class);
|
|
||||||
if (r.error != null) throw new HWIDException(r.error);
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogHelper.error(e);
|
|
||||||
throw new HWIDException("HWID service error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void check0(HWID hwid, String username) throws HWIDException {
|
|
||||||
checkRequest request = new checkRequest(username, (OshiHWID) hwid, apiKey);
|
|
||||||
try {
|
|
||||||
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), url);
|
|
||||||
BannedResult r = gson.fromJson(result, BannedResult.class);
|
|
||||||
if (r.error != null) throw new HWIDException(r.error);
|
|
||||||
boolean isBanned = r.isBanned;
|
|
||||||
if (isBanned) throw new HWIDException("You will BANNED!");
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogHelper.error(e);
|
|
||||||
throw new HWIDException("HWID service error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
// pass
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<HWID> getHwid(String username) throws HWIDException {
|
|
||||||
ArrayList<HWID> hwids = new ArrayList<>();
|
|
||||||
HWIDRequest request = new HWIDRequest(username, apiKey);
|
|
||||||
try {
|
|
||||||
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlGet);
|
|
||||||
OshiHWID[] r = gson.fromJson(result, OshiHWID[].class);
|
|
||||||
hwids.addAll(Arrays.asList(r));
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogHelper.error(e);
|
|
||||||
throw new HWIDException("HWID service error");
|
|
||||||
}
|
|
||||||
return hwids;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unban(List<HWID> l_hwid) throws HWIDException {
|
|
||||||
for (HWID hwid : l_hwid) {
|
|
||||||
banRequest request = new banRequest((OshiHWID) hwid, apiKey);
|
|
||||||
try {
|
|
||||||
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlUnBan);
|
|
||||||
Result r = gson.fromJson(result, Result.class);
|
|
||||||
if (r.error != null) throw new HWIDException(r.error);
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogHelper.error(e);
|
|
||||||
throw new HWIDException("HWID service error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,92 +0,0 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
|
||||||
|
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class MemoryHWIDHandler extends HWIDHandler {
|
|
||||||
public static class Entry {
|
|
||||||
public final HWID hwid;
|
|
||||||
public String username;
|
|
||||||
public boolean isBanned = false;
|
|
||||||
|
|
||||||
public Entry(HWID hwid) {
|
|
||||||
this.hwid = hwid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
Entry entry = (Entry) o;
|
|
||||||
return Objects.equals(hwid, entry.hwid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(hwid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public final transient LinkedList<Entry> list = new LinkedList<>();
|
|
||||||
public final String banMessage = "You banned";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ban(List<HWID> hwid) {
|
|
||||||
for (Entry e : list) {
|
|
||||||
for (HWID banHWID : hwid) {
|
|
||||||
if (e.hwid.equals(banHWID)) {
|
|
||||||
e.isBanned = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void check0(HWID hwid, String username) throws HWIDException {
|
|
||||||
boolean isOne = false;
|
|
||||||
for (Entry e : list) {
|
|
||||||
if (e.hwid.equals(hwid)) {
|
|
||||||
isOne = true;
|
|
||||||
if (e.isBanned) throw new HWIDException(banMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isOne) {
|
|
||||||
list.add(new Entry(hwid));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<HWID> getHwid(String username) {
|
|
||||||
LinkedList<HWID> hwids = new LinkedList<>();
|
|
||||||
for (Entry e : list) {
|
|
||||||
if (e.username.equals(username)) hwids.add(e.hwid);
|
|
||||||
}
|
|
||||||
return hwids;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unban(List<HWID> hwid) {
|
|
||||||
for (Entry e : list) {
|
|
||||||
for (HWID banHWID : hwid) {
|
|
||||||
if (e.hwid.equals(banHWID)) {
|
|
||||||
e.isBanned = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,268 +0,0 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
|
||||||
|
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
import pro.gravit.launcher.hwid.OshiHWID;
|
|
||||||
import pro.gravit.launchserver.auth.MySQLSourceConfig;
|
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MysqlHWIDHandler extends HWIDHandler {
|
|
||||||
private MySQLSourceConfig mySQLHolder;
|
|
||||||
|
|
||||||
private String tableUsers;
|
|
||||||
private String tableHwids;
|
|
||||||
|
|
||||||
private String userFieldHwid;
|
|
||||||
private String userFieldLogin;
|
|
||||||
|
|
||||||
private String hwidFieldTotalMemory;
|
|
||||||
private String hwidFieldSerialNumber;
|
|
||||||
private String hwidFieldHWDiskSerial;
|
|
||||||
private String hwidFieldProcessorID;
|
|
||||||
private String hwidFieldBanned;
|
|
||||||
private String hwidFieldMAC;
|
|
||||||
|
|
||||||
private String queryHwids;
|
|
||||||
private String[] paramsHwids;
|
|
||||||
|
|
||||||
private String queryBan;
|
|
||||||
private String[] paramsBan;
|
|
||||||
|
|
||||||
private String banMessage;
|
|
||||||
|
|
||||||
private boolean compareMode = false;
|
|
||||||
//Using queryHWID "queryHwids": "SELECT * FROM `users_hwids` WHERE `totalMemory` = ? or `serialNumber` = ? or `HWDiskSerial` = ? or `processorID` = ? or `MACAddr` = ?"
|
|
||||||
private int compare = 50; //При наборе схожести в 50 очков
|
|
||||||
private boolean oneCompareMode = false;
|
|
||||||
|
|
||||||
/*
|
|
||||||
//Добавить поля hwid в базу с пользователями
|
|
||||||
|
|
||||||
//Создание таблицы для хранения HWID
|
|
||||||
CREATE TABLE `fc_user_hwids` (
|
|
||||||
`id` int(16) NOT NULL,
|
|
||||||
`totalMemory` varchar(32) NOT NULL,
|
|
||||||
`serialNumber` varchar(64) NOT NULL,
|
|
||||||
`HWDiskSerial` varchar(64) NOT NULL,
|
|
||||||
`processorID` varchar(64) NOT NULL,
|
|
||||||
`MACAddr` varchar(64) NOT NULL,
|
|
||||||
`isBanned` tinyint(1) NOT NULL DEFAULT '0'
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
||||||
|
|
||||||
ALTER TABLE `fc_user_hwids` ADD UNIQUE KEY `id` (`id`);
|
|
||||||
|
|
||||||
ALTER TABLE `fc_user_hwids` MODIFY `id` int(16) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void check0(HWID hwid, String username) throws HWIDException {
|
|
||||||
if (hwid instanceof OshiHWID) {
|
|
||||||
OshiHWID oshiHWID = (OshiHWID) hwid;
|
|
||||||
try (Connection c = mySQLHolder.getConnection()) {
|
|
||||||
|
|
||||||
PreparedStatement s = c.prepareStatement(String.format("SELECT %s, %s FROM `%s` WHERE `%s` = ? LIMIT 1",
|
|
||||||
userFieldHwid, userFieldLogin, tableUsers, userFieldLogin));
|
|
||||||
s.setString(1, username);
|
|
||||||
|
|
||||||
// Execute SQL query
|
|
||||||
s.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
|
|
||||||
try (ResultSet set = s.executeQuery()) {
|
|
||||||
if (set.next()) {
|
|
||||||
int hwid_id = set.getInt(userFieldHwid);
|
|
||||||
if (hwid_id == 0) {
|
|
||||||
onUpdateInfo(oshiHWID, username, c);
|
|
||||||
} else {
|
|
||||||
onCheckInfo(oshiHWID, username, c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onUpdateInfo(OshiHWID hwid, String username, Connection c) throws HWIDException {
|
|
||||||
try (PreparedStatement a = c.prepareStatement(queryHwids)) {
|
|
||||||
|
|
||||||
String[] replaceParams = {"totalMemory", String.valueOf(hwid.totalMemory), "serialNumber", hwid.serialNumber, "HWDiskSerial", hwid.HWDiskSerial, "processorID", hwid.processorID, "MAC", hwid.macAddr};
|
|
||||||
for (int i = 0; i < paramsHwids.length; i++) {
|
|
||||||
a.setString(i + 1, CommonHelper.replace(paramsHwids[i], replaceParams));
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultSet set = a.executeQuery();
|
|
||||||
PreparedStatement ps;
|
|
||||||
if (set.next()) {
|
|
||||||
int id = set.getInt("id");
|
|
||||||
boolean isBanned = set.getBoolean(hwidFieldBanned);
|
|
||||||
|
|
||||||
ps = c.prepareStatement(String.format("UPDATE `%s` SET `%s` = ? WHERE `%s` = ?",
|
|
||||||
tableUsers, userFieldHwid, userFieldLogin));
|
|
||||||
ps.setInt(1, id);
|
|
||||||
ps.setString(2, username);
|
|
||||||
|
|
||||||
ps.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
|
|
||||||
ps.executeUpdate();
|
|
||||||
|
|
||||||
if (isBanned) {
|
|
||||||
throw new HWIDException(banMessage);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ps = c.prepareStatement(String.format("INSERT INTO `%s` (`%s`, `%s`, `%s`, `%s`, `%s`) VALUES (?, ?, ?, ?, ?);",
|
|
||||||
tableHwids, hwidFieldTotalMemory, hwidFieldSerialNumber, hwidFieldHWDiskSerial, hwidFieldProcessorID, hwidFieldMAC));
|
|
||||||
ps.setString(1, String.valueOf(hwid.totalMemory));
|
|
||||||
ps.setString(2, hwid.serialNumber);
|
|
||||||
ps.setString(3, hwid.HWDiskSerial);
|
|
||||||
ps.setString(4, hwid.processorID);
|
|
||||||
ps.setString(5, hwid.macAddr);
|
|
||||||
ps.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
|
|
||||||
ps.executeUpdate();
|
|
||||||
|
|
||||||
ps = c.prepareStatement(String.format("UPDATE `%s` SET `%s` = LAST_INSERT_ID() WHERE `%s` = ?;",
|
|
||||||
tableUsers, userFieldHwid, userFieldLogin));
|
|
||||||
ps.setString(1, username);
|
|
||||||
ps.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
|
|
||||||
ps.executeUpdate();
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onCheckInfo(OshiHWID hwid, String username, Connection c) throws HWIDException {
|
|
||||||
try (PreparedStatement a = c.prepareStatement(queryHwids)) {
|
|
||||||
String[] replaceParams = {"totalMemory", String.valueOf(hwid.totalMemory), "serialNumber", hwid.serialNumber, "HWDiskSerial", hwid.HWDiskSerial, "processorID", hwid.processorID, "MAC", hwid.macAddr};
|
|
||||||
for (int i = 0; i < paramsHwids.length; i++) {
|
|
||||||
a.setString(i + 1, CommonHelper.replace(paramsHwids[i], replaceParams));
|
|
||||||
}
|
|
||||||
ResultSet set = a.executeQuery();
|
|
||||||
boolean isOne = false;
|
|
||||||
while (set.next()) {
|
|
||||||
if (!oneCompareMode) isOne = true;
|
|
||||||
if (compareMode) {
|
|
||||||
OshiHWID db_hwid = new OshiHWID();
|
|
||||||
db_hwid.serialNumber = set.getString(hwidFieldSerialNumber);
|
|
||||||
db_hwid.processorID = set.getString(hwidFieldProcessorID);
|
|
||||||
db_hwid.HWDiskSerial = set.getString(hwidFieldHWDiskSerial);
|
|
||||||
db_hwid.totalMemory = Long.parseLong(set.getString(hwidFieldTotalMemory));
|
|
||||||
db_hwid.macAddr = set.getString(hwidFieldMAC);
|
|
||||||
if (LogHelper.isDevEnabled()) {
|
|
||||||
LogHelper.dev("Compare HWID: %s vs %s", hwid.toString(), db_hwid.toString());
|
|
||||||
}
|
|
||||||
int compare_point = hwid.compare(db_hwid);
|
|
||||||
if (compare_point < compare) continue;
|
|
||||||
else {
|
|
||||||
if (LogHelper.isDevEnabled()) {
|
|
||||||
LogHelper.debug("User %s hwid check: found compare %d in %d", username, compare_point, set.getInt("id"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (oneCompareMode) isOne = true;
|
|
||||||
boolean isBanned = set.getBoolean(hwidFieldBanned);
|
|
||||||
if (isBanned) {
|
|
||||||
throw new HWIDException(banMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isOne) {
|
|
||||||
onUpdateInfo(hwid, username, c);
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsBanned(HWID hwid, boolean isBanned) {
|
|
||||||
if (LogHelper.isDebugEnabled()) {
|
|
||||||
LogHelper.debug("%s Request HWID: %s", isBanned ? "Ban" : "UnBan", hwid.toString());
|
|
||||||
}
|
|
||||||
if (hwid instanceof OshiHWID) {
|
|
||||||
OshiHWID oshiHWID = (OshiHWID) hwid;
|
|
||||||
try (Connection c = mySQLHolder.getConnection()) {
|
|
||||||
try (PreparedStatement a = c.prepareStatement(queryBan)) {
|
|
||||||
String[] replaceParamsUpd = {"totalMemory", String.valueOf(oshiHWID.totalMemory), "serialNumber", oshiHWID.serialNumber, "HWDiskSerial", oshiHWID.HWDiskSerial, "processorID", oshiHWID.processorID, "MAC", oshiHWID.macAddr, "isBanned", isBanned ? "1" : "0"};
|
|
||||||
for (int i = 0; i < paramsBan.length; i++) {
|
|
||||||
a.setString(i + 1, CommonHelper.replace(paramsBan[i], replaceParamsUpd));
|
|
||||||
}
|
|
||||||
a.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
|
|
||||||
a.executeUpdate();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ban(List<HWID> list) {
|
|
||||||
for (HWID hwid : list) {
|
|
||||||
setIsBanned(hwid, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unban(List<HWID> list) {
|
|
||||||
for (HWID hwid : list) {
|
|
||||||
setIsBanned(hwid, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<HWID> getHwid(String username) {
|
|
||||||
ArrayList<HWID> list = new ArrayList<>();
|
|
||||||
try (Connection c = mySQLHolder.getConnection()) {
|
|
||||||
if (LogHelper.isDebugEnabled()) {
|
|
||||||
LogHelper.debug("Try find HWID from username %s", username);
|
|
||||||
}
|
|
||||||
PreparedStatement s = c.prepareStatement(String.format("SELECT %s, %s FROM `%s` WHERE `%s` = ? LIMIT 1", userFieldHwid, userFieldLogin, tableUsers, userFieldLogin));
|
|
||||||
s.setString(1, username);
|
|
||||||
|
|
||||||
// Execute SQL query
|
|
||||||
s.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
|
|
||||||
|
|
||||||
try (ResultSet set = s.executeQuery()) {
|
|
||||||
if (set.next()) {
|
|
||||||
int hwid_id = set.getInt(userFieldHwid);
|
|
||||||
if (hwid_id != 0) {
|
|
||||||
s = c.prepareStatement(String.format("SELECT * FROM `%s` WHERE `id` = ? LIMIT 1", tableHwids));
|
|
||||||
s.setInt(1, hwid_id);
|
|
||||||
ResultSet rs = s.executeQuery();
|
|
||||||
if (rs.next()) {
|
|
||||||
OshiHWID oshiHWID = new OshiHWID();
|
|
||||||
oshiHWID.totalMemory = Long.parseLong(rs.getString(hwidFieldTotalMemory));
|
|
||||||
oshiHWID.serialNumber = rs.getString(hwidFieldSerialNumber);
|
|
||||||
oshiHWID.HWDiskSerial = rs.getString(hwidFieldHWDiskSerial);
|
|
||||||
oshiHWID.processorID = rs.getString(hwidFieldProcessorID);
|
|
||||||
oshiHWID.macAddr = rs.getString(hwidFieldMAC);
|
|
||||||
list.add(oshiHWID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LogHelper.error(new HWIDException("HWID not found"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
mySQLHolder.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +1,10 @@
|
||||||
package pro.gravit.launchserver.command.basic;
|
package pro.gravit.launchserver.command.basic;
|
||||||
|
|
||||||
import org.bouncycastle.cert.X509CertificateHolder;
|
import org.bouncycastle.cert.X509CertificateHolder;
|
||||||
import pro.gravit.launcher.hwid.HWIDCheckHelper;
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.gravit.launchserver.command.Command;
|
||||||
import pro.gravit.launchserver.socket.handlers.NettyServerSocketHandler;
|
import pro.gravit.launchserver.socket.handlers.NettyServerSocketHandler;
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.security.KeyPair;
|
import java.security.KeyPair;
|
||||||
|
@ -56,8 +54,5 @@ public void invoke(String... args) throws Exception {
|
||||||
server.certificateManager.writePrivateKey(Paths.get(name.concat(".key")), pair.getPrivate());
|
server.certificateManager.writePrivateKey(Paths.get(name.concat(".key")), pair.getPrivate());
|
||||||
server.certificateManager.writeCertificate(Paths.get(name.concat(".crt")), cert);
|
server.certificateManager.writeCertificate(Paths.get(name.concat(".crt")), cert);
|
||||||
}
|
}
|
||||||
if (args[0].equals("hwidcheck")) {
|
|
||||||
LogHelper.info("HWID String %s bad rating %d", args[1], HWIDCheckHelper.checkString(args[1]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||||
import pro.gravit.launchserver.auth.handler.MemoryAuthHandler;
|
import pro.gravit.launchserver.auth.handler.MemoryAuthHandler;
|
||||||
import pro.gravit.launchserver.auth.hwid.AcceptHWIDHandler;
|
|
||||||
import pro.gravit.launchserver.auth.protect.ProtectHandler;
|
import pro.gravit.launchserver.auth.protect.ProtectHandler;
|
||||||
import pro.gravit.launchserver.auth.protect.StdProtectHandler;
|
import pro.gravit.launchserver.auth.protect.StdProtectHandler;
|
||||||
import pro.gravit.launchserver.auth.provider.RejectAuthProvider;
|
import pro.gravit.launchserver.auth.provider.RejectAuthProvider;
|
||||||
|
@ -139,7 +138,6 @@ public void init(LaunchServer.ReloadType type) {
|
||||||
server.registerObject("auth.".concat(pair.name).concat(".provider"), pair.provider);
|
server.registerObject("auth.".concat(pair.name).concat(".provider"), pair.provider);
|
||||||
server.registerObject("auth.".concat(pair.name).concat(".handler"), pair.handler);
|
server.registerObject("auth.".concat(pair.name).concat(".handler"), pair.handler);
|
||||||
server.registerObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider);
|
server.registerObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider);
|
||||||
server.registerObject("auth.".concat(pair.name).concat(".hwid"), pair.hwid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Arrays.stream(mirrors).forEach(server.mirrorManager::addMirror);
|
Arrays.stream(mirrors).forEach(server.mirrorManager::addMirror);
|
||||||
|
@ -152,7 +150,6 @@ public void close(LaunchServer.ReloadType type) {
|
||||||
server.unregisterObject("auth.".concat(pair.name).concat(".provider"), pair.provider);
|
server.unregisterObject("auth.".concat(pair.name).concat(".provider"), pair.provider);
|
||||||
server.unregisterObject("auth.".concat(pair.name).concat(".handler"), pair.handler);
|
server.unregisterObject("auth.".concat(pair.name).concat(".handler"), pair.handler);
|
||||||
server.unregisterObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider);
|
server.unregisterObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider);
|
||||||
server.unregisterObject("auth.".concat(pair.name).concat(".hwid"), pair.hwid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type.equals(LaunchServer.ReloadType.FULL)) {
|
if (type.equals(LaunchServer.ReloadType.FULL)) {
|
||||||
|
@ -280,7 +277,7 @@ public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) {
|
||||||
AuthProviderPair a = new AuthProviderPair(new RejectAuthProvider("Настройте authProvider"),
|
AuthProviderPair a = new AuthProviderPair(new RejectAuthProvider("Настройте authProvider"),
|
||||||
new MemoryAuthHandler(),
|
new MemoryAuthHandler(),
|
||||||
new RequestTextureProvider("http://example.com/skins/%username%.png", "http://example.com/cloaks/%username%.png")
|
new RequestTextureProvider("http://example.com/skins/%username%.png", "http://example.com/cloaks/%username%.png")
|
||||||
, new AcceptHWIDHandler());
|
);
|
||||||
a.displayName = "Default";
|
a.displayName = "Default";
|
||||||
newConfig.auth.put("std", a);
|
newConfig.auth.put("std", a);
|
||||||
newConfig.protectHandler = new StdProtectHandler();
|
newConfig.protectHandler = new StdProtectHandler();
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package pro.gravit.launchserver.dao;
|
|
||||||
|
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface HwidDAO {
|
|
||||||
UserHWID findById(long id);
|
|
||||||
|
|
||||||
List<? extends UserHWID> findHWIDs(HWID hwid);
|
|
||||||
|
|
||||||
void save(UserHWID user);
|
|
||||||
|
|
||||||
void update(UserHWID user);
|
|
||||||
|
|
||||||
void delete(UserHWID user);
|
|
||||||
|
|
||||||
List<UserHWID> findAll();
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package pro.gravit.launchserver.dao;
|
|
||||||
|
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
|
|
||||||
public interface UserHWID {
|
|
||||||
boolean isBanned();
|
|
||||||
HWID toHWID();
|
|
||||||
}
|
|
|
@ -1,82 +0,0 @@
|
||||||
package pro.gravit.launchserver.dao.impl;
|
|
||||||
|
|
||||||
import org.hibernate.Session;
|
|
||||||
import org.hibernate.SessionFactory;
|
|
||||||
import org.hibernate.Transaction;
|
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
import pro.gravit.launcher.hwid.OshiHWID;
|
|
||||||
import pro.gravit.launchserver.dao.HwidDAO;
|
|
||||||
import pro.gravit.launchserver.dao.UserHWID;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HibernateHwidDAOImpl implements HwidDAO {
|
|
||||||
private final SessionFactory factory;
|
|
||||||
|
|
||||||
public HibernateHwidDAOImpl(SessionFactory factory) {
|
|
||||||
this.factory = factory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<UserHWIDImpl> findHWIDs(HWID hwid) {
|
|
||||||
if(!(hwid instanceof OshiHWID)) throw new UnsupportedOperationException();
|
|
||||||
OshiHWID oshiHWID = (OshiHWID) hwid;
|
|
||||||
EntityManager em = factory.createEntityManager();
|
|
||||||
em.getTransaction().begin();
|
|
||||||
CriteriaBuilder cb = em.getCriteriaBuilder();
|
|
||||||
CriteriaQuery<UserHWIDImpl> personCriteria = cb.createQuery(UserHWIDImpl.class);
|
|
||||||
Root<UserHWIDImpl> rootUser = personCriteria.from(UserHWIDImpl.class);
|
|
||||||
personCriteria.select(rootUser).where(
|
|
||||||
cb.or(
|
|
||||||
cb.equal(rootUser.get("totalMemory"), oshiHWID.totalMemory),
|
|
||||||
cb.equal(rootUser.get("HWDiskSerial"), oshiHWID.HWDiskSerial),
|
|
||||||
cb.equal(rootUser.get("serialNumber"), oshiHWID.serialNumber),
|
|
||||||
cb.equal(rootUser.get("processorID"), oshiHWID.processorID),
|
|
||||||
cb.equal(rootUser.get("macAddr"), oshiHWID.macAddr)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
List<UserHWIDImpl> list = em.createQuery(personCriteria).getResultList();
|
|
||||||
em.close();
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserHWIDImpl findById(long id) {
|
|
||||||
try (Session s = factory.openSession()) {
|
|
||||||
return s.get(UserHWIDImpl.class, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void save(UserHWID user) {
|
|
||||||
try (Session session = factory.openSession()) {
|
|
||||||
Transaction tx1 = session.beginTransaction();
|
|
||||||
session.save(user);
|
|
||||||
tx1.commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(UserHWID user) {
|
|
||||||
try (Session session = factory.openSession()) {
|
|
||||||
Transaction tx1 = session.beginTransaction();
|
|
||||||
session.update(user);
|
|
||||||
tx1.commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void delete(UserHWID user) {
|
|
||||||
try (Session session = factory.openSession()) {
|
|
||||||
Transaction tx1 = session.beginTransaction();
|
|
||||||
session.delete(user);
|
|
||||||
tx1.commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public List<UserHWID> findAll() {
|
|
||||||
try (Session s = factory.openSession()) {
|
|
||||||
return (List<UserHWID>) s.createQuery("From user_hwids").list();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package pro.gravit.launchserver.dao.impl;
|
|
||||||
|
|
||||||
import pro.gravit.launcher.hwid.OshiHWID;
|
|
||||||
import pro.gravit.launchserver.dao.UserHWID;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "users_hwids")
|
|
||||||
public class UserHWIDImpl implements UserHWID {
|
|
||||||
private final transient Supplier<OshiHWID> oshiSupp = () -> {
|
|
||||||
OshiHWID hwid = new OshiHWID();
|
|
||||||
hwid.HWDiskSerial = this.HWDiskSerial;
|
|
||||||
hwid.macAddr = this.macAddr;
|
|
||||||
hwid.processorID = this.processorID;
|
|
||||||
hwid.serialNumber = this.serialNumber;
|
|
||||||
hwid.totalMemory = this.totalMemory;
|
|
||||||
return hwid;
|
|
||||||
};
|
|
||||||
private transient OshiHWID oshi = null;
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
public final long totalMemory = 0;
|
|
||||||
public String serialNumber;
|
|
||||||
public String HWDiskSerial;
|
|
||||||
public String processorID;
|
|
||||||
public String macAddr;
|
|
||||||
|
|
||||||
public boolean banned;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isBanned() {
|
|
||||||
return banned;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OshiHWID toHWID() {
|
|
||||||
if (oshi == null) oshi = oshiSupp.get();
|
|
||||||
return oshi;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +1,12 @@
|
||||||
package pro.gravit.launchserver.dao.provider;
|
package pro.gravit.launchserver.dao.provider;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.dao.HwidDAO;
|
|
||||||
import pro.gravit.launchserver.dao.UserDAO;
|
import pro.gravit.launchserver.dao.UserDAO;
|
||||||
import pro.gravit.utils.ProviderMap;
|
import pro.gravit.utils.ProviderMap;
|
||||||
|
|
||||||
public abstract class DaoProvider {
|
public abstract class DaoProvider {
|
||||||
public static final ProviderMap<DaoProvider> providers = new ProviderMap<>("DaoProvider");
|
public static final ProviderMap<DaoProvider> providers = new ProviderMap<>("DaoProvider");
|
||||||
public UserDAO userDAO;
|
public UserDAO userDAO;
|
||||||
public HwidDAO hwidDao;
|
|
||||||
|
|
||||||
public static void registerProviders() {
|
public static void registerProviders() {
|
||||||
providers.register("hibernate", HibernateDaoProvider.class);
|
providers.register("hibernate", HibernateDaoProvider.class);
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.dao.impl.HibernateHwidDAOImpl;
|
|
||||||
import pro.gravit.launchserver.dao.impl.UserHibernateImpl;
|
import pro.gravit.launchserver.dao.impl.UserHibernateImpl;
|
||||||
import pro.gravit.launchserver.dao.impl.UserHWIDImpl;
|
|
||||||
import pro.gravit.launchserver.dao.impl.HibernateUserDAOImpl;
|
import pro.gravit.launchserver.dao.impl.HibernateUserDAOImpl;
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
|
|
||||||
|
@ -27,7 +25,6 @@ public void init(LaunchServer server) {
|
||||||
Runnable init = () -> {
|
Runnable init = () -> {
|
||||||
Configuration cfg = new Configuration()
|
Configuration cfg = new Configuration()
|
||||||
.addAnnotatedClass(UserHibernateImpl.class)
|
.addAnnotatedClass(UserHibernateImpl.class)
|
||||||
.addAnnotatedClass(UserHWIDImpl.class)
|
|
||||||
.setProperty("hibernate.connection.driver_class", driver)
|
.setProperty("hibernate.connection.driver_class", driver)
|
||||||
.setProperty("hibernate.connection.url", url)
|
.setProperty("hibernate.connection.url", url)
|
||||||
.setProperty("hibernate.connection.username", username)
|
.setProperty("hibernate.connection.username", username)
|
||||||
|
@ -39,7 +36,6 @@ public void init(LaunchServer server) {
|
||||||
cfg.configure(Paths.get(hibernateConfig).toFile());
|
cfg.configure(Paths.get(hibernateConfig).toFile());
|
||||||
sessionFactory = cfg.buildSessionFactory();
|
sessionFactory = cfg.buildSessionFactory();
|
||||||
userDAO = new HibernateUserDAOImpl(sessionFactory);
|
userDAO = new HibernateUserDAOImpl(sessionFactory);
|
||||||
hwidDao = new HibernateHwidDAOImpl(sessionFactory);
|
|
||||||
};
|
};
|
||||||
if (parallelHibernateInit)
|
if (parallelHibernateInit)
|
||||||
CommonHelper.newThread("Hibernate Thread", true, init);
|
CommonHelper.newThread("Hibernate Thread", true, init);
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
package pro.gravit.launchserver.manangers;
|
package pro.gravit.launchserver.manangers;
|
||||||
|
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
import pro.gravit.launcher.hwid.HWIDProvider;
|
|
||||||
import pro.gravit.launcher.managers.GsonManager;
|
import pro.gravit.launcher.managers.GsonManager;
|
||||||
import pro.gravit.launcher.modules.events.PreGsonPhase;
|
import pro.gravit.launcher.modules.events.PreGsonPhase;
|
||||||
import pro.gravit.launcher.request.JsonResultSerializeAdapter;
|
import pro.gravit.launcher.request.JsonResultSerializeAdapter;
|
||||||
import pro.gravit.launcher.request.WebSocketEvent;
|
import pro.gravit.launcher.request.WebSocketEvent;
|
||||||
import pro.gravit.launcher.request.auth.AuthRequest;
|
import pro.gravit.launcher.request.auth.AuthRequest;
|
||||||
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
||||||
import pro.gravit.launchserver.auth.hwid.HWIDHandler;
|
|
||||||
import pro.gravit.launchserver.auth.protect.ProtectHandler;
|
import pro.gravit.launchserver.auth.protect.ProtectHandler;
|
||||||
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
||||||
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
||||||
|
@ -33,11 +30,9 @@ public void registerAdapters(GsonBuilder builder) {
|
||||||
builder.registerTypeAdapter(AuthProvider.class, new UniversalJsonAdapter<>(AuthProvider.providers));
|
builder.registerTypeAdapter(AuthProvider.class, new UniversalJsonAdapter<>(AuthProvider.providers));
|
||||||
builder.registerTypeAdapter(TextureProvider.class, new UniversalJsonAdapter<>(TextureProvider.providers));
|
builder.registerTypeAdapter(TextureProvider.class, new UniversalJsonAdapter<>(TextureProvider.providers));
|
||||||
builder.registerTypeAdapter(AuthHandler.class, new UniversalJsonAdapter<>(AuthHandler.providers));
|
builder.registerTypeAdapter(AuthHandler.class, new UniversalJsonAdapter<>(AuthHandler.providers));
|
||||||
builder.registerTypeAdapter(HWIDHandler.class, new UniversalJsonAdapter<>(HWIDHandler.providers));
|
|
||||||
builder.registerTypeAdapter(Component.class, new UniversalJsonAdapter<>(Component.providers));
|
builder.registerTypeAdapter(Component.class, new UniversalJsonAdapter<>(Component.providers));
|
||||||
builder.registerTypeAdapter(ProtectHandler.class, new UniversalJsonAdapter<>(ProtectHandler.providers));
|
builder.registerTypeAdapter(ProtectHandler.class, new UniversalJsonAdapter<>(ProtectHandler.providers));
|
||||||
builder.registerTypeAdapter(DaoProvider.class, new UniversalJsonAdapter<>(DaoProvider.providers));
|
builder.registerTypeAdapter(DaoProvider.class, new UniversalJsonAdapter<>(DaoProvider.providers));
|
||||||
builder.registerTypeAdapter(HWID.class, new UniversalJsonAdapter<>(HWIDProvider.hwids));
|
|
||||||
builder.registerTypeAdapter(WebSocketServerResponse.class, new UniversalJsonAdapter<>(WebSocketService.providers));
|
builder.registerTypeAdapter(WebSocketServerResponse.class, new UniversalJsonAdapter<>(WebSocketService.providers));
|
||||||
builder.registerTypeAdapter(WebSocketEvent.class, new JsonResultSerializeAdapter());
|
builder.registerTypeAdapter(WebSocketEvent.class, new JsonResultSerializeAdapter());
|
||||||
builder.registerTypeAdapter(AuthRequest.AuthPasswordInterface.class, new UniversalJsonAdapter<>(AuthRequest.providers));
|
builder.registerTypeAdapter(AuthRequest.AuthPasswordInterface.class, new UniversalJsonAdapter<>(AuthRequest.providers));
|
||||||
|
|
|
@ -2,15 +2,12 @@
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import pro.gravit.launcher.events.request.AuthRequestEvent;
|
import pro.gravit.launcher.events.request.AuthRequestEvent;
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
import pro.gravit.launcher.hwid.NoHWID;
|
|
||||||
import pro.gravit.launcher.profiles.ClientProfile;
|
import pro.gravit.launcher.profiles.ClientProfile;
|
||||||
import pro.gravit.launcher.request.auth.AuthRequest;
|
import pro.gravit.launcher.request.auth.AuthRequest;
|
||||||
import pro.gravit.launcher.request.auth.password.AuthECPassword;
|
import pro.gravit.launcher.request.auth.password.AuthECPassword;
|
||||||
import pro.gravit.launcher.request.auth.password.AuthPlainPassword;
|
import pro.gravit.launcher.request.auth.password.AuthPlainPassword;
|
||||||
import pro.gravit.launchserver.auth.AuthException;
|
import pro.gravit.launchserver.auth.AuthException;
|
||||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||||
import pro.gravit.launchserver.auth.hwid.HWIDException;
|
|
||||||
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
||||||
import pro.gravit.launchserver.auth.provider.AuthProviderResult;
|
import pro.gravit.launchserver.auth.provider.AuthProviderResult;
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import pro.gravit.launchserver.socket.Client;
|
||||||
|
@ -39,7 +36,6 @@ public class AuthResponse extends SimpleResponse {
|
||||||
|
|
||||||
public String auth_id;
|
public String auth_id;
|
||||||
public ConnectTypes authType;
|
public ConnectTypes authType;
|
||||||
public HWID hwid;
|
|
||||||
|
|
||||||
public enum ConnectTypes {
|
public enum ConnectTypes {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -69,7 +65,6 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
|
||||||
throw new AuthException("Password decryption error");
|
throw new AuthException("Password decryption error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(hwid == null) hwid = new NoHWID();
|
|
||||||
AuthProviderPair pair;
|
AuthProviderPair pair;
|
||||||
if (auth_id.isEmpty()) pair = server.config.getAuthProviderPair();
|
if (auth_id.isEmpty()) pair = server.config.getAuthProviderPair();
|
||||||
else pair = server.config.getAuthProviderPair(auth_id);
|
else pair = server.config.getAuthProviderPair(auth_id);
|
||||||
|
@ -78,7 +73,7 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
|
||||||
sendError("auth_id incorrect");
|
sendError("auth_id incorrect");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AuthContext context = new AuthContext(clientData, login, client, hwid, ip, authType);
|
AuthContext context = new AuthContext(clientData, login, client, ip, authType);
|
||||||
AuthProvider provider = pair.provider;
|
AuthProvider provider = pair.provider;
|
||||||
server.authHookManager.preHook.hook(context, clientData);
|
server.authHookManager.preHook.hook(context, clientData);
|
||||||
provider.preAuth(login, password, ip);
|
provider.preAuth(login, password, ip);
|
||||||
|
@ -99,8 +94,6 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
|
||||||
//if (clientData.profile == null) {
|
//if (clientData.profile == null) {
|
||||||
// throw new AuthException("You profile not found");
|
// throw new AuthException("You profile not found");
|
||||||
//}
|
//}
|
||||||
if (authType == ConnectTypes.CLIENT)
|
|
||||||
pair.hwid.check(hwid, aresult.username);
|
|
||||||
server.authHookManager.postHook.hook(context, clientData);
|
server.authHookManager.postHook.hook(context, clientData);
|
||||||
clientData.isAuth = true;
|
clientData.isAuth = true;
|
||||||
clientData.permissions = aresult.permissions;
|
clientData.permissions = aresult.permissions;
|
||||||
|
@ -128,17 +121,16 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
|
||||||
}
|
}
|
||||||
clientData.type = authType;
|
clientData.type = authType;
|
||||||
sendResult(result);
|
sendResult(result);
|
||||||
} catch (AuthException | HWIDException | HookException e) {
|
} catch (AuthException | HookException e) {
|
||||||
sendError(e.getMessage());
|
sendError(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AuthContext {
|
public static class AuthContext {
|
||||||
public AuthContext(Client client, String login, String profileName, HWID hwid, String ip, ConnectTypes authType) {
|
public AuthContext(Client client, String login, String profileName, String ip, ConnectTypes authType) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.login = login;
|
this.login = login;
|
||||||
this.profileName = profileName;
|
this.profileName = profileName;
|
||||||
this.hwid = hwid;
|
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
this.authType = authType;
|
this.authType = authType;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +139,6 @@ public AuthContext(Client client, String login, String profileName, HWID hwid, S
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int password_length; //Use AuthProvider for get password
|
public int password_length; //Use AuthProvider for get password
|
||||||
public final String profileName;
|
public final String profileName;
|
||||||
public final HWID hwid;
|
|
||||||
public final String ip;
|
public final String ip;
|
||||||
public final ConnectTypes authType;
|
public final ConnectTypes authType;
|
||||||
public final Client client;
|
public final Client client;
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
import pro.gravit.launcher.guard.LauncherGuardManager;
|
import pro.gravit.launcher.guard.LauncherGuardManager;
|
||||||
import pro.gravit.launcher.gui.NoRuntimeProvider;
|
import pro.gravit.launcher.gui.NoRuntimeProvider;
|
||||||
import pro.gravit.launcher.gui.RuntimeProvider;
|
import pro.gravit.launcher.gui.RuntimeProvider;
|
||||||
import pro.gravit.launcher.hwid.HWIDProvider;
|
|
||||||
import pro.gravit.launcher.managers.ClientGsonManager;
|
import pro.gravit.launcher.managers.ClientGsonManager;
|
||||||
import pro.gravit.launcher.managers.ClientHookManager;
|
import pro.gravit.launcher.managers.ClientHookManager;
|
||||||
import pro.gravit.launcher.managers.ConsoleManager;
|
import pro.gravit.launcher.managers.ConsoleManager;
|
||||||
|
@ -83,7 +82,6 @@ public static void main(String... args) throws Throwable {
|
||||||
// Start Launcher
|
// Start Launcher
|
||||||
initGson(LauncherEngine.modulesManager);
|
initGson(LauncherEngine.modulesManager);
|
||||||
ConsoleManager.initConsole();
|
ConsoleManager.initConsole();
|
||||||
HWIDProvider.registerHWIDs();
|
|
||||||
LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase());
|
LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase());
|
||||||
Launcher.getConfig(); // init config
|
Launcher.getConfig(); // init config
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
|
@ -3,14 +3,12 @@
|
||||||
import pro.gravit.launcher.*;
|
import pro.gravit.launcher.*;
|
||||||
import pro.gravit.launcher.api.AuthService;
|
import pro.gravit.launcher.api.AuthService;
|
||||||
import pro.gravit.launcher.api.ClientService;
|
import pro.gravit.launcher.api.ClientService;
|
||||||
import pro.gravit.launcher.api.SystemService;
|
|
||||||
import pro.gravit.launcher.client.events.ClientLaunchPhase;
|
import pro.gravit.launcher.client.events.ClientLaunchPhase;
|
||||||
import pro.gravit.launcher.client.events.ClientLauncherInitPhase;
|
import pro.gravit.launcher.client.events.ClientLauncherInitPhase;
|
||||||
import pro.gravit.launcher.client.events.ClientLauncherPostInitPhase;
|
import pro.gravit.launcher.client.events.ClientLauncherPostInitPhase;
|
||||||
import pro.gravit.launcher.guard.LauncherGuardManager;
|
import pro.gravit.launcher.guard.LauncherGuardManager;
|
||||||
import pro.gravit.launcher.hasher.FileNameMatcher;
|
import pro.gravit.launcher.hasher.FileNameMatcher;
|
||||||
import pro.gravit.launcher.hasher.HashedDir;
|
import pro.gravit.launcher.hasher.HashedDir;
|
||||||
import pro.gravit.launcher.hwid.HWIDProvider;
|
|
||||||
import pro.gravit.launcher.managers.ClientGsonManager;
|
import pro.gravit.launcher.managers.ClientGsonManager;
|
||||||
import pro.gravit.launcher.managers.ClientHookManager;
|
import pro.gravit.launcher.managers.ClientHookManager;
|
||||||
import pro.gravit.launcher.modules.events.PreConfigPhase;
|
import pro.gravit.launcher.modules.events.PreConfigPhase;
|
||||||
|
@ -457,7 +455,6 @@ public static void main(String... args) throws Throwable {
|
||||||
JVMHelper.checkStackTrace(ClientLauncher.class);
|
JVMHelper.checkStackTrace(ClientLauncher.class);
|
||||||
LogHelper.printVersion("Client Launcher");
|
LogHelper.printVersion("Client Launcher");
|
||||||
engine.readKeys();
|
engine.readKeys();
|
||||||
HWIDProvider.registerHWIDs();
|
|
||||||
LauncherGuardManager.initGuard(true);
|
LauncherGuardManager.initGuard(true);
|
||||||
LogHelper.debug("Reading ClientLauncher params");
|
LogHelper.debug("Reading ClientLauncher params");
|
||||||
ParamContainer p = container.read();
|
ParamContainer p = container.read();
|
||||||
|
|
|
@ -1,129 +0,0 @@
|
||||||
package pro.gravit.launcher.hwid;
|
|
||||||
|
|
||||||
import oshi.SystemInfo;
|
|
||||||
import oshi.hardware.*;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.net.NetworkInterface;
|
|
||||||
|
|
||||||
public class OshiHWIDProvider implements LauncherHWIDInterface {
|
|
||||||
public SystemInfo systemInfo;
|
|
||||||
public HardwareAbstractionLayer hardware;
|
|
||||||
public boolean noHWID;
|
|
||||||
|
|
||||||
public OshiHWIDProvider() {
|
|
||||||
try {
|
|
||||||
systemInfo = new SystemInfo();
|
|
||||||
noHWID = false;
|
|
||||||
} catch (Throwable e) {
|
|
||||||
LogHelper.error(e);
|
|
||||||
noHWID = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSerial() {
|
|
||||||
try {
|
|
||||||
if (hardware == null) hardware = systemInfo.getHardware();
|
|
||||||
return hardware.getComputerSystem().getSerialNumber();
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogHelper.error(e);
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProcessorID() {
|
|
||||||
try {
|
|
||||||
if (hardware == null) hardware = systemInfo.getHardware();
|
|
||||||
return hardware.getProcessor().getProcessorID();
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogHelper.error(e);
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHWDisk() {
|
|
||||||
try {
|
|
||||||
if (hardware == null) hardware = systemInfo.getHardware();
|
|
||||||
HWDiskStore store = null;
|
|
||||||
long size = 0;
|
|
||||||
for (HWDiskStore s : hardware.getDiskStores()) {
|
|
||||||
if (size < s.getSize()) {
|
|
||||||
store = s;
|
|
||||||
size = s.getSize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return store == null ? "" : store.getSerial();
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogHelper.error(e);
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMacAddr() {
|
|
||||||
for (NetworkIF networkIF : hardware.getNetworkIFs()) {
|
|
||||||
if (networkIF.getNetworkInterface().isVirtual()) continue;
|
|
||||||
for (String ipv4 : networkIF.getIPv4addr()) {
|
|
||||||
if (ipv4.startsWith("127.")) continue;
|
|
||||||
if (ipv4.startsWith("10.")) continue;
|
|
||||||
return networkIF.getMacaddr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTotalMemory() {
|
|
||||||
if (noHWID) return 1024 << 20;
|
|
||||||
if (hardware == null) hardware = systemInfo.getHardware();
|
|
||||||
return hardware.getMemory().getTotal();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getAvailableMemory() {
|
|
||||||
if (noHWID) return -1;
|
|
||||||
if (hardware == null) hardware = systemInfo.getHardware();
|
|
||||||
return hardware.getMemory().getAvailable();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void printHardwareInformation() {
|
|
||||||
try {
|
|
||||||
if (hardware == null) hardware = systemInfo.getHardware();
|
|
||||||
ComputerSystem computerSystem = hardware.getComputerSystem();
|
|
||||||
LogHelper.debug("ComputerSystem Model: %s Serial: %s", computerSystem.getModel(), computerSystem.getSerialNumber());
|
|
||||||
for (HWDiskStore s : hardware.getDiskStores()) {
|
|
||||||
LogHelper.debug("HWDiskStore Serial: %s Model: %s Size: %d", s.getSerial(), s.getModel(), s.getSize());
|
|
||||||
}
|
|
||||||
for (UsbDevice s : hardware.getUsbDevices(true)) {
|
|
||||||
LogHelper.debug("USBDevice Serial: %s Name: %s", s.getSerialNumber(), s.getName());
|
|
||||||
}
|
|
||||||
for (NetworkIF networkIF : hardware.getNetworkIFs()) {
|
|
||||||
LogHelper.debug("Network Interface: %s mac: %s", networkIF.getName(), networkIF.getMacaddr());
|
|
||||||
NetworkInterface network = networkIF.getNetworkInterface();
|
|
||||||
if (network.isLoopback() || network.isVirtual()) continue;
|
|
||||||
LogHelper.debug("Network Interface display: %s name: %s", network.getDisplayName(), network.getName());
|
|
||||||
for (String ipv4 : networkIF.getIPv4addr()) {
|
|
||||||
if (ipv4.startsWith("127.")) continue;
|
|
||||||
if (ipv4.startsWith("10.")) continue;
|
|
||||||
LogHelper.subDebug("IPv4: %s", ipv4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CentralProcessor processor = hardware.getProcessor();
|
|
||||||
LogHelper.debug("Processor Model: %s ID: %s", processor.getModel(), processor.getProcessorID());
|
|
||||||
} catch (Throwable e) {
|
|
||||||
LogHelper.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HWID getHWID() {
|
|
||||||
OshiHWID hwid = new OshiHWID();
|
|
||||||
hwid.serialNumber = getSerial();
|
|
||||||
hwid.totalMemory = getTotalMemory();
|
|
||||||
hwid.HWDiskSerial = getHWDisk();
|
|
||||||
hwid.processorID = getProcessorID();
|
|
||||||
hwid.macAddr = getMacAddr();
|
|
||||||
printHardwareInformation();
|
|
||||||
return hwid;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,8 +3,6 @@
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import pro.gravit.launcher.client.ClientModuleManager;
|
import pro.gravit.launcher.client.ClientModuleManager;
|
||||||
import pro.gravit.launcher.client.UserSettings;
|
import pro.gravit.launcher.client.UserSettings;
|
||||||
import pro.gravit.launcher.hwid.HWID;
|
|
||||||
import pro.gravit.launcher.hwid.HWIDProvider;
|
|
||||||
import pro.gravit.launcher.modules.events.PreGsonPhase;
|
import pro.gravit.launcher.modules.events.PreGsonPhase;
|
||||||
import pro.gravit.launcher.request.websockets.ClientWebSocketService;
|
import pro.gravit.launcher.request.websockets.ClientWebSocketService;
|
||||||
import pro.gravit.utils.UniversalJsonAdapter;
|
import pro.gravit.utils.UniversalJsonAdapter;
|
||||||
|
@ -20,7 +18,6 @@ public ClientGsonManager(ClientModuleManager moduleManager) {
|
||||||
public void registerAdapters(GsonBuilder builder) {
|
public void registerAdapters(GsonBuilder builder) {
|
||||||
super.registerAdapters(builder);
|
super.registerAdapters(builder);
|
||||||
builder.registerTypeAdapter(UserSettings.class, new UniversalJsonAdapter<>(UserSettings.providers));
|
builder.registerTypeAdapter(UserSettings.class, new UniversalJsonAdapter<>(UserSettings.providers));
|
||||||
builder.registerTypeAdapter(HWID.class, new UniversalJsonAdapter<>(HWIDProvider.hwids));
|
|
||||||
ClientWebSocketService.appendTypeAdapters(builder);
|
ClientWebSocketService.appendTypeAdapters(builder);
|
||||||
moduleManager.invokeEvent(new PreGsonPhase(builder));
|
moduleManager.invokeEvent(new PreGsonPhase(builder));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package pro.gravit.launcher.hwid;
|
package pro.gravit.launcher.hwid;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public interface HWID {
|
public interface HWID {
|
||||||
|
|
||||||
int getLevel(); //Уровень доверия, насколько уникальные значения
|
int getLevel(); //Уровень доверия, насколько уникальные значения
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
package pro.gravit.launcher.hwid;
|
|
||||||
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
public class HWIDCheckHelper {
|
|
||||||
public static int checkString(String str) {
|
|
||||||
int result = 0;
|
|
||||||
//Считаем символы
|
|
||||||
char lastChar = '\0';
|
|
||||||
int combo = 0;
|
|
||||||
int maxCombo = 0;
|
|
||||||
//Считаем род символов
|
|
||||||
int lastCharType = -1;
|
|
||||||
int lastCharTypeCombo = 0;
|
|
||||||
int wtfCharTypeCombo = 0;
|
|
||||||
boolean skipLastCharType = true;
|
|
||||||
for (char c : str.toCharArray()) {
|
|
||||||
if (c == lastChar || Math.abs(c - lastChar) == 1 ||
|
|
||||||
((lastChar == '0' || lastChar == '9') && (c == 'A' || c == 'a'))) //Переход с 0 или 9 на A или a
|
|
||||||
{
|
|
||||||
combo++;
|
|
||||||
} else {
|
|
||||||
combo = 1;
|
|
||||||
}
|
|
||||||
lastChar = c;
|
|
||||||
if (maxCombo < combo)
|
|
||||||
maxCombo = combo;
|
|
||||||
int charType = getCharType(c);
|
|
||||||
if (lastCharType == charType) {
|
|
||||||
lastCharTypeCombo++;
|
|
||||||
//Нам подсунули серию из идущих подряд спец символов. Что за?
|
|
||||||
if ((charType == -1 || charType == 3) && lastCharTypeCombo > 2) {
|
|
||||||
wtfCharTypeCombo += 3;
|
|
||||||
}
|
|
||||||
//Нам подсунули серию из слишком большого числа идущих подряд чисел. Что за?
|
|
||||||
if ((charType == 0) && lastCharTypeCombo > 4) {
|
|
||||||
wtfCharTypeCombo++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (skipLastCharType && (charType == -1 || charType == 3)) {
|
|
||||||
skipLastCharType = false;
|
|
||||||
} else {
|
|
||||||
skipLastCharType = true;
|
|
||||||
lastCharType = charType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Считаем результат
|
|
||||||
LogHelper.debug("HWID Checker maxCombo %d", maxCombo);
|
|
||||||
LogHelper.debug("HWID Checker wtfCharTypeCombo %d", wtfCharTypeCombo);
|
|
||||||
if (maxCombo > 3) result += maxCombo * 3;
|
|
||||||
if (wtfCharTypeCombo > 1) result += wtfCharTypeCombo * 2;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getCharType(char c) {
|
|
||||||
if (c >= '0' && c <= '9') return 0;
|
|
||||||
if (c >= 'A' && c <= 'Z') return 1;
|
|
||||||
if (c >= 'a' && c <= 'z') return 2;
|
|
||||||
if (c == ' ' || c == '-' || c == '_') return 3;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
package pro.gravit.launcher.hwid;
|
|
||||||
|
|
||||||
import pro.gravit.utils.ProviderMap;
|
|
||||||
|
|
||||||
public class HWIDProvider {
|
|
||||||
public static final ProviderMap<HWID> hwids = new ProviderMap<>();
|
|
||||||
|
|
||||||
public static void registerHWIDs() {
|
|
||||||
hwids.register("oshi", OshiHWID.class);
|
|
||||||
hwids.register("no", NoHWID.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
package pro.gravit.launcher.hwid;
|
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
public interface LauncherHWIDInterface {
|
|
||||||
HWID getHWID();
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
package pro.gravit.launcher.hwid;
|
|
||||||
|
|
||||||
public class NoHWID implements HWID {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLevel() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getAntiLevel() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compare(HWID hwid) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNull() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void normalize() {
|
|
||||||
//Skip
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,105 +0,0 @@
|
||||||
package pro.gravit.launcher.hwid;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import pro.gravit.launcher.LauncherNetworkAPI;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.StringJoiner;
|
|
||||||
|
|
||||||
public class OshiHWID implements HWID {
|
|
||||||
public static Gson gson = new Gson();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public long totalMemory = 0;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public String serialNumber;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public String HWDiskSerial;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public String processorID;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public String macAddr;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLevel() //Уровень доверия, насколько уникальные значения
|
|
||||||
{
|
|
||||||
int result = 0;
|
|
||||||
if (totalMemory != 0) result += 32;
|
|
||||||
if (serialNumber != null) result += isRealSerialNumber() ? 20 : 3;
|
|
||||||
if (HWDiskSerial != null && !HWDiskSerial.isEmpty()) result += 38;
|
|
||||||
if (processorID != null && !processorID.isEmpty()) result += 15;
|
|
||||||
if (macAddr != null && !macAddr.isEmpty()) result += 25;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getAntiLevel() {
|
|
||||||
return HWIDCheckHelper.checkString(serialNumber) + HWIDCheckHelper.checkString(HWDiskSerial);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compare(HWID hwid) {
|
|
||||||
if (hwid instanceof OshiHWID) {
|
|
||||||
int rate = 0;
|
|
||||||
OshiHWID oshi = (OshiHWID) hwid;
|
|
||||||
if (Math.abs(oshi.totalMemory - totalMemory) < 1024 * 1024) rate += 5;
|
|
||||||
if (oshi.totalMemory == totalMemory) rate += 32;
|
|
||||||
if (oshi.HWDiskSerial.equals(HWDiskSerial) && !HWDiskSerial.isEmpty()) rate += 38;
|
|
||||||
if (oshi.processorID.equals(processorID) && !processorID.isEmpty()) rate += 15;
|
|
||||||
if (oshi.serialNumber.equals(serialNumber)) rate += isRealSerialNumber() ? 20 : 3;
|
|
||||||
if (!oshi.macAddr.isEmpty() && oshi.macAddr.equals(macAddr)) rate += 19;
|
|
||||||
return rate;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNull() {
|
|
||||||
return getLevel() < 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void normalize() {
|
|
||||||
HWDiskSerial = HWDiskSerial.trim();
|
|
||||||
serialNumber = serialNumber.trim();
|
|
||||||
processorID = processorID.trim();
|
|
||||||
macAddr = macAddr.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRealSerialNumber() {
|
|
||||||
if (serialNumber.isEmpty()) return false;
|
|
||||||
if (serialNumber.equals("System Serial Number")) return false;
|
|
||||||
if (serialNumber.equals("To be filled by O.E.M.")) return false;
|
|
||||||
if (serialNumber.equals("unknown")) return false;
|
|
||||||
if (serialNumber.equals("None")) return false;
|
|
||||||
if (serialNumber.equals("Default string")) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
OshiHWID oshiHWID = (OshiHWID) o;
|
|
||||||
return totalMemory == oshiHWID.totalMemory &&
|
|
||||||
Objects.equals(serialNumber, oshiHWID.serialNumber) &&
|
|
||||||
Objects.equals(HWDiskSerial, oshiHWID.HWDiskSerial) &&
|
|
||||||
Objects.equals(processorID, oshiHWID.processorID) &&
|
|
||||||
Objects.equals(macAddr, oshiHWID.macAddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(totalMemory, serialNumber, HWDiskSerial, processorID, macAddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new StringJoiner(", ", OshiHWID.class.getSimpleName() + "[", "]")
|
|
||||||
.add("totalMemory=" + totalMemory)
|
|
||||||
.add("serialNumber='" + serialNumber + "'")
|
|
||||||
.add("HWDiskSerial='" + HWDiskSerial + "'")
|
|
||||||
.add("processorID='" + processorID + "'")
|
|
||||||
.add("macAddr='" + macAddr + "'")
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -24,10 +24,6 @@ public interface AuthPasswordInterface {
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private final String auth_id;
|
private final String auth_id;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private final HWID hwid;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final String customText;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final boolean getSession;
|
private final boolean getSession;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private final ConnectTypes authType;
|
private final ConnectTypes authType;
|
||||||
|
@ -45,34 +41,19 @@ public enum ConnectTypes {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AuthRequest(String login, byte[] password, HWID hwid) {
|
public AuthRequest(String login, byte[] password) {
|
||||||
this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty");
|
this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty");
|
||||||
this.password = new AuthECPassword(password.clone());
|
this.password = new AuthECPassword(password.clone());
|
||||||
this.hwid = hwid;
|
|
||||||
customText = "";
|
|
||||||
auth_id = "";
|
auth_id = "";
|
||||||
getSession = true;
|
getSession = true;
|
||||||
authType = ConnectTypes.CLIENT;
|
authType = ConnectTypes.CLIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public AuthRequest(String login, byte[] password, HWID hwid, String auth_id) {
|
public AuthRequest(String login, byte[] password, HWID hwid, String auth_id) {
|
||||||
this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty");
|
this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty");
|
||||||
this.password = new AuthECPassword(password.clone());
|
this.password = new AuthECPassword(password.clone());
|
||||||
this.hwid = hwid;
|
|
||||||
this.auth_id = auth_id;
|
this.auth_id = auth_id;
|
||||||
customText = "";
|
|
||||||
getSession = true;
|
|
||||||
authType = ConnectTypes.CLIENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public AuthRequest(String login, byte[] password, HWID hwid, String customText, String auth_id) {
|
|
||||||
this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty");
|
|
||||||
this.password = new AuthECPassword(password.clone());
|
|
||||||
this.hwid = hwid;
|
|
||||||
this.auth_id = auth_id;
|
|
||||||
this.customText = customText;
|
|
||||||
getSession = true;
|
getSession = true;
|
||||||
authType = ConnectTypes.CLIENT;
|
authType = ConnectTypes.CLIENT;
|
||||||
}
|
}
|
||||||
|
@ -82,8 +63,6 @@ public AuthRequest(String login, byte[] encryptedPassword, String auth_id, Conne
|
||||||
this.password = new AuthECPassword(encryptedPassword.clone());
|
this.password = new AuthECPassword(encryptedPassword.clone());
|
||||||
this.auth_id = auth_id;
|
this.auth_id = auth_id;
|
||||||
this.authType = authType;
|
this.authType = authType;
|
||||||
this.hwid = null;
|
|
||||||
this.customText = "";
|
|
||||||
this.getSession = false;
|
this.getSession = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +71,6 @@ public AuthRequest(String login, String password, String auth_id, ConnectTypes a
|
||||||
this.password = new AuthPlainPassword(password);
|
this.password = new AuthPlainPassword(password);
|
||||||
this.auth_id = auth_id;
|
this.auth_id = auth_id;
|
||||||
this.authType = authType;
|
this.authType = authType;
|
||||||
this.hwid = null;
|
|
||||||
this.customText = "";
|
|
||||||
this.getSession = false;
|
this.getSession = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue