From 7037d470aa0029dcf48ecf5c9ad4022ad5a3bfb3 Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Fri, 5 Oct 2018 18:38:42 +0200 Subject: [PATCH] block&replace ext development, LinuxHabboClient efficiency update --- .../BlockAndReplacePackets.java | 19 +++- .../blockreplacepackets/blockreplace.fxml | 96 +++++++++++++------ .../habboclient/linux/LinuxHabboClient.java | 18 +++- src/main/protocol/packethandler/Handler.java | 1 - 4 files changed, 100 insertions(+), 34 deletions(-) diff --git a/src/main/extensions/examples/blockreplacepackets/BlockAndReplacePackets.java b/src/main/extensions/examples/blockreplacepackets/BlockAndReplacePackets.java index 5bf6606..97114ef 100644 --- a/src/main/extensions/examples/blockreplacepackets/BlockAndReplacePackets.java +++ b/src/main/extensions/examples/blockreplacepackets/BlockAndReplacePackets.java @@ -3,6 +3,9 @@ package main.extensions.examples.blockreplacepackets; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.ComboBox; +import javafx.scene.control.TextField; import javafx.stage.Stage; import main.extensions.ExtensionForm; import main.extensions.ExtensionInfo; @@ -23,11 +26,22 @@ import java.net.URL; ) public class BlockAndReplacePackets extends ExtensionForm { + public TextField txt_replacement; + public ComboBox cmb_type; + public TextField txt_id; + public Button btn_add; + public static void main(String[] args) { ExtensionForm.args = args; launch(args); } + //initialize javaFX elements + public void initialize() { + cmb_type.getItems().addAll("Block OUT", "Block IN", "Replace OUT", "Replace IN"); + cmb_type.getSelectionModel().selectFirst(); + } + @Override protected void initExtension() { @@ -38,7 +52,8 @@ public class BlockAndReplacePackets extends ExtensionForm { FXMLLoader loader = new FXMLLoader(BlockAndReplacePackets.class.getResource("blockreplace.fxml")); Parent root = loader.load(); - primaryStage.setTitle("Packet blocker and replacer"); - primaryStage.setScene(new Scene(root, 565, 262)); + primaryStage.setTitle("Packet blocker &/ replacer"); + primaryStage.setScene(new Scene(root, 580, 262)); + primaryStage.getScene().getStylesheets().add(GEarthController.class.getResource("bootstrap3.css").toExternalForm()); } } diff --git a/src/main/extensions/examples/blockreplacepackets/blockreplace.fxml b/src/main/extensions/examples/blockreplacepackets/blockreplace.fxml index 917179b..42748a1 100644 --- a/src/main/extensions/examples/blockreplacepackets/blockreplace.fxml +++ b/src/main/extensions/examples/blockreplacepackets/blockreplace.fxml @@ -1,36 +1,76 @@ + + - + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/protocol/memory/habboclient/linux/LinuxHabboClient.java b/src/main/protocol/memory/habboclient/linux/LinuxHabboClient.java index 6e8198f..1b34393 100644 --- a/src/main/protocol/memory/habboclient/linux/LinuxHabboClient.java +++ b/src/main/protocol/memory/habboclient/linux/LinuxHabboClient.java @@ -146,10 +146,22 @@ public class LinuxHabboClient extends HabboClient { for (LinuxMemorySnippet snippet : possibilities) { 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, 1025 + i); + byte[] wannabeRC4data = Arrays.copyOfRange(snippet.getData(), i, 1024 + i); byte[] data = new byte[256]; // dis is the friggin key - for (int j = 0; j < 256; j++) data[j] = wannabeRC4data[j*4]; - resultSet.add(data); + + 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 (isvalid) { + resultSet.add(data); + } } } } diff --git a/src/main/protocol/packethandler/Handler.java b/src/main/protocol/packethandler/Handler.java index 4660031..0fd4de6 100644 --- a/src/main/protocol/packethandler/Handler.java +++ b/src/main/protocol/packethandler/Handler.java @@ -109,7 +109,6 @@ public abstract class Handler { ((List)listeners[x]).get(i).onCapture(message); } } - } public void sendToStream(byte[] buffer) {