mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-02-20 13:02:36 +01:00
add something
This commit is contained in:
parent
33f5bfb8de
commit
964813dfe7
@ -1,10 +1,10 @@
|
||||
package gearth.protocol;
|
||||
|
||||
import gearth.misc.listenerpattern.Observable;
|
||||
import gearth.protocol.connection.HClient;
|
||||
import gearth.protocol.connection.HProxy;
|
||||
import gearth.protocol.connection.HState;
|
||||
import gearth.protocol.connection.proxy.ProxyProvider;
|
||||
import gearth.protocol.connection.proxy.flash.FlashProxyProvider;
|
||||
import gearth.protocol.connection.proxy.ProxyProviderFactory;
|
||||
import gearth.protocol.connection.proxy.flash.unix.LinuxRawIpFlashProxyProvider;
|
||||
import gearth.protocol.connection.proxy.unity.UnityProxyProvider;
|
||||
@ -172,11 +172,18 @@ public class HConnection {
|
||||
return proxy.getHotelVersion();
|
||||
}
|
||||
|
||||
public String getClientType() {
|
||||
public String getClientIdentifier() {
|
||||
if (proxy == null) {
|
||||
return "";
|
||||
}
|
||||
return proxy.getClientType();
|
||||
return proxy.getClientIdentifier();
|
||||
}
|
||||
|
||||
public HClient getClientType() {
|
||||
if (proxy == null) {
|
||||
return null;
|
||||
}
|
||||
return proxy.gethClient();
|
||||
}
|
||||
|
||||
public boolean isRawIpMode() {
|
||||
|
@ -21,7 +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 String clientIdentifier = "";
|
||||
private volatile AsyncPacketSender asyncPacketSender = null;
|
||||
|
||||
public HProxy(HClient hClient, String input_domain, String actual_domain, int actual_port, int intercept_port, String intercept_host) {
|
||||
@ -37,16 +37,16 @@ public class HProxy {
|
||||
this.proxy_server = socket;
|
||||
}
|
||||
|
||||
public void verifyProxy(PacketHandler incomingHandler, PacketHandler outgoingHandler, String hotelVersion, String clientType) {
|
||||
public void verifyProxy(PacketHandler incomingHandler, PacketHandler outgoingHandler, String hotelVersion, String clientIdentifier) {
|
||||
this.inHandler = incomingHandler;
|
||||
this.outHandler = outgoingHandler;
|
||||
this.hotelVersion = hotelVersion;
|
||||
this.clientType = clientType;
|
||||
this.clientIdentifier = clientIdentifier;
|
||||
this.asyncPacketSender = new AsyncPacketSender(this);
|
||||
}
|
||||
|
||||
public String getClientType() {
|
||||
return clientType;
|
||||
public String getClientIdentifier() {
|
||||
return clientIdentifier;
|
||||
}
|
||||
|
||||
public int getActual_port() {
|
||||
|
@ -51,9 +51,9 @@ public abstract class FlashProxyProvider implements ProxyProvider {
|
||||
|
||||
Semaphore abort = new Semaphore(0);
|
||||
|
||||
outgoingHandler.addOnDatastreamConfirmedListener((hotelVersion, clientType) -> {
|
||||
outgoingHandler.addOnDatastreamConfirmedListener((hotelVersion, clientIdentifier) -> {
|
||||
incomingHandler.setAsDataStream();
|
||||
proxy.verifyProxy(incomingHandler, outgoingHandler, hotelVersion, clientType);
|
||||
proxy.verifyProxy(incomingHandler, outgoingHandler, hotelVersion, clientIdentifier);
|
||||
proxySetter.setProxy(proxy);
|
||||
datastream[0] = true;
|
||||
abortSemaphore = abort;
|
||||
|
@ -59,12 +59,12 @@ public class UnityCommunicator {
|
||||
if (maybe.getBytesLength() > 6 && maybe.headerId() == 4000) {
|
||||
hProxy = new HProxy(HClient.UNITY, "", "", -1, -1, "");
|
||||
String ignore = maybe.readString();
|
||||
String clientType = maybe.readString();
|
||||
String clientIdentifier = 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,
|
||||
clientType
|
||||
clientIdentifier
|
||||
);
|
||||
proxySetter.setProxy(hProxy);
|
||||
stateSetter.setState(HState.CONNECTED);
|
||||
|
@ -2,6 +2,6 @@ package gearth.protocol.packethandler.flash;
|
||||
|
||||
public interface OnDatastreamConfirmedListener {
|
||||
|
||||
void confirm(String hotelVersion, String clientType);
|
||||
void confirm(String hotelVersion, String clientIdentifier);
|
||||
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ public class OutgoingFlashPacketHandler extends FlashPacketHandler {
|
||||
HPacket hpacket = new HPacket(buffer);
|
||||
isDataStream = (hpacket.getBytesLength() > 6 && hpacket.length() < 100);
|
||||
if (isDataStream) {
|
||||
String version = hpacket.readString();
|
||||
String clientType = hpacket.readString();
|
||||
datastreamConfirmedObservable.fireEvent(l -> l.confirm(version, clientType));
|
||||
String hotelVersion = hpacket.readString();
|
||||
String clientIdentifier = hpacket.readString();
|
||||
datastreamConfirmedObservable.fireEvent(l -> l.confirm(hotelVersion, clientIdentifier));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,13 +48,14 @@ public class ExtensionHandler {
|
||||
|
||||
hConnection.getStateObservable().addListener((oldState, newState) -> {
|
||||
if (newState == HState.CONNECTED) {
|
||||
HarbleAPIFetcher.fetch(hConnection.getHotelVersion(), hConnection.getClientType());
|
||||
HarbleAPIFetcher.fetch(hConnection.getHotelVersion(), hConnection.getClientIdentifier());
|
||||
synchronized (gEarthExtensions) {
|
||||
for (GEarthExtension extension : gEarthExtensions) {
|
||||
extension.connectionStart(
|
||||
hConnection.getDomain(),
|
||||
hConnection.getServerPort(),
|
||||
hConnection.getHotelVersion(),
|
||||
hConnection.getClientIdentifier(),
|
||||
hConnection.getClientType(),
|
||||
HarbleAPIFetcher.HARBLEAPI == null ? "null" : HarbleAPIFetcher.HARBLEAPI.getPath()
|
||||
);
|
||||
@ -244,6 +245,7 @@ public class ExtensionHandler {
|
||||
hConnection.getDomain(),
|
||||
hConnection.getServerPort(),
|
||||
hConnection.getHotelVersion(),
|
||||
hConnection.getClientIdentifier(),
|
||||
hConnection.getClientType(),
|
||||
HarbleAPIFetcher.HARBLEAPI == null ? "null" : HarbleAPIFetcher.HARBLEAPI.getPath()
|
||||
);
|
||||
|
@ -4,6 +4,7 @@ import gearth.misc.listenerpattern.Observable;
|
||||
import gearth.misc.listenerpattern.SynchronizedObservable;
|
||||
import gearth.protocol.HMessage;
|
||||
import gearth.protocol.HPacket;
|
||||
import gearth.protocol.connection.HClient;
|
||||
import gearth.services.extensionhandler.extensions.listeners.OmRemoveClickListener;
|
||||
import gearth.services.extensionhandler.extensions.listeners.OnClickListener;
|
||||
import gearth.services.extensionhandler.extensions.listeners.OnDeleteListener;
|
||||
@ -38,7 +39,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 clientType, String harbleMessagesPath);
|
||||
public abstract void connectionStart(String host, int port, String hotelVersion, String clientIdentifier, HClient clientType, String harbleMessagesPath);
|
||||
public abstract void connectionEnd();
|
||||
public abstract void init();
|
||||
public abstract void close();
|
||||
|
@ -1,6 +1,7 @@
|
||||
package gearth.services.extensionhandler.extensions.implementations.network;
|
||||
|
||||
import gearth.protocol.HMessage;
|
||||
import gearth.protocol.connection.HClient;
|
||||
import gearth.services.extensionhandler.extensions.GEarthExtension;
|
||||
import gearth.protocol.HPacket;
|
||||
|
||||
@ -190,14 +191,15 @@ public class NetworkExtension extends GEarthExtension {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionStart(String host, int port, String hotelVersion, String clientType, String harbleMessagesPath) {
|
||||
public void connectionStart(String host, int port, String hotelVersion, String clientIdentifier, HClient clientType, String harbleMessagesPath) {
|
||||
sendMessage(
|
||||
new HPacket(NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.CONNECTIONSTART)
|
||||
.appendString(host)
|
||||
.appendInt(port)
|
||||
.appendString(hotelVersion)
|
||||
.appendString(harbleMessagesPath)
|
||||
.appendString(clientType)
|
||||
.appendString(clientIdentifier)
|
||||
.appendString(clientType.name())
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package gearth.services.extensionhandler.extensions.implementations.simple;
|
||||
|
||||
import gearth.protocol.HMessage;
|
||||
import gearth.protocol.HPacket;
|
||||
import gearth.protocol.connection.HClient;
|
||||
import gearth.services.extensionhandler.extensions.GEarthExtension;
|
||||
|
||||
public class ExampleExtension extends GEarthExtension {
|
||||
@ -83,7 +84,7 @@ public class ExampleExtension extends GEarthExtension {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionStart(String host, int port, String hotelVersion, String clientType, String harbleMessagesPath) {
|
||||
public void connectionStart(String host, int port, String hotelVersion, String clientIdentifier, HClient clientType, String harbleMessagesPath) {
|
||||
// a new habbo client has connected
|
||||
System.out.println("Connected to " + host);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user