Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dorving 2022-05-03 06:33:51 +02:00
commit 31e3d571d7
4 changed files with 53 additions and 59 deletions

View File

@ -10,7 +10,7 @@
<properties> <properties>
<javafx.version>1.8</javafx.version> <javafx.version>1.8</javafx.version>
<jettyVersion>9.4.41.v20210516</jettyVersion> <jettyVersion>9.4.43.v20210629</jettyVersion>
</properties> </properties>
<parent> <parent>
@ -75,24 +75,24 @@
<target name="copy G-Earth.jar to Build folder"> <target name="copy G-Earth.jar to Build folder">
<copy todir="../Build/Mac/"> <copy todir="../Build/Mac/">
<fileset dir="target/bin" includes="**/*" /> <fileset dir="target/bin" includes="**/*"/>
<fileset dir="src/main/resources/build/common" includes="**/*" /> <fileset dir="src/main/resources/build/common" includes="**/*"/>
<fileset dir="src/main/resources/build/mac" includes="**/*" excludes=".gitkeep" /> <fileset dir="src/main/resources/build/mac" includes="**/*" excludes=".gitkeep"/>
</copy> </copy>
<copy todir="../Build/Linux/"> <copy todir="../Build/Linux/">
<fileset dir="target/bin" includes="**/*" /> <fileset dir="target/bin" includes="**/*"/>
<fileset dir="src/main/resources/build/common" includes="**/*" /> <fileset dir="src/main/resources/build/common" includes="**/*"/>
<fileset dir="src/main/resources/build/linux" includes="**/*" excludes=".gitkeep" /> <fileset dir="src/main/resources/build/linux" includes="**/*" excludes=".gitkeep"/>
</copy> </copy>
<copy todir="../Build/Windows_32bit/"> <copy todir="../Build/Windows_32bit/">
<fileset dir="target/bin" includes="**/*" /> <fileset dir="target/bin" includes="**/*"/>
<fileset dir="src/main/resources/build/common" includes="**/*" /> <fileset dir="src/main/resources/build/common" includes="**/*"/>
<fileset dir="src/main/resources/build/windows/32bit" includes="**/*" excludes=".gitkeep" /> <fileset dir="src/main/resources/build/windows/32bit" includes="**/*" excludes=".gitkeep"/>
</copy> </copy>
<copy todir="../Build/Windows_64bit/"> <copy todir="../Build/Windows_64bit/">
<fileset dir="target/bin" includes="**/*" /> <fileset dir="target/bin" includes="**/*"/>
<fileset dir="src/main/resources/build/common" includes="**/*" /> <fileset dir="src/main/resources/build/common" includes="**/*"/>
<fileset dir="src/main/resources/build/windows/64bit" includes="**/*" excludes=".gitkeep" /> <fileset dir="src/main/resources/build/windows/64bit" includes="**/*" excludes=".gitkeep"/>
</copy> </copy>
</target> </target>
@ -106,8 +106,7 @@
<phase>clean</phase> <phase>clean</phase>
<configuration> <configuration>
<target name="clean our own build folder"> <target name="clean our own build folder">
<delete dir="../Build" <delete dir="../Build" includeemptydirs="true"/>
includeemptydirs="true"/>
</target> </target>
</configuration> </configuration>
<goals> <goals>

View File

@ -3,25 +3,20 @@ package gearth.protocol.memory;
import gearth.GEarth; import gearth.GEarth;
import gearth.protocol.HConnection; import gearth.protocol.HConnection;
import gearth.protocol.HMessage; import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
import gearth.protocol.crypto.RC4; import gearth.protocol.crypto.RC4;
import gearth.protocol.memory.habboclient.HabboClient; import gearth.protocol.memory.habboclient.HabboClient;
import gearth.protocol.memory.habboclient.HabboClientFactory; import gearth.protocol.memory.habboclient.HabboClientFactory;
import gearth.protocol.packethandler.PayloadBuffer;
import gearth.protocol.packethandler.flash.BufferChangeListener; import gearth.protocol.packethandler.flash.BufferChangeListener;
import gearth.protocol.packethandler.flash.FlashPacketHandler; import gearth.protocol.packethandler.flash.FlashPacketHandler;
import gearth.protocol.packethandler.PayloadBuffer;
import gearth.ui.titlebar.TitleBarController; import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType; import javafx.scene.control.ButtonType;
import javafx.scene.control.Hyperlink; import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.layout.FlowPane; import javafx.scene.layout.FlowPane;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
@ -31,17 +26,15 @@ public class Rc4Obtainer {
public static final boolean DEBUG = false; public static final boolean DEBUG = false;
private HabboClient client; private final HabboClient client;
private List<FlashPacketHandler> flashPacketHandlers; private List<FlashPacketHandler> flashPacketHandlers;
public Rc4Obtainer(HConnection hConnection) { public Rc4Obtainer(HConnection hConnection) {
client = HabboClientFactory.get(hConnection); client = HabboClientFactory.get(hConnection);
} }
public void setFlashPacketHandlers(FlashPacketHandler... flashPacketHandlers) { public void setFlashPacketHandlers(FlashPacketHandler... flashPacketHandlers) {
this.flashPacketHandlers = Arrays.asList(flashPacketHandlers); this.flashPacketHandlers = Arrays.asList(flashPacketHandlers);
for (FlashPacketHandler handler : flashPacketHandlers) { for (FlashPacketHandler handler : flashPacketHandlers) {
BufferChangeListener bufferChangeListener = new BufferChangeListener() { BufferChangeListener bufferChangeListener = new BufferChangeListener() {
@Override @Override
@ -54,12 +47,8 @@ public class Rc4Obtainer {
}; };
handler.getBufferChangeObservable().addListener(bufferChangeListener); handler.getBufferChangeObservable().addListener(bufferChangeListener);
} }
} }
private void onSendFirstEncryptedMessage(FlashPacketHandler flashPacketHandler) { private void onSendFirstEncryptedMessage(FlashPacketHandler flashPacketHandler) {
if (!HConnection.DECRYPTPACKETS) return; if (!HConnection.DECRYPTPACKETS) return;
@ -82,14 +71,13 @@ public class Rc4Obtainer {
if (!worked) { if (!worked) {
System.err.println("COULD NOT FIND RC4 TABLE"); System.err.println("COULD NOT FIND RC4 TABLE");
Platform.runLater(() -> { Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.WARNING, "Something went wrong!", ButtonType.OK); Alert alert = new Alert(Alert.AlertType.WARNING, "Something went wrong!", ButtonType.OK);
FlowPane fp = new FlowPane(); FlowPane fp = new FlowPane();
Label lbl = new Label("G-Earth has experienced an issue" + System.lineSeparator()+ System.lineSeparator() + "Head over to our Troubleshooting page to solve the problem:"); Label lbl = new Label("G-Earth has experienced an issue" + System.lineSeparator() + System.lineSeparator() + "Head over to our Troubleshooting page to solve the problem:");
Hyperlink link = new Hyperlink("https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting"); Hyperlink link = new Hyperlink("https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting");
fp.getChildren().addAll( lbl, link); fp.getChildren().addAll(lbl, link);
link.setOnAction(event -> { link.setOnAction(event -> {
GEarth.main.getHostServices().showDocument(link.getText()); GEarth.main.getHostServices().showDocument(link.getText());
event.consume(); event.consume();
@ -97,64 +85,73 @@ public class Rc4Obtainer {
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.getDialogPane().setContent(fp); alert.getDialogPane().setContent(fp);
alert.setOnCloseRequest(event -> { alert.setOnCloseRequest(event -> GEarth.main.getHostServices().showDocument(link.getText()));
GEarth.main.getHostServices().showDocument(link.getText());
});
try { try {
TitleBarController.create(alert).showAlert(); TitleBarController.create(alert).showAlert();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
}); });
} }
long endTime = System.currentTimeMillis(); final long endTime = System.currentTimeMillis();
if (DEBUG) { if (DEBUG)
System.out.println("Cracked RC4 in " + (endTime - startTime) + "ms"); System.out.println("Cracked RC4 in " + (endTime - startTime) + "ms");
}
flashPacketHandlers.forEach(FlashPacketHandler::unblock); flashPacketHandlers.forEach(FlashPacketHandler::unblock);
}).start(); }).start();
} }
private boolean onSendFirstEncryptedMessage(FlashPacketHandler flashPacketHandler, List<byte[]> potentialRC4tables) { private boolean onSendFirstEncryptedMessage(FlashPacketHandler flashPacketHandler, List<byte[]> potentialRC4tables) {
for (byte[] possible : potentialRC4tables) {
byte[] encBuffer = new byte[flashPacketHandler.getEncryptedBuffer().size()]; for (byte[] possible : potentialRC4tables)
for (int i = 0; i < encBuffer.length; i++) { if (isCorrectRC4Table(flashPacketHandler, possible))
return true;
return false;
}
private boolean isCorrectRC4Table(FlashPacketHandler flashPacketHandler, byte[] possible) {
try {
final byte[] encBuffer = new byte[flashPacketHandler.getEncryptedBuffer().size()];
for (int i = 0; i < encBuffer.length; i++)
encBuffer[i] = flashPacketHandler.getEncryptedBuffer().get(i); encBuffer[i] = flashPacketHandler.getEncryptedBuffer().get(i);
}
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
for (int j = 0; j < 256; j++) { for (int j = 0; j < 256; j++) {
byte[] keycpy = Arrays.copyOf(possible, possible.length);
RC4 rc4Tryout = new RC4(keycpy, i, j);
if (flashPacketHandler.getMessageSide() == HMessage.Direction.TOSERVER) rc4Tryout.undoRc4(encBuffer); final byte[] keycpy = Arrays.copyOf(possible, possible.length);
final RC4 rc4Tryout = new RC4(keycpy, i, j);
if (flashPacketHandler.getMessageSide() == HMessage.Direction.TOSERVER)
rc4Tryout.undoRc4(encBuffer);
if (rc4Tryout.couldBeFresh()) { if (rc4Tryout.couldBeFresh()) {
byte[] encDataCopy = Arrays.copyOf(encBuffer, encBuffer.length);
RC4 rc4TryCopy = rc4Tryout.deepCopy(); final byte[] encDataCopy = Arrays.copyOf(encBuffer, encBuffer.length);
final RC4 rc4TryCopy = rc4Tryout.deepCopy();
try { try {
PayloadBuffer payloadBuffer = new PayloadBuffer(); final PayloadBuffer payloadBuffer = new PayloadBuffer();
byte[] decoded = rc4TryCopy.rc4(encDataCopy); final byte[] decoded = rc4TryCopy.rc4(encDataCopy);
HPacket[] checker = payloadBuffer.pushAndReceive(decoded);
payloadBuffer.pushAndReceive(decoded);
if (payloadBuffer.peak().length == 0) { if (payloadBuffer.peak().length == 0) {
flashPacketHandler.setRc4(rc4Tryout); flashPacketHandler.setRc4(rc4Tryout);
return true; return true;
} }
} catch (Exception e) { } catch (Exception e) {
// e.printStackTrace(); e.printStackTrace();
} }
} }
} }
} }
} catch (Exception e) {
e.printStackTrace();
} }
return false; return false;
} }

View File

@ -46,7 +46,6 @@ public class UiLoggerController implements Initializable {
public CheckMenuItem chkMessageHash; public CheckMenuItem chkMessageHash;
public CheckMenuItem chkMessageId; public CheckMenuItem chkMessageId;
public Label lblPacketInfo; public Label lblPacketInfo;
public CheckMenuItem chkUseNewStructures;
public CheckMenuItem chkAlwaysOnTop; public CheckMenuItem chkAlwaysOnTop;
public CheckMenuItem chkOpenOnConnect; public CheckMenuItem chkOpenOnConnect;
@ -130,7 +129,7 @@ public class UiLoggerController implements Initializable {
public void initialize(URL arg0, ResourceBundle arg1) { public void initialize(URL arg0, ResourceBundle arg1) {
allMenuItems.addAll(Arrays.asList( allMenuItems.addAll(Arrays.asList(
chkViewIncoming, chkViewOutgoing, chkDisplayStructure, chkAutoscroll, chkViewIncoming, chkViewOutgoing, chkDisplayStructure, chkAutoscroll,
chkSkipBigPackets, chkMessageName, chkMessageHash, chkMessageId, chkUseNewStructures, chkSkipBigPackets, chkMessageName, chkMessageHash, chkMessageId,
chkOpenOnConnect, chkResetOnConnect, chkHideOnDisconnect, chkResetOnDisconnect, chkOpenOnConnect, chkResetOnConnect, chkHideOnDisconnect, chkResetOnDisconnect,
chkAntiSpam_none, chkAntiSpam_low, chkAntiSpam_medium, chkAntiSpam_high, chkAntiSpam_ultra, chkAntiSpam_none, chkAntiSpam_low, chkAntiSpam_medium, chkAntiSpam_high, chkAntiSpam_ultra,
chkTimestamp, chkReprHex, chkReprLegacy, chkReprRawHex, chkReprNone chkTimestamp, chkReprHex, chkReprLegacy, chkReprRawHex, chkReprNone
@ -286,7 +285,7 @@ public class UiLoggerController implements Initializable {
if (packet.length() <= 2000) { if (packet.length() <= 2000) {
try { try {
String expr = packet.toExpression(isIncoming ? HMessage.Direction.TOCLIENT : HMessage.Direction.TOSERVER, uiLogger.getPacketInfoManager(), chkUseNewStructures.isSelected()); String expr = packet.toExpression(isIncoming ? HMessage.Direction.TOCLIENT : HMessage.Direction.TOSERVER, uiLogger.getPacketInfoManager(), true);
String cleaned = cleanTextContent(expr); String cleaned = cleanTextContent(expr);
if (cleaned.equals(expr)) { if (cleaned.equals(expr)) {
if (!expr.equals("") && chkDisplayStructure.isSelected()) { if (!expr.equals("") && chkDisplayStructure.isSelected()) {

View File

@ -67,7 +67,6 @@
</items> </items>
</Menu> </Menu>
<CheckMenuItem fx:id="chkDisplayStructure" mnemonicParsing="false" selected="true" text="Structure" /> <CheckMenuItem fx:id="chkDisplayStructure" mnemonicParsing="false" selected="true" text="Structure" />
<CheckMenuItem fx:id="chkUseNewStructures" mnemonicParsing="false" selected="true" text="New structures" />
<CheckMenuItem fx:id="chkTimestamp" mnemonicParsing="false" text="Timestamp" /> <CheckMenuItem fx:id="chkTimestamp" mnemonicParsing="false" text="Timestamp" />
</items> </items>
</Menu> </Menu>