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,13 +149,17 @@ public class LinuxHabboClient extends HabboClient {
} }
public List<byte[]> getRC4possibilities() { public List<byte[]> getRC4possibilities() {
int offset = 4; int offset = 4;
List<byte[]> resultSet = new ArrayList<>();
for (PotentialHabboProcess process : potentialProcesses) {
PID = process.PID;
maps = process.maps;
List<LinuxMemorySnippet> possibilities = createMemorySnippetListForRC4(); List<LinuxMemorySnippet> possibilities = createMemorySnippetListForRC4();
fetchMemory(possibilities); fetchMemory(possibilities);
List<byte[]> resultSet = new ArrayList<>();
for (LinuxMemorySnippet snippet : possibilities) { for (LinuxMemorySnippet snippet : possibilities) {
if (snippet.getData().length >= 1024 && snippet.getData().length <= 1024+2*offset) { if (snippet.getData().length >= 1024 && snippet.getData().length <= 1024+2*offset) {
for (int i = 0; i < (snippet.getData().length - ((256 - 1) * offset)); i+=offset) { for (int i = 0; i < (snippet.getData().length - ((256 - 1) * offset)); i+=offset) {
@ -170,6 +182,7 @@ public class LinuxHabboClient extends HabboClient {
} }
} }
} }
}
return resultSet; return resultSet;
} }