linux multiple potential processes fix

This commit is contained in:
sirjonasxx 2019-01-08 19:54:02 +01:00
parent 031a6bf64d
commit 7839fb4f69

View File

@ -12,8 +12,15 @@ public class LinuxHabboClient extends HabboClient {
private static final String[] potentialProcessNames = {"--ppapi-flash-args", "plugin-container"}; private static final String[] potentialProcessNames = {"--ppapi-flash-args", "plugin-container"};
private int PID; List<PotentialHabboProcess> potentialProcesses = new ArrayList<>();
private List<long[]> maps;
private class PotentialHabboProcess {
public int PID;
public List<long[]> maps;
}
private volatile int PID;
private volatile List<long[]> maps;
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
@ -33,19 +40,20 @@ public class LinuxHabboClient extends HabboClient {
for (String s : potentialProcessNames) { for (String s : potentialProcessNames) {
if (fileContainsString(path, s)) { if (fileContainsString(path, s)) {
isHabboProcess = true; isHabboProcess = true;
break;
} }
} }
if (isHabboProcess) { if (isHabboProcess) {
this.PID = Integer.parseInt(file.getName()); PotentialHabboProcess process = new PotentialHabboProcess();
this.maps = new ArrayList<>(); process.PID = Integer.parseInt(file.getName());
process.maps = new ArrayList<>();
potentialProcesses.add(process);
found = true; found = true;
} }
} }
} }
} while (!found); } while (!found);
if (DEBUG) System.out.println("* Found flashclient process: " + PID); if (DEBUG) System.out.println("* Found flashclient " + potentialProcesses.size() + " potential processes");
} }
@Override @Override
@ -141,32 +149,37 @@ public class LinuxHabboClient extends HabboClient {
} }
public List<byte[]> getRC4possibilities() { public List<byte[]> getRC4possibilities() {
int offset = 4; int offset = 4;
List<LinuxMemorySnippet> possibilities = createMemorySnippetListForRC4();
fetchMemory(possibilities);
List<byte[]> resultSet = new ArrayList<>(); List<byte[]> resultSet = new ArrayList<>();
for (LinuxMemorySnippet snippet : possibilities) { for (PotentialHabboProcess process : potentialProcesses) {
if (snippet.getData().length >= 1024 && snippet.getData().length <= 1024+2*offset) { PID = process.PID;
for (int i = 0; i < (snippet.getData().length - ((256 - 1) * offset)); i+=offset) { maps = process.maps;
byte[] wannabeRC4data = Arrays.copyOfRange(snippet.getData(), i, 1024 + i);
byte[] data = new byte[256]; // dis is the friggin key
boolean isvalid = true; List<LinuxMemorySnippet> possibilities = createMemorySnippetListForRC4();
for (int j = 0; j < 1024; j++) { fetchMemory(possibilities);
if (j % 4 != 0 && wannabeRC4data[j] != 0) {
isvalid = false; for (LinuxMemorySnippet snippet : possibilities) {
break; if (snippet.getData().length >= 1024 && snippet.getData().length <= 1024+2*offset) {
for (int i = 0; i < (snippet.getData().length - ((256 - 1) * offset)); i+=offset) {
byte[] wannabeRC4data = Arrays.copyOfRange(snippet.getData(), i, 1024 + i);
byte[] data = new byte[256]; // dis is the friggin key
boolean isvalid = true;
for (int j = 0; j < 1024; j++) {
if (j % 4 != 0 && wannabeRC4data[j] != 0) {
isvalid = false;
break;
}
if (j % 4 == 0) {
data[j/4] = wannabeRC4data[j];
}
} }
if (j % 4 == 0) { if (isvalid) {
data[j/4] = wannabeRC4data[j]; resultSet.add(data);
} }
} }
if (isvalid) {
resultSet.add(data);
}
} }
} }
} }