advanced; option to disable decryption

This commit is contained in:
sirjonasxx 2019-01-30 00:48:57 +01:00
parent 716a6545e9
commit c6cb928837
5 changed files with 33 additions and 6 deletions

View File

@ -101,6 +101,7 @@ public class HConnection {
} }
public static boolean DECRYPTPACKETS = true;
public static boolean DEBUG = false; public static boolean DEBUG = false;
private static final HostReplacer hostsReplacer = HostReplacerFactory.get(); private static final HostReplacer hostsReplacer = HostReplacerFactory.get();

View File

@ -50,6 +50,8 @@ public class Rc4Obtainer {
private void onSendFirstEncryptedMessage(Handler handler) { private void onSendFirstEncryptedMessage(Handler handler) {
if (!HConnection.DECRYPTPACKETS) return;
outgoingHandler.block(); outgoingHandler.block();
incomingHandler.block(); incomingHandler.block();

View File

@ -1,5 +1,6 @@
package gearth.protocol.packethandler; package gearth.protocol.packethandler;
import gearth.protocol.HConnection;
import gearth.protocol.HMessage; import gearth.protocol.HMessage;
import gearth.protocol.HPacket; import gearth.protocol.HPacket;
import gearth.protocol.TrafficListener; import gearth.protocol.TrafficListener;
@ -51,6 +52,11 @@ public abstract class Handler {
if (!isEncryptedStream) { if (!isEncryptedStream) {
payloadBuffer.push(buffer); payloadBuffer.push(buffer);
} }
else if (!HConnection.DECRYPTPACKETS) {
synchronized (lock) {
out.write(buffer);
}
}
else if (decryptcipher == null) { else if (decryptcipher == null) {
for (int i = 0; i < buffer.length; i++) { for (int i = 0; i < buffer.length; i++) {
tempEncryptedBuffer.add(buffer[i]); tempEncryptedBuffer.add(buffer[i]);

View File

@ -7,6 +7,7 @@ import gearth.ui.info.Info;
import javafx.beans.InvalidationListener; import javafx.beans.InvalidationListener;
import javafx.beans.Observable; import javafx.beans.Observable;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.layout.GridPane;
/** /**
* Created by Jonas on 06/04/18. * Created by Jonas on 06/04/18.
@ -21,8 +22,11 @@ public class Extra extends SubForm {
public Hyperlink url_troubleshooting; public Hyperlink url_troubleshooting;
public CheckBox cbx_advanced; public CheckBox cbx_advanced;
public GridPane grd_advanced;
public CheckBox cbx_ovcinfo; public CheckBox cbx_ovcinfo;
public GridPane grd_ovcinfo;
public TextField txt_realPort; public TextField txt_realPort;
public TextField txt_mitmIP; public TextField txt_mitmIP;
public TextField txt_realIp; public TextField txt_realIp;
@ -41,6 +45,9 @@ public class Extra extends SubForm {
} }
cbx_debug.selectedProperty().addListener(observable -> HConnection.DEBUG = cbx_debug.isSelected()); 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 @Override
@ -54,6 +61,8 @@ public class Extra extends SubForm {
updateAdvancedUI(); updateAdvancedUI();
} }
}); });
updateAdvancedUI();
} }
@Override @Override
@ -62,6 +71,15 @@ public class Extra extends SubForm {
} }
private void updateAdvancedUI() { 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);
} }
} }

View File

@ -37,7 +37,7 @@
<RowConstraints maxHeight="235.0" minHeight="10.0" prefHeight="232.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="235.0" minHeight="10.0" prefHeight="232.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<GridPane disable="true" style="-fx-border-color: #888888; -fx-border-radius: 5px;" GridPane.rowIndex="1"> <GridPane fx:id="grd_advanced" disable="true" style="-fx-border-color: #888888; -fx-border-radius: 5px;" GridPane.rowIndex="1">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints> </columnConstraints>
@ -55,7 +55,7 @@
</padding> </padding>
<children> <children>
<CheckBox fx:id="cbx_ovcinfo" mnemonicParsing="false" text="Override connection info:" /> <CheckBox fx:id="cbx_ovcinfo" mnemonicParsing="false" text="Override connection info:" />
<GridPane prefHeight="119.0" prefWidth="259.0" GridPane.rowIndex="1"> <GridPane fx:id="grd_ovcinfo" disable="true" prefHeight="119.0" prefWidth="259.0" GridPane.rowIndex="1">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="159.0" minWidth="10.0" prefWidth="68.0" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="159.0" minWidth="10.0" prefWidth="68.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="193.0" minWidth="10.0" prefWidth="145.0" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="193.0" minWidth="10.0" prefWidth="145.0" />
@ -71,7 +71,7 @@
<Label text="MITM IP:" GridPane.rowIndex="1" /> <Label text="MITM IP:" GridPane.rowIndex="1" />
<Label text="Real port:" GridPane.rowIndex="2" /> <Label text="Real port:" GridPane.rowIndex="2" />
<Label text="MITM port:" GridPane.rowIndex="3" /> <Label text="MITM port:" GridPane.rowIndex="3" />
<TextField fx:id="txt_realPort" disable="true" editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.columnIndex="1" GridPane.rowIndex="2"> <TextField fx:id="txt_realPort" editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.columnIndex="1" GridPane.rowIndex="2">
<opaqueInsets> <opaqueInsets>
<Insets /> <Insets />
</opaqueInsets> </opaqueInsets>
@ -79,7 +79,7 @@
<Insets bottom="3.0" right="7.0" top="3.0" /> <Insets bottom="3.0" right="7.0" top="3.0" />
</GridPane.margin> </GridPane.margin>
</TextField> </TextField>
<TextField fx:id="txt_mitmIP" disable="true" editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.columnIndex="1" GridPane.rowIndex="1"> <TextField fx:id="txt_mitmIP" editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.columnIndex="1" GridPane.rowIndex="1">
<opaqueInsets> <opaqueInsets>
<Insets /> <Insets />
</opaqueInsets> </opaqueInsets>
@ -87,7 +87,7 @@
<Insets bottom="3.0" right="7.0" top="3.0" /> <Insets bottom="3.0" right="7.0" top="3.0" />
</GridPane.margin> </GridPane.margin>
</TextField> </TextField>
<TextField fx:id="txt_realIp" disable="true" editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.columnIndex="1"> <TextField fx:id="txt_realIp" editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.columnIndex="1">
<opaqueInsets> <opaqueInsets>
<Insets /> <Insets />
</opaqueInsets> </opaqueInsets>
@ -95,7 +95,7 @@
<Insets bottom="3.0" right="7.0" top="3.0" /> <Insets bottom="3.0" right="7.0" top="3.0" />
</GridPane.margin> </GridPane.margin>
</TextField> </TextField>
<TextField fx:id="txt_mitmPort" disable="true" editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.columnIndex="1" GridPane.rowIndex="3"> <TextField fx:id="txt_mitmPort" editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.columnIndex="1" GridPane.rowIndex="3">
<opaqueInsets> <opaqueInsets>
<Insets /> <Insets />
</opaqueInsets> </opaqueInsets>