block&replace ext development, LinuxHabboClient efficiency update

This commit is contained in:
sirjonasxx 2018-10-05 18:38:42 +02:00
parent 71a2a385c9
commit 7037d470aa
4 changed files with 100 additions and 34 deletions

View File

@ -3,6 +3,9 @@ package main.extensions.examples.blockreplacepackets;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javafx.stage.Stage; import javafx.stage.Stage;
import main.extensions.ExtensionForm; import main.extensions.ExtensionForm;
import main.extensions.ExtensionInfo; import main.extensions.ExtensionInfo;
@ -23,11 +26,22 @@ import java.net.URL;
) )
public class BlockAndReplacePackets extends ExtensionForm { public class BlockAndReplacePackets extends ExtensionForm {
public TextField txt_replacement;
public ComboBox<String> cmb_type;
public TextField txt_id;
public Button btn_add;
public static void main(String[] args) { public static void main(String[] args) {
ExtensionForm.args = args; ExtensionForm.args = args;
launch(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 @Override
protected void initExtension() { protected void initExtension() {
@ -38,7 +52,8 @@ public class BlockAndReplacePackets extends ExtensionForm {
FXMLLoader loader = new FXMLLoader(BlockAndReplacePackets.class.getResource("blockreplace.fxml")); FXMLLoader loader = new FXMLLoader(BlockAndReplacePackets.class.getResource("blockreplace.fxml"));
Parent root = loader.load(); Parent root = loader.load();
primaryStage.setTitle("Packet blocker and replacer"); primaryStage.setTitle("Packet blocker &/ replacer");
primaryStage.setScene(new Scene(root, 565, 262)); primaryStage.setScene(new Scene(root, 580, 262));
primaryStage.getScene().getStylesheets().add(GEarthController.class.getResource("bootstrap3.css").toExternalForm());
} }
} }

View File

@ -1,36 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextArea?> <?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?> <?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?> <?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?> <?import javafx.scene.layout.RowConstraints?>
<GridPane prefHeight="260.0" prefWidth="179.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.extensions.examples.blockreplacepackets.BlockAndReplacePackets"> <TabPane prefHeight="255.0" prefWidth="580.0" tabClosingPolicy="UNAVAILABLE" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.extensions.examples.blockreplacepackets.BlockAndReplacePackets">
<columnConstraints> <tabs>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="367.0" minWidth="10.0" prefWidth="163.0" /> <Tab text="Block/replace packet">
</columnConstraints> <content>
<rowConstraints> <GridPane>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <columnConstraints>
</rowConstraints> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<children> </columnConstraints>
<GridPane> <rowConstraints>
<columnConstraints> <RowConstraints maxHeight="209.0" minHeight="10.0" prefHeight="187.0" vgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <RowConstraints maxHeight="363.0" minHeight="10.0" prefHeight="35.0" vgrow="SOMETIMES" />
</columnConstraints> </rowConstraints>
<rowConstraints> <children>
<RowConstraints maxHeight="121.0" minHeight="10.0" prefHeight="28.0" vgrow="SOMETIMES" /> <GridPane prefHeight="30.0" prefWidth="500.0" GridPane.rowIndex="1">
<RowConstraints maxHeight="234.0" minHeight="10.0" prefHeight="234.0" vgrow="SOMETIMES" /> <columnConstraints>
</rowConstraints> <ColumnConstraints hgrow="SOMETIMES" maxWidth="118.0" minWidth="10.0" prefWidth="28.0" />
<children> <ColumnConstraints hgrow="SOMETIMES" maxWidth="291.0" minWidth="0.0" prefWidth="68.0" />
<TextArea fx:id="text" editable="false" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1"> <ColumnConstraints hgrow="SOMETIMES" maxWidth="291.0" minWidth="0.0" prefWidth="124.0" />
<GridPane.margin> <ColumnConstraints hgrow="SOMETIMES" maxWidth="246.0" minWidth="10.0" prefWidth="246.0" />
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="91.0" minWidth="10.0" prefWidth="68.0" />
</GridPane.margin> </columnConstraints>
</TextArea> <rowConstraints>
<Label alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="Blocks packets:" textAlignment="CENTER" GridPane.halignment="CENTER" GridPane.valignment="CENTER" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</children> </rowConstraints>
</GridPane> <children>
</children> <Button fx:id="btn_add" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Add" GridPane.columnIndex="4">
</GridPane> <GridPane.margin>
<Insets left="5.0" right="5.0" />
</GridPane.margin>
</Button>
<Label alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="Id:" textAlignment="CENTER" textFill="#000000ba" />
<TextField fx:id="txt_id" GridPane.columnIndex="1">
<GridPane.margin>
<Insets left="5.0" right="5.0" />
</GridPane.margin>
</TextField>
<ComboBox fx:id="cmb_type" maxWidth="1.7976931348623157E308" GridPane.columnIndex="2">
<GridPane.margin>
<Insets left="5.0" right="5.0" />
</GridPane.margin>
</ComboBox>
<TextField fx:id="txt_replacement" disable="true" GridPane.columnIndex="3">
<GridPane.margin>
<Insets left="5.0" right="5.0" />
</GridPane.margin>
</TextField>
</children>
<GridPane.margin>
<Insets bottom="10.0" left="17.0" right="17.0" />
</GridPane.margin>
</GridPane>
</children>
</GridPane>
</content>
</Tab>
<Tab text="Block/replace value">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</Tab>
</tabs>
</TabPane>

View File

@ -146,10 +146,22 @@ public class LinuxHabboClient extends HabboClient {
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) {
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 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);
}
} }
} }
} }

View File

@ -109,7 +109,6 @@ public abstract class Handler {
((List<TrafficListener>)listeners[x]).get(i).onCapture(message); ((List<TrafficListener>)listeners[x]).get(i).onCapture(message);
} }
} }
} }
public void sendToStream(byte[] buffer) { public void sendToStream(byte[] buffer) {