diff --git a/src/main/protocol/HPacket.java b/src/main/protocol/HPacket.java index 3cb5bd3..0f14b2d 100644 --- a/src/main/protocol/HPacket.java +++ b/src/main/protocol/HPacket.java @@ -544,7 +544,7 @@ public class HPacket { continue out; } } - if (i+5 < packetInBytes.length && !mask[i+5]) continue; + if (!mask[i-1] || (i+5 < packetInBytes.length && !mask[i+5])) continue; if ((readByte(i) == 0 || readByte(i) == 1) && (readInteger(i+1) > 1 || readInteger(i+1) < 0)) { //decide the first byte to be the a boolean @@ -784,6 +784,8 @@ public class HPacket { packet = new HPacket("[0][0][0]ã[4]Ù[0][0][0][12][0][0][0][1][0][18]Vetste Evenementen[0][0][0][0][2][0][16]Feesten & Muziek[1][0][0][0][3][0][10]Rollenspel[1][0][0][0][4][0][9]Help Desk[1][0][0][0][5][0][6]Ruilen[1][0][0][0][6][0][5]Games[1][0][0][0][7][0][7]Bouwers[1][0][0][0][8][0][21]Debatten & Discussies[1][0][0][0][9][0][9]Friending[1][0][0][0][10][0][10]Habbo Werk[1][0][0][0][11][0][9]Evenement[1][0][0][0][12][0][17]Groepsevenementen[0]"); System.out.println(packet.toExpression()); + packet = new HPacket("[0][0][0][14][12]ã[0][0][0][4][0][0][0][0][1][26]#»"); + System.out.println(packet.toExpression()); } diff --git a/src/main/protocol/memory/HabboClient.java b/src/main/protocol/memory/HabboClient.java index 8b172a1..5052496 100644 --- a/src/main/protocol/memory/HabboClient.java +++ b/src/main/protocol/memory/HabboClient.java @@ -158,6 +158,32 @@ public class HabboClient { return result; } + @SuppressWarnings("Duplicates") + public void pauseProcess() { + String[] args = new String[] {"kill", "-STOP", PID+""}; + Process proc; + try { + proc = new ProcessBuilder(args).start(); + proc.waitFor(); + proc.destroy(); + } catch (IOException | InterruptedException e) { + e.printStackTrace(); + } + } + + @SuppressWarnings("Duplicates") + public void resumeProcess() { + String[] args = new String[] {"kill", "-CONT", PID+""}; + Process proc; + try { + proc = new ProcessBuilder(args).start(); + proc.waitFor(); + proc.destroy(); + } catch (IOException | InterruptedException e) { + e.printStackTrace(); + } + } + static boolean stringIsNumeric(String str) { for (char c : str.toCharArray()) { diff --git a/src/main/protocol/memory/Rc4Obtainer.java b/src/main/protocol/memory/Rc4Obtainer.java index 6a3e4e8..696af2c 100644 --- a/src/main/protocol/memory/Rc4Obtainer.java +++ b/src/main/protocol/memory/Rc4Obtainer.java @@ -15,7 +15,7 @@ import java.util.Random; public class Rc4Obtainer { - public static final boolean DEBUG = false; + public static final boolean DEBUG = true; HabboClient client = null; OutgoingHandler outgoingHandler = null; @@ -77,8 +77,11 @@ public class Rc4Obtainer { // STEP ONE: filtering to obtain one area containing the rc4 data field int foundbuffersize = 0; while (foundbuffersize == 0) { + + client.pauseProcess(); diff = client.createMemorySnippetList(); client.fetchMemory(diff); + client.resumeProcess(); this.addedBytes = 0; Random rand = new Random(); @@ -87,8 +90,8 @@ public class Rc4Obtainer { int i = 0; while (getTotalBytesLengthOfDiff(diff) > 2000) { int am = 0; - if (i % 2 == 1) { - am = rand.nextInt(30) + 1; + if (i == 0 || i > 1) { + am = rand.nextInt(25) + 5; for (int j = 0; j < am; j++) { incomingHandler.sendToStream(new HPacket(pingHeader).toBytes()); outgoingHandler.fakePongAlert(); @@ -97,7 +100,9 @@ public class Rc4Obtainer { } sleep(50); int rem = addedBytes; + if (i == 0) client.pauseProcess(); diff = searchForPossibleRC4Tables(diff); + if (i == 0) client.resumeProcess(); if (DEBUG) System.out.println("size: " + getTotalBytesLengthOfDiff(diff) + " with changed bytes: " + rem + " should be: " + am * 6); i++; } @@ -216,7 +221,7 @@ public class Rc4Obtainer { private List searchForPossibleRC4Tables(List snippets) { List result; - result = client.differentiate2(snippets, ((addedBytes * 2) / 3), addedBytes * 2, 1028); + result = client.differentiate2(snippets, addedBytes, addedBytes * 2, 1028); addedBytes = 0; return result;