From c6cb928837ddfe9f9c8375513b404e86a6c7748d Mon Sep 17 00:00:00 2001
From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com>
Date: Wed, 30 Jan 2019 00:48:57 +0100
Subject: [PATCH] advanced; option to disable decryption
---
.../main/java/gearth/protocol/HConnection.java | 1 +
.../gearth/protocol/memory/Rc4Obtainer.java | 2 ++
.../gearth/protocol/packethandler/Handler.java | 6 ++++++
.../src/main/java/gearth/ui/extra/Extra.java | 18 ++++++++++++++++++
.../main/resources/gearth/ui/extra/Extra.fxml | 12 ++++++------
5 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/G-Earth/src/main/java/gearth/protocol/HConnection.java b/G-Earth/src/main/java/gearth/protocol/HConnection.java
index e5fa2de..aef5b3d 100644
--- a/G-Earth/src/main/java/gearth/protocol/HConnection.java
+++ b/G-Earth/src/main/java/gearth/protocol/HConnection.java
@@ -101,6 +101,7 @@ public class HConnection {
}
+ public static boolean DECRYPTPACKETS = true;
public static boolean DEBUG = false;
private static final HostReplacer hostsReplacer = HostReplacerFactory.get();
diff --git a/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java b/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java
index b74d227..35e9bb9 100644
--- a/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java
+++ b/G-Earth/src/main/java/gearth/protocol/memory/Rc4Obtainer.java
@@ -50,6 +50,8 @@ public class Rc4Obtainer {
private void onSendFirstEncryptedMessage(Handler handler) {
+ if (!HConnection.DECRYPTPACKETS) return;
+
outgoingHandler.block();
incomingHandler.block();
diff --git a/G-Earth/src/main/java/gearth/protocol/packethandler/Handler.java b/G-Earth/src/main/java/gearth/protocol/packethandler/Handler.java
index 7afa84f..1d7888e 100644
--- a/G-Earth/src/main/java/gearth/protocol/packethandler/Handler.java
+++ b/G-Earth/src/main/java/gearth/protocol/packethandler/Handler.java
@@ -1,5 +1,6 @@
package gearth.protocol.packethandler;
+import gearth.protocol.HConnection;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
import gearth.protocol.TrafficListener;
@@ -51,6 +52,11 @@ public abstract class Handler {
if (!isEncryptedStream) {
payloadBuffer.push(buffer);
}
+ else if (!HConnection.DECRYPTPACKETS) {
+ synchronized (lock) {
+ out.write(buffer);
+ }
+ }
else if (decryptcipher == null) {
for (int i = 0; i < buffer.length; i++) {
tempEncryptedBuffer.add(buffer[i]);
diff --git a/G-Earth/src/main/java/gearth/ui/extra/Extra.java b/G-Earth/src/main/java/gearth/ui/extra/Extra.java
index 3e652a2..90e9b60 100644
--- a/G-Earth/src/main/java/gearth/ui/extra/Extra.java
+++ b/G-Earth/src/main/java/gearth/ui/extra/Extra.java
@@ -7,6 +7,7 @@ import gearth.ui.info.Info;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.scene.control.*;
+import javafx.scene.layout.GridPane;
/**
* Created by Jonas on 06/04/18.
@@ -21,8 +22,11 @@ public class Extra extends SubForm {
public Hyperlink url_troubleshooting;
public CheckBox cbx_advanced;
+ public GridPane grd_advanced;
public CheckBox cbx_ovcinfo;
+ public GridPane grd_ovcinfo;
+
public TextField txt_realPort;
public TextField txt_mitmIP;
public TextField txt_realIp;
@@ -41,6 +45,9 @@ public class Extra extends SubForm {
}
cbx_debug.selectedProperty().addListener(observable -> HConnection.DEBUG = cbx_debug.isSelected());
+ cbx_disableDecryption.selectedProperty().addListener(observable -> HConnection.DECRYPTPACKETS = !cbx_disableDecryption.isSelected());
+
+ cbx_ovcinfo.selectedProperty().addListener(observable -> grd_ovcinfo.setDisable(!cbx_ovcinfo.isSelected()));
}
@Override
@@ -54,6 +61,8 @@ public class Extra extends SubForm {
updateAdvancedUI();
}
});
+
+ updateAdvancedUI();
}
@Override
@@ -62,6 +71,15 @@ public class Extra extends SubForm {
}
private void updateAdvancedUI() {
+ if (!cbx_advanced.isSelected()) {
+ cbx_debug.setSelected(false);
+ cbx_ovcinfo.setSelected(false);
+ if (getHConnection().getState() == HConnection.State.NOT_CONNECTED) {
+ cbx_disableDecryption.setSelected(false);
+ }
+ }
+ grd_advanced.setDisable(!cbx_advanced.isSelected());
+ cbx_disableDecryption.setDisable(getHConnection().getState() != HConnection.State.NOT_CONNECTED);
}
}
diff --git a/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml b/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml
index 0184114..25bb03f 100644
--- a/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml
+++ b/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml
@@ -37,7 +37,7 @@
-
+
@@ -55,7 +55,7 @@
-
+
@@ -71,7 +71,7 @@
-
+
@@ -79,7 +79,7 @@
-
+
@@ -87,7 +87,7 @@
-
+
@@ -95,7 +95,7 @@
-
+