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