diff --git a/G-Earth/src/main/java/gearth/encoding/Base64Encoding.java b/G-Earth/src/main/java/gearth/encoding/Base64Encoding.java
new file mode 100644
index 0000000..ba1812e
--- /dev/null
+++ b/G-Earth/src/main/java/gearth/encoding/Base64Encoding.java
@@ -0,0 +1,38 @@
+package gearth.encoding;
+
+/**
+ * Kepler Copyright (C) 2018 Quackster
+ * Kepler
+ */
+public class Base64Encoding {
+ public byte NEGATIVE = 64;
+ public byte POSITIVE = 65;
+
+ public static byte[] encode(int i, int numBytes) {
+ byte[] bzRes = new byte[numBytes];
+ for (int j = 1; j <= numBytes; j++)
+ {
+ int k = ((numBytes - j) * 6);
+ bzRes[j - 1] = (byte)(0x40 + ((i >> k) & 0x3f));
+ }
+
+ return bzRes;
+ }
+
+ public static int decode(byte[] bzData) {
+ int i = 0;
+ int j = 0;
+ for (int k = bzData.length - 1; k >= 0; k--)
+ {
+ int x = bzData[k] - 0x40;
+ if (j > 0)
+ x *= (int)Math.pow(64.0, (double)j);
+
+ i += x;
+ j++;
+ }
+
+ return i;
+ }
+}
+
diff --git a/G-Earth/src/main/java/gearth/encoding/VL64Encoding.java b/G-Earth/src/main/java/gearth/encoding/VL64Encoding.java
new file mode 100644
index 0000000..33d6415
--- /dev/null
+++ b/G-Earth/src/main/java/gearth/encoding/VL64Encoding.java
@@ -0,0 +1,63 @@
+package gearth.encoding;
+
+/**
+ * Kepler Copyright (C) 2018 Quackster
+ * Kepler
+ */
+public class VL64Encoding {
+ public static byte NEGATIVE = 72;
+ public static byte POSITIVE = 73;
+ public static int MAX_INTEGER_BYTE_AMOUNT = 6;
+
+ public static byte[] encode(int i) {
+ byte[] wf = new byte[VL64Encoding.MAX_INTEGER_BYTE_AMOUNT];
+
+ int pos = 0;
+ int numBytes = 1;
+ int startPos = pos;
+ int negativeMask = i >= 0 ? 0 : 4;
+
+ i = Math.abs(i);
+
+ wf[pos++] = (byte)(64 + (i & 3));
+
+ for (i >>= 2; i != 0; i >>= VL64Encoding.MAX_INTEGER_BYTE_AMOUNT)
+ {
+ numBytes++;
+ wf[pos++] = (byte)(64 + (i & 0x3f));
+ }
+ wf[startPos] = (byte)(wf[startPos] | numBytes << 3 | negativeMask);
+
+ byte[] bzData = new byte[numBytes];
+
+ System.arraycopy(wf, 0, bzData, 0, numBytes);
+ return bzData;
+ }
+
+ public static int decode(byte[] bzData) {
+ int pos = 0;
+ int v = 0;
+
+ boolean negative = (bzData[pos] & 4) == 4;
+ int totalBytes = bzData[pos] >> 3 & 7;
+
+ v = bzData[pos] & 3;
+
+ pos++;
+
+ int shiftAmount = 2;
+
+ for (int b = 1; b < totalBytes; b++)
+ {
+ v |= (bzData[pos] & 0x3f) << shiftAmount;
+ shiftAmount = 2 + 6 * b;
+ pos++;
+ }
+
+ if (negative) {
+ v *= -1;
+ }
+
+ return v;
+ }
+}
diff --git a/G-Earth/src/main/java/gearth/protocol/HConnection.java b/G-Earth/src/main/java/gearth/protocol/HConnection.java
index 495481f..fc544f5 100644
--- a/G-Earth/src/main/java/gearth/protocol/HConnection.java
+++ b/G-Earth/src/main/java/gearth/protocol/HConnection.java
@@ -20,7 +20,7 @@ import java.util.function.Consumer;
public class HConnection {
public static volatile boolean DECRYPTPACKETS = true;
- public static volatile boolean DEBUG = false;
+ public static volatile boolean DEBUG = true;
private volatile ExtensionHandler extensionHandler = null;
@@ -60,14 +60,14 @@ public class HConnection {
}
// autodetect mode
- public void start() {
- proxyProvider = proxyProviderFactory.provide();
+ public void start(HClient client) {
+ proxyProvider = proxyProviderFactory.provide(client);
startMITM();
}
// manual input mode
- public void start(String host, int port) {
- proxyProvider = proxyProviderFactory.provide(host, port);
+ public void start(HClient client, String host, int port) {
+ proxyProvider = proxyProviderFactory.provide(client, host, port);
startMITM();
}
diff --git a/G-Earth/src/main/java/gearth/protocol/TrafficListener.java b/G-Earth/src/main/java/gearth/protocol/TrafficListener.java
index da5a11c..f660f8f 100644
--- a/G-Earth/src/main/java/gearth/protocol/TrafficListener.java
+++ b/G-Earth/src/main/java/gearth/protocol/TrafficListener.java
@@ -1,7 +1,11 @@
package gearth.protocol;
+import gearth.protocol.format.shockwave.ShockMessage;
+
public interface TrafficListener {
void onCapture(HMessage message);
+ void onCapture(ShockMessage message);
+
}
diff --git a/G-Earth/src/main/java/gearth/protocol/connection/HClient.java b/G-Earth/src/main/java/gearth/protocol/connection/HClient.java
index 027fafd..540ebfa 100644
--- a/G-Earth/src/main/java/gearth/protocol/connection/HClient.java
+++ b/G-Earth/src/main/java/gearth/protocol/connection/HClient.java
@@ -3,5 +3,6 @@ package gearth.protocol.connection;
public enum HClient {
UNITY,
FLASH,
- NITRO
+ NITRO,
+ SHOCKWAVE
}
diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java
index acd04a7..21f3065 100644
--- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java
+++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/ProxyProviderFactory.java
@@ -3,20 +3,20 @@ package gearth.protocol.connection.proxy;
import gearth.misc.Cacher;
import gearth.misc.OSValidator;
import gearth.protocol.HConnection;
+import gearth.protocol.connection.HClient;
import gearth.protocol.connection.HProxySetter;
import gearth.protocol.connection.HStateSetter;
-import gearth.protocol.connection.proxy.flash.NormalFlashProxyProvider;
+import gearth.protocol.connection.proxy.flash.FlashProxy;
import gearth.protocol.connection.proxy.flash.unix.LinuxRawIpFlashProxyProvider;
import gearth.protocol.connection.proxy.flash.windows.WindowsRawIpFlashProxyProvider;
+import gearth.protocol.connection.proxy.shockwave.ShockwaveProxy;
import gearth.ui.titlebar.TitleBarController;
import gearth.ui.translations.LanguageBundle;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
-import javafx.scene.image.Image;
import javafx.scene.layout.Region;
-import javafx.stage.Stage;
import java.io.IOException;
import java.util.ArrayList;
@@ -41,6 +41,8 @@ public class ProxyProviderFactory {
autoDetectHosts.add("game-us.habbo.com:30000");
autoDetectHosts.add("game-s2.habbo.com:30000");
+ autoDetectHosts.add("game-ous.habbo.com:40001");
+
List