mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-07-02 14:25:33 +02:00
cleaning up shitty code
This commit is contained in:
parent
a085b2c494
commit
a18256640e
|
@ -1,13 +1,14 @@
|
||||||
package main.protocol.memory;
|
package main.protocol.memory;
|
||||||
|
|
||||||
import main.irrelevant.Timer;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Array;
|
import java.nio.file.Files;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class FlashClient {
|
public class FlashClient {
|
||||||
|
|
||||||
|
|
||||||
|
private static final String[] potentialProcessNames = {"--ppapi-flash-args", "plugin-container"};
|
||||||
|
|
||||||
private int PID;
|
private int PID;
|
||||||
private List<long[]> maps;
|
private List<long[]> maps;
|
||||||
|
|
||||||
|
@ -20,10 +21,16 @@ public class FlashClient {
|
||||||
do {
|
do {
|
||||||
File[] fileList = folder.listFiles();
|
File[] fileList = folder.listFiles();
|
||||||
for (File file : fileList) {
|
for (File file : fileList) {
|
||||||
if (file.isDirectory() && MemoryUtils.stringIsNumeric(file.getName())) {
|
if (file.isDirectory() && stringIsNumeric(file.getName())) {
|
||||||
String path = "/proc/" + file.getName() + "/cmdline";
|
String path = "/proc/" + file.getName() + "/cmdline";
|
||||||
if (MemoryUtils.fileContainsString(path, "--ppapi-flash-args") ||
|
boolean isHabboProcess = false;
|
||||||
MemoryUtils.fileContainsString(path, "plugin-container")) {
|
for (String s : potentialProcessNames) {
|
||||||
|
if (fileContainsString(path, s)) {
|
||||||
|
isHabboProcess = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isHabboProcess) {
|
||||||
client = new FlashClient();
|
client = new FlashClient();
|
||||||
client.PID = Integer.parseInt(file.getName());
|
client.PID = Integer.parseInt(file.getName());
|
||||||
client.maps = new ArrayList<>();
|
client.maps = new ArrayList<>();
|
||||||
|
@ -151,33 +158,24 @@ public class FlashClient {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
|
||||||
FlashClient client = FlashClient.create();
|
|
||||||
client.refreshMemoryMaps();
|
|
||||||
|
|
||||||
// List<Long> gameHostOccurences = client.searchOffsetForString("game-nl.habbo.com");
|
static boolean stringIsNumeric(String str) {
|
||||||
// List<Long> rsaOccurences = client.searchOffsetForString("xIBlMDUyODA4YzFhYmVmNjlhMWE2MmMzOTYzOTZiODU5NTVlMmZmNTIy");
|
for (char c : str.toCharArray()) {
|
||||||
// List<Long> occ = client.searchOffsetForString("sirjonasxx");
|
if (c < '0' || c > '9') return false;
|
||||||
|
}
|
||||||
// List<MemorySnippet> l = client.createMemorySnippetList();
|
return true;
|
||||||
// client.fetchMemory(l);
|
}
|
||||||
// Thread.sleep(1000);
|
static boolean fileContainsString(String path, String contains) {
|
||||||
// //what didnt change in the last 1000ms?
|
|
||||||
// List<MemorySnippet> l2 = client.differentiate(l, false, 0);
|
|
||||||
// Thread.sleep(1000);
|
|
||||||
// //what changed in the last 1000ms?
|
|
||||||
// List<MemorySnippet> l3 = client.differentiate(l2, true, 0);
|
|
||||||
// Thread.sleep(1000);
|
|
||||||
// //what didnt change in the last 1000ms?
|
|
||||||
// List<MemorySnippet> l4 = client.differentiate(l3, false, 0);
|
|
||||||
// Thread.sleep(1000);
|
|
||||||
// //what changed in the last 1000ms?
|
|
||||||
// List<MemorySnippet> l5 = client.differentiate(l4, true, 0);
|
|
||||||
|
|
||||||
// client.updateMapLocationsSnippetList(l);
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<String> lines = Files.readAllLines(new File(path).toPath());
|
||||||
|
for (String line : lines) {
|
||||||
|
if (line.contains(contains)) return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// process of specified path not running anymore
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
package main.protocol.memory;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
class MemoryUtils {
|
|
||||||
|
|
||||||
static boolean stringIsNumeric(String str) {
|
|
||||||
for (char c : str.toCharArray()) {
|
|
||||||
if (c < '0' || c > '9') return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean fileContainsString(String path, String contains) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
List<String> lines = Files.readAllLines(new File(path).toPath());
|
|
||||||
for (String line : lines) {
|
|
||||||
if (line.contains(contains)) return true;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
// process of specified path not running anymore
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user