//закидываем класс под нативку егорика
[USER=20295]@NATIVE[/USER]
public class Auth extends JFrame {
private static String hwid;
static {
try {
hwid = generateHwid();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public Auth() throws IOException {
}
//Дисплей
public static void Display() {
Frame frame = new Frame();
frame.setVisible(false);
throw new NoStackTrace("Verification was unsuccessful!");
}
public static class Frame extends JFrame {
public Frame() {
this.setTitle("Verification failed.");
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.setLocationRelativeTo(null);
copyToClipboard();
String message = "Sorry, you are not on the HWID list." + "\n" + "HWID: " + hwid + "\n(Copied to clipboard.)";
JOptionPane.showMessageDialog(this, message, "Could not verify your HWID successfully.", JOptionPane.PLAIN_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
public static void copyToClipboard() {
StringSelection selection = new StringSelection(hwid);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(selection, selection);
}
}
private static String generateHwid() throws IOException {
return DigestUtils.md5Hex(DigestUtils.md5Hex(
System.getenv("os")
+ System.getProperty("os.arch")
+ System.getenv("HOMEDRIVE")
+ System.getenv("PROCESSOR_ARCHITEW6432")
+ System.getenv("PROCESSOR_LEVEL")
+ System.getProperty("os.version")
+ System.getProperty("os.name")
+ System.getenv("PROCESSOR_REVISION")
+ System.getenv("PROCESSOR_IDENTIFIER")
+ System.getenv("PROCESSOR_ARCHITECTURE")
+ System.getenv("PHYSICAL_MEMORY_SIZE")
));
}
public static void authenticate() {
try {
//sex crypt url to pastbin
String back = CryptorUtility.decrypt("7gP3DRy0lWzLKbBnkgAJXwGYVaX6LVec0pX7pJ331ffESB61nw1L9eLsSIuehPr9WUAXjA096yl09qBJqCQ==", "br3pdrdex42pidfr");
URL url = new URL(back);
//Чистим стринг что бы его не было в памяти
HideUtil.zeroMemory(back);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
boolean hwidFound = false;
String line;
while((line = reader.readLine()) != null) {
String[] parts = line.split(":");
if (parts.length == 5 && parts[0].equals(hwid)) {
hwidFound = true;
//пример добавление хвида
//hwid:username:uid:till:role
//и каждого юзера с новый строки
Meow.getInstance().username = parts[1];
Meow.getInstance().userid = Integer.parseInt(parts[2]);
Meow.getInstance().usertill = parts[3];
Meow.getInstance().userrole = parts[4];
}
}
reader.close();
if (!hwidFound) {
Display();
System.out.println("Твоего хвида нету в бд");
System.exit(1);
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("Не удалось подключится к бд");
System.exit(1);
}
}
}