mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-23 08:50:52 +01:00
hproxy hclient
This commit is contained in:
parent
d252c33c8b
commit
7c840ae98a
@ -0,0 +1,6 @@
|
||||
package gearth.protocol.connection;
|
||||
|
||||
public enum HClient {
|
||||
UNITY,
|
||||
FLASH
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
package gearth.protocol.connection;
|
||||
|
||||
import gearth.protocol.packethandler.PacketHandler;
|
||||
import gearth.protocol.packethandler.flash.IncomingFlashPacketHandler;
|
||||
import gearth.protocol.packethandler.flash.OutgoingFlashPacketHandler;
|
||||
|
||||
import java.net.ServerSocket;
|
||||
|
||||
public class HProxy {
|
||||
|
||||
private final HClient hClient;
|
||||
|
||||
private volatile String input_domain; //string representation of the domain to intercept
|
||||
private volatile String actual_domain; //dns resolved domain (ignoring hosts file)
|
||||
private volatile int actual_port; //port of the server
|
||||
@ -22,7 +23,8 @@ public class HProxy {
|
||||
private volatile String hotelVersion = "";
|
||||
private volatile AsyncPacketSender asyncPacketSender = null;
|
||||
|
||||
public HProxy(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) {
|
||||
this.hClient = hClient;
|
||||
this.input_domain = input_domain;
|
||||
this.actual_domain = actual_domain;
|
||||
this.actual_port = actual_port;
|
||||
@ -80,4 +82,8 @@ public class HProxy {
|
||||
public AsyncPacketSender getAsyncPacketSender() {
|
||||
return asyncPacketSender;
|
||||
}
|
||||
|
||||
public HClient gethClient() {
|
||||
return hClient;
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package gearth.protocol.connection.proxy.flash;
|
||||
|
||||
import gearth.misc.Cacher;
|
||||
import gearth.protocol.HConnection;
|
||||
import gearth.protocol.connection.HProxy;
|
||||
import gearth.protocol.connection.HProxySetter;
|
||||
import gearth.protocol.connection.HState;
|
||||
import gearth.protocol.connection.HStateSetter;
|
||||
import gearth.protocol.connection.*;
|
||||
import gearth.protocol.connection.proxy.ProxyProviderFactory;
|
||||
import gearth.protocol.connection.proxy.SocksConfiguration;
|
||||
import gearth.protocol.hostreplacer.hostsfile.HostReplacer;
|
||||
@ -73,7 +70,7 @@ public class NormalFlashProxyProvider extends FlashProxyProvider {
|
||||
|
||||
int intercept_port = port;
|
||||
String intercept_host = "127.0." + (c / 254) + "." + (1 + c % 254);
|
||||
potentialProxies.add(new HProxy(input_dom, actual_dom, port, intercept_port, intercept_host));
|
||||
potentialProxies.add(new HProxy(HClient.FLASH, input_dom, actual_dom, port, intercept_port, intercept_host));
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
package gearth.protocol.connection.proxy.flash.unix;
|
||||
|
||||
import gearth.protocol.HConnection;
|
||||
import gearth.protocol.connection.HProxy;
|
||||
import gearth.protocol.connection.HProxySetter;
|
||||
import gearth.protocol.connection.HState;
|
||||
import gearth.protocol.connection.HStateSetter;
|
||||
import gearth.protocol.connection.*;
|
||||
import gearth.protocol.connection.proxy.flash.FlashProxyProvider;
|
||||
import gearth.protocol.connection.proxy.ProxyProviderFactory;
|
||||
import gearth.protocol.connection.proxy.SocksConfiguration;
|
||||
@ -46,7 +43,7 @@ public class LinuxRawIpFlashProxyProvider extends FlashProxyProvider {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
stateSetter.setState(HState.PREPARING);
|
||||
proxy = new HProxy(input_host, input_host, input_port, input_port, "0.0.0.0");
|
||||
proxy = new HProxy(HClient.FLASH, input_host, input_host, input_port, input_port, "0.0.0.0");
|
||||
|
||||
maybeRemoveMapping();
|
||||
|
||||
|
@ -3,10 +3,7 @@ package gearth.protocol.connection.proxy.unity;
|
||||
import gearth.protocol.HConnection;
|
||||
import gearth.protocol.HMessage;
|
||||
import gearth.protocol.HPacket;
|
||||
import gearth.protocol.connection.HProxy;
|
||||
import gearth.protocol.connection.HProxySetter;
|
||||
import gearth.protocol.connection.HState;
|
||||
import gearth.protocol.connection.HStateSetter;
|
||||
import gearth.protocol.connection.*;
|
||||
import gearth.protocol.connection.proxy.ProxyProvider;
|
||||
import gearth.protocol.packethandler.unity.UnityPacketHandler;
|
||||
|
||||
@ -58,8 +55,7 @@ public class UnityCommunicator {
|
||||
if (hProxy == null && b[0] == 1) {
|
||||
HPacket maybe = new HPacket(packet);
|
||||
if (maybe.getBytesLength() > 6 && maybe.headerId() == 4000) {
|
||||
String hotelVersion = maybe.readString();
|
||||
hProxy = new HProxy("", "", -1, -1, "");
|
||||
hProxy = new HProxy(HClient.UNITY, "", "", -1, -1, "");
|
||||
hProxy.verifyProxy(
|
||||
new UnityPacketHandler(hConnection.getExtensionHandler(), hConnection.getTrafficObservables(), session, HMessage.Direction.TOCLIENT),
|
||||
new UnityPacketHandler(hConnection.getExtensionHandler(), hConnection.getTrafficObservables(), session, HMessage.Direction.TOSERVER),
|
||||
|
Loading…
Reference in New Issue
Block a user