mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-01-18 16:26:26 +01:00
add retro support (long connection time)
This commit is contained in:
parent
1629bf3cfe
commit
5c62c1d188
@ -64,8 +64,13 @@ public class Rc4Obtainer {
|
||||
if (DEBUG) System.out.println("[+] send encrypted");
|
||||
sleep(20);
|
||||
|
||||
while (pingHeader == -1) {
|
||||
int count = 0;
|
||||
while (pingHeader == -1 && count < 500) {
|
||||
sleep(50);
|
||||
count++;
|
||||
}
|
||||
if (count == 500) {
|
||||
System.out.println("are you connected to a retro? trying other things (might take a while)..");
|
||||
}
|
||||
incomingHandler.block();
|
||||
|
||||
@ -88,21 +93,26 @@ public class Rc4Obtainer {
|
||||
if (DEBUG) System.out.println("size: " + getTotalBytesLengthOfDiff(diff));
|
||||
int i = 0;
|
||||
while (getTotalBytesLengthOfDiff(diff) > 2000) {
|
||||
int am = 0;
|
||||
if (i == 0 || i > 1) {
|
||||
am = rand.nextInt(25) + 5;
|
||||
for (int j = 0; j < am; j++) {
|
||||
incomingHandler.sendToStream(new HPacket(pingHeader).toBytes());
|
||||
outgoingHandler.fakePongAlert();
|
||||
sleep(20);
|
||||
if (pingHeader != -1) {
|
||||
int am = 0;
|
||||
if (i == 0 || i > 1) {
|
||||
am = rand.nextInt(25) + 5;
|
||||
for (int j = 0; j < am; j++) {
|
||||
incomingHandler.sendToStream(new HPacket(pingHeader).toBytes());
|
||||
outgoingHandler.fakePongAlert();
|
||||
sleep(20);
|
||||
}
|
||||
}
|
||||
sleep(50);
|
||||
}
|
||||
sleep(50);
|
||||
int rem = addedBytes;
|
||||
if (i == 0) client.pauseProcess();
|
||||
else {
|
||||
while (addedBytes == 0) {
|
||||
sleep(50);
|
||||
}
|
||||
System.out.println("making progress..");
|
||||
}
|
||||
|
||||
diff = searchForPossibleRC4Tables(diff);
|
||||
if (i == 0) client.resumeProcess();
|
||||
if (DEBUG) System.out.println("size: " + getTotalBytesLengthOfDiff(diff) + " with changed bytes: " + rem + " should be: " + am * 6);
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -146,15 +156,33 @@ public class Rc4Obtainer {
|
||||
|
||||
MemorySnippet snippet1 = new MemorySnippet(snippet.getOffset(), new byte[snippet.getData().length]);
|
||||
client.fetchMemory(snippet1);
|
||||
incomingHandler.sendToStream(new HPacket(pingHeader).toBytes());
|
||||
outgoingHandler.fakePongAlert();
|
||||
if (pingHeader != -1) {
|
||||
incomingHandler.sendToStream(new HPacket(pingHeader).toBytes());
|
||||
outgoingHandler.fakePongAlert();
|
||||
}
|
||||
|
||||
sleep(70);
|
||||
|
||||
byte[] lastPongPacket = new byte[6];
|
||||
List<Byte> encodedbytelistraw = outgoingHandler.getEncryptedBuffer();
|
||||
for (int i = 0; i < 6; i++) {
|
||||
lastPongPacket[i] = encodedbytelistraw.get(encodedbytelistraw.size() - 6 + i);
|
||||
byte[] lastOutgoingPacket;
|
||||
if (pingHeader != -1) {
|
||||
lastOutgoingPacket = new byte[6];
|
||||
}
|
||||
else {
|
||||
int size = outgoingHandler.getEncryptedBuffer().size();
|
||||
int copy = size;
|
||||
while (copy == size) {
|
||||
sleep(1);
|
||||
copy = outgoingHandler.getEncryptedBuffer().size();
|
||||
}
|
||||
lastOutgoingPacket = new byte[copy - size];
|
||||
System.out.println("size: " + lastOutgoingPacket.length);
|
||||
}
|
||||
|
||||
for (int i = 0; i < lastOutgoingPacket.length; i++) {
|
||||
List<Byte> encodedbytelistraw = outgoingHandler.getEncryptedBuffer();
|
||||
lastOutgoingPacket[i] = encodedbytelistraw.get(encodedbytelistraw.size() - lastOutgoingPacket.length + i);
|
||||
}
|
||||
|
||||
|
||||
int counter = 0;
|
||||
RC4 result = null;
|
||||
@ -174,7 +202,7 @@ public class Rc4Obtainer {
|
||||
}
|
||||
RC4 rc4Tryout = new RC4(copy, x, y);
|
||||
|
||||
HPacket tryout = new HPacket(rc4Tryout.rc4(lastPongPacket));
|
||||
HPacket tryout = new HPacket(rc4Tryout.rc4(lastOutgoingPacket));
|
||||
if (!tryout.isCorrupted()) {
|
||||
result = rc4Tryout;
|
||||
break outerloop;
|
||||
|
@ -29,29 +29,10 @@ public class Connection extends SubForm {
|
||||
|
||||
public void initialize() {
|
||||
inpPort.getEditor().textProperty().addListener(observable -> {
|
||||
try {
|
||||
int i = Integer.parseInt(inpPort.getEditor().getText());
|
||||
btnConnect.setDisable(i < 0 || i >= 256 * 256);
|
||||
}
|
||||
catch (Exception e) {
|
||||
btnConnect.setDisable(true);
|
||||
}
|
||||
updateInputUI();
|
||||
});
|
||||
cbx_autodetect.selectedProperty().addListener(observable -> {
|
||||
inpPort.setDisable(cbx_autodetect.isSelected());
|
||||
inpHost.setDisable(cbx_autodetect.isSelected());
|
||||
if (cbx_autodetect.isSelected()) {
|
||||
btnConnect.setDisable(false);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
int i = Integer.parseInt(inpPort.getEditor().getText());
|
||||
btnConnect.setDisable(i < 0 || i >= 256 * 256);
|
||||
}
|
||||
catch (Exception e) {
|
||||
btnConnect.setDisable(true);
|
||||
}
|
||||
}
|
||||
updateInputUI();
|
||||
});
|
||||
|
||||
inpPort.getItems().addAll("30000", "38101");
|
||||
@ -61,19 +42,35 @@ public class Connection extends SubForm {
|
||||
inpHost.getSelectionModel().selectFirst();
|
||||
}
|
||||
|
||||
private void updateInputUI() {
|
||||
if (cbx_autodetect.isSelected()) {
|
||||
btnConnect.setDisable(false);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
int i = Integer.parseInt(inpPort.getEditor().getText());
|
||||
btnConnect.setDisable(i < 0 || i >= 256 * 256);
|
||||
}
|
||||
catch (Exception e) {
|
||||
btnConnect.setDisable(true);
|
||||
}
|
||||
}
|
||||
|
||||
inpHost.setDisable(getHConnection().getState() != HConnection.State.NOT_CONNECTED || cbx_autodetect.isSelected());
|
||||
inpPort.setDisable(getHConnection().getState() != HConnection.State.NOT_CONNECTED || cbx_autodetect.isSelected());
|
||||
}
|
||||
|
||||
public void onParentSet(){
|
||||
getHConnection().addStateChangeListener((oldState, newState) -> Platform.runLater(() -> {
|
||||
if (newState == HConnection.State.NOT_CONNECTED) {
|
||||
inpHost.setDisable(false);
|
||||
inpPort.setDisable(false);
|
||||
updateInputUI();
|
||||
lblState.setText("Not connected");
|
||||
btnConnect.setText("Connect");
|
||||
outHost.setText("");
|
||||
outPort.setText("");
|
||||
}
|
||||
else if (oldState == HConnection.State.NOT_CONNECTED) {
|
||||
inpHost.setDisable(true);
|
||||
inpPort.setDisable(true);
|
||||
updateInputUI();
|
||||
btnConnect.setText("Abort");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user