clienttype, correct harble api, 1.3.3

This commit is contained in:
sirjonasxx 2021-03-02 02:17:29 +01:00
parent 96b47481b5
commit ea2bea6990
20 changed files with 47 additions and 32 deletions

View File

@ -13,7 +13,7 @@
<parent>
<groupId>G-Earth</groupId>
<artifactId>G-Earth-Parent</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
<relativePath>../../</relativePath>
</parent>
@ -106,7 +106,7 @@
<dependency>
<groupId>G-Earth</groupId>
<artifactId>G-Earth</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
<!--<scope>provided</scope>-->
</dependency>
</dependencies>

View File

@ -13,7 +13,7 @@
<parent>
<groupId>G-Earth</groupId>
<artifactId>G-Earth-Parent</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
<relativePath>../../</relativePath>
</parent>
@ -106,7 +106,7 @@
<dependency>
<groupId>G-Earth</groupId>
<artifactId>G-Earth</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
<!--<scope>provided</scope>-->
</dependency>
</dependencies>

View File

@ -8,7 +8,7 @@
<packaging>jar</packaging>
<version>1.3.2</version>
<version>1.3.3</version>
<properties>
<javafx.version>1.8</javafx.version>
@ -18,7 +18,7 @@
<parent>
<groupId>G-Earth</groupId>
<artifactId>G-Earth-Parent</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
</parent>
<build>

View File

@ -28,7 +28,7 @@ import java.util.Set;
public class Main extends Application {
public static Application main;
public static String version = "1.3.2";
public static String version = "1.3.3";
private static String gitApi = "https://api.github.com/repos/sirjonasxx/G-Earth/releases/latest";
@Override

View File

@ -3,6 +3,7 @@ package gearth.extensions;
import gearth.misc.listenerpattern.Observable;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
import gearth.services.Constants;
import gearth.services.extensionhandler.extensions.implementations.network.NetworkExtensionInfo;
import java.io.*;
@ -140,7 +141,9 @@ public abstract class Extension implements IExtension {
int connectionPort = packet.readInteger();
String hotelVersion = packet.readString();
String harbleMessagesPath = packet.readString();
onConnectionObservable.fireEvent(l -> l.onConnection(host, connectionPort, hotelVersion, harbleMessagesPath));
String clientType = packet.readString();
Constants.UNITY_PACKETS = clientType.toLowerCase().contains("unity");
onConnectionObservable.fireEvent(l -> l.onConnection(host, connectionPort, hotelVersion, clientType, harbleMessagesPath));
onStartConnection();
}
else if (packet.headerId() == NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.CONNECTIONEND) {

View File

@ -1,5 +1,5 @@
package gearth.extensions;
public interface OnConnectionListener {
void onConnection(String host, int port, String hotelversion, String harbleMessagesPath);
void onConnection(String host, int port, String hotelversion, String clientType, String harbleMessagesPath);
}

View File

@ -42,7 +42,7 @@ public class ChatConsole {
this.infoMessage = infoMessage;
final boolean[] doOncePerConnection = {false};
extension.onConnect((s, i, s1, h1) -> doOncePerConnection[0] = true);
extension.onConnect((s, i, s1, ct, h1) -> doOncePerConnection[0] = true);
extension.intercept(HMessage.Direction.TOSERVER, hMessage -> {
// if the first packet on init is not 4000, the extension was already running, so we open the chat instantly

View File

@ -29,7 +29,7 @@ public class HashSupport {
public HashSupport(IExtension extension) {
this.extension = extension;
extension.onConnect((host, port, hotelversion, cachePath) -> {
extension.onConnect((host, port, hotelversion, clientType, cachePath) -> {
// synchronized (lock) {
harbleAPI = new HarbleAPI(new File(cachePath));
// }

View File

@ -38,9 +38,9 @@ public class HarbleAPIFetcher {
//latest fetched
public static HarbleAPI HARBLEAPI = null;
public synchronized static void fetch(String hotelversion) {
public synchronized static void fetch(String hotelversion, String clientType) {
// if unity
if (!(hotelversion.toLowerCase().contains("production") || hotelversion.toLowerCase().contains("release"))) {
if (clientType.toLowerCase().contains("unity")) {
try {
HARBLEAPI = new HarbleAPI(
new File(new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI())
@ -77,12 +77,4 @@ public class HarbleAPIFetcher {
}
}
public static void main(String[] args) {
fetch("PRODUCTION-201901141210-114421986");
HarbleAPI api = HARBLEAPI;
HarbleAPI.HarbleMessage haMessage = api.getHarbleMessageFromHeaderId(HMessage.Direction.TOSERVER, 525);
System.out.println(haMessage);
}
}

View File

@ -172,6 +172,13 @@ public class HConnection {
return proxy.getHotelVersion();
}
public String getClientType() {
if (proxy == null) {
return "";
}
return proxy.getClientType();
}
public boolean isRawIpMode() {
return proxyProvider != null && proxyProvider instanceof LinuxRawIpFlashProxyProvider;
// WindowsRawIpProxyProvider extends LinuxRawIpProxyProvider

View File

@ -21,6 +21,7 @@ public class HProxy {
private volatile PacketHandler outHandler = null; //connection with server (only initialized when verified habbo connection)
private volatile String hotelVersion = "";
private volatile String clientType = "";
private volatile AsyncPacketSender asyncPacketSender = null;
public HProxy(HClient hClient, String input_domain, String actual_domain, int actual_port, int intercept_port, String intercept_host) {
@ -36,13 +37,18 @@ public class HProxy {
this.proxy_server = socket;
}
public void verifyProxy(PacketHandler incomingHandler, PacketHandler outgoingHandler, String hotelVersion) {
public void verifyProxy(PacketHandler incomingHandler, PacketHandler outgoingHandler, String hotelVersion, String clientType) {
this.inHandler = incomingHandler;
this.outHandler = outgoingHandler;
this.hotelVersion = hotelVersion;
this.clientType = clientType;
this.asyncPacketSender = new AsyncPacketSender(this);
}
public String getClientType() {
return clientType;
}
public int getActual_port() {
return actual_port;
}

View File

@ -51,9 +51,9 @@ public abstract class FlashProxyProvider implements ProxyProvider {
Semaphore abort = new Semaphore(0);
outgoingHandler.addOnDatastreamConfirmedListener(hotelVersion -> {
outgoingHandler.addOnDatastreamConfirmedListener((hotelVersion, clientType) -> {
incomingHandler.setAsDataStream();
proxy.verifyProxy(incomingHandler, outgoingHandler, hotelVersion);
proxy.verifyProxy(incomingHandler, outgoingHandler, hotelVersion, clientType);
proxySetter.setProxy(proxy);
datastream[0] = true;
abortSemaphore = abort;

View File

@ -58,10 +58,13 @@ public class UnityCommunicator {
HPacket maybe = new HPacket(packet);
if (maybe.getBytesLength() > 6 && maybe.headerId() == 4000) {
hProxy = new HProxy(HClient.UNITY, "", "", -1, -1, "");
String ignore = maybe.readString();
String clientType = maybe.readString();
hProxy.verifyProxy(
new UnityPacketHandler(hConnection.getExtensionHandler(), hConnection.getTrafficObservables(), session, HMessage.Direction.TOCLIENT),
new UnityPacketHandler(hConnection.getExtensionHandler(), hConnection.getTrafficObservables(), session, HMessage.Direction.TOSERVER),
revision
revision,
clientType
);
proxySetter.setProxy(hProxy);
stateSetter.setState(HState.CONNECTED);

View File

@ -2,6 +2,6 @@ package gearth.protocol.packethandler.flash;
public interface OnDatastreamConfirmedListener {
void confirm(String hotelVersion);
void confirm(String hotelVersion, String clientType);
}

View File

@ -27,7 +27,8 @@ public class OutgoingFlashPacketHandler extends FlashPacketHandler {
isDataStream = (hpacket.getBytesLength() > 6 && hpacket.length() < 100);
if (isDataStream) {
String version = hpacket.readString();
datastreamConfirmedObservable.fireEvent(l -> l.confirm(version));
String clientType = hpacket.readString();
datastreamConfirmedObservable.fireEvent(l -> l.confirm(version, clientType));
}
}
}

View File

@ -48,13 +48,14 @@ public class ExtensionHandler {
hConnection.getStateObservable().addListener((oldState, newState) -> {
if (newState == HState.CONNECTED) {
HarbleAPIFetcher.fetch(hConnection.getHotelVersion());
HarbleAPIFetcher.fetch(hConnection.getHotelVersion(), hConnection.getClientType());
synchronized (gEarthExtensions) {
for (GEarthExtension extension : gEarthExtensions) {
extension.connectionStart(
hConnection.getDomain(),
hConnection.getServerPort(),
hConnection.getHotelVersion(),
hConnection.getClientType(),
HarbleAPIFetcher.HARBLEAPI == null ? "null" : HarbleAPIFetcher.HARBLEAPI.getPath()
);
}
@ -243,6 +244,7 @@ public class ExtensionHandler {
hConnection.getDomain(),
hConnection.getServerPort(),
hConnection.getHotelVersion(),
hConnection.getClientType(),
HarbleAPIFetcher.HARBLEAPI == null ? "null" : HarbleAPIFetcher.HARBLEAPI.getPath()
);
}

View File

@ -38,7 +38,7 @@ public abstract class GEarthExtension {
public abstract void doubleclick();
public abstract void packetIntercept(HMessage hMessage);
public abstract void provideFlags(String[] flags);
public abstract void connectionStart(String host, int port, String hotelVersion, String harbleMessagesPath);
public abstract void connectionStart(String host, int port, String hotelVersion, String clientType, String harbleMessagesPath);
public abstract void connectionEnd();
public abstract void init();
public abstract void close();

View File

@ -190,13 +190,14 @@ public class NetworkExtension extends GEarthExtension {
}
@Override
public void connectionStart(String host, int port, String hotelVersion, String harbleMessagesPath) {
public void connectionStart(String host, int port, String hotelVersion, String clientType, String harbleMessagesPath) {
sendMessage(
new HPacket(NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.CONNECTIONSTART)
.appendString(host)
.appendInt(port)
.appendString(hotelVersion)
.appendString(harbleMessagesPath)
.appendString(clientType)
);
}

View File

@ -83,7 +83,7 @@ public class ExampleExtension extends GEarthExtension {
}
@Override
public void connectionStart(String host, int port, String hotelVersion, String harbleMessagesPath) {
public void connectionStart(String host, int port, String hotelVersion, String clientType, String harbleMessagesPath) {
// a new habbo client has connected
System.out.println("Connected to " + host);
}

View File

@ -7,7 +7,7 @@
<groupId>G-Earth</groupId>
<artifactId>G-Earth-Parent</artifactId>
<packaging>pom</packaging>
<version>1.3.2</version>
<version>1.3.3</version>
<name>G-Earth-Parent</name>
<url>https://github.com/sirjonasxx/G-Earth</url>