parallel threaded search for RC4 key speed-up

This commit is contained in:
sirjonasxx 2018-06-13 22:01:28 +02:00
parent dbea4608e1
commit 809b68869a

View File

@ -155,13 +155,17 @@ public class LinuxHabboClient implements HabboClient {
private List<LinuxMemorySnippet> createMemorySnippetListForRC4() { private List<LinuxMemorySnippet> createMemorySnippetListForRC4() {
int offset = 4; Object lock = new Object();
refreshMemoryMaps(); refreshMemoryMaps();
String memoryPath = "/proc/" + PID + "/mem"; String memoryPath = "/proc/" + PID + "/mem";
int[] count = {0};
List<LinuxMemorySnippet> result = new ArrayList<>(); List<LinuxMemorySnippet> result = new ArrayList<>();
for (long[] map : maps) { for (long[] map : maps) {
new Thread(() -> {
int offset = 4;
long start = map[0]; long start = map[0];
long end = map[1]; long end = map[1];
@ -229,7 +233,22 @@ public class LinuxHabboClient implements HabboClient {
if (matchStart != -1) { if (matchStart != -1) {
result.add(new LinuxMemorySnippet(start + matchStart, new byte[matchEnd - matchStart + 4])); result.add(new LinuxMemorySnippet(start + matchStart, new byte[matchEnd - matchStart + 4]));
} }
synchronized (lock) {
count[0] ++;
} }
}).start();
}
while (count[0] < maps.size()) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return result; return result;
} }
} }