mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-27 10:50:50 +01:00
fix SimplePacketLogger, expand HabboClient code 4windows
This commit is contained in:
parent
e04918d228
commit
b1964c126e
@ -96,6 +96,8 @@ public class HConnection {
|
|||||||
|
|
||||||
private volatile boolean autoDetectHost = false;
|
private volatile boolean autoDetectHost = false;
|
||||||
|
|
||||||
|
private volatile String clientHostAndPort = "";
|
||||||
|
|
||||||
|
|
||||||
public State getState() {
|
public State getState() {
|
||||||
return state;
|
return state;
|
||||||
@ -211,7 +213,7 @@ public class HConnection {
|
|||||||
|
|
||||||
final boolean[] aborted = new boolean[1];
|
final boolean[] aborted = new boolean[1];
|
||||||
|
|
||||||
Rc4Obtainer rc4Obtainer = new Rc4Obtainer();
|
Rc4Obtainer rc4Obtainer = new Rc4Obtainer(this);
|
||||||
|
|
||||||
// wachten op data van client
|
// wachten op data van client
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
@ -226,6 +228,8 @@ public class HConnection {
|
|||||||
|
|
||||||
handler.act(buffer);
|
handler.act(buffer);
|
||||||
if (!datastream[0] && handler.isDataStream()) {
|
if (!datastream[0] && handler.isDataStream()) {
|
||||||
|
clientHostAndPort = client.getInetAddress().getHostAddress() + ":" + client.getPort();
|
||||||
|
System.out.println(clientHostAndPort);
|
||||||
datastream[0] = true;
|
datastream[0] = true;
|
||||||
setState(State.CONNECTED);
|
setState(State.CONNECTED);
|
||||||
onConnect();
|
onConnect();
|
||||||
@ -373,6 +377,10 @@ public class HConnection {
|
|||||||
sendToServerAsyncQueue.clear();
|
sendToServerAsyncQueue.clear();
|
||||||
}
|
}
|
||||||
if (state != this.state) {
|
if (state != this.state) {
|
||||||
|
if (state != State.CONNECTED) {
|
||||||
|
clientHostAndPort = "";
|
||||||
|
}
|
||||||
|
|
||||||
State buffer = this.state;
|
State buffer = this.state;
|
||||||
this.state = state;
|
this.state = state;
|
||||||
for (StateChangeListener listener : stateChangeListeners) {
|
for (StateChangeListener listener : stateChangeListeners) {
|
||||||
@ -443,4 +451,8 @@ public class HConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClientHostAndPort() {
|
||||||
|
return clientHostAndPort;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package main.protocol.memory;
|
package main.protocol.memory;
|
||||||
|
|
||||||
|
import main.protocol.HConnection;
|
||||||
import main.protocol.HPacket;
|
import main.protocol.HPacket;
|
||||||
import main.protocol.crypto.RC4;
|
import main.protocol.crypto.RC4;
|
||||||
import main.protocol.memory.habboclient.HabboClient;
|
import main.protocol.memory.habboclient.HabboClient;
|
||||||
@ -20,8 +21,8 @@ public class Rc4Obtainer {
|
|||||||
OutgoingHandler outgoingHandler = null;
|
OutgoingHandler outgoingHandler = null;
|
||||||
IncomingHandler incomingHandler = null;
|
IncomingHandler incomingHandler = null;
|
||||||
|
|
||||||
public Rc4Obtainer() {
|
public Rc4Obtainer(HConnection hConnection) {
|
||||||
client = HabboClientFactory.get();
|
client = HabboClientFactory.get(hConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hashappened1 = false;
|
private boolean hashappened1 = false;
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
package main.protocol.memory.habboclient;
|
package main.protocol.memory.habboclient;
|
||||||
|
|
||||||
|
import main.protocol.HConnection;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Jonas on 13/06/18.
|
* Created by Jonas on 13/06/18.
|
||||||
*/
|
*/
|
||||||
public interface HabboClient {
|
public abstract class HabboClient {
|
||||||
|
|
||||||
List<byte[]> getRC4possibilities();
|
protected HConnection hConnection;
|
||||||
|
|
||||||
|
public HabboClient(HConnection connection) {
|
||||||
|
this.hConnection = connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract List<byte[]> getRC4possibilities();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package main.protocol.memory.habboclient;
|
package main.protocol.memory.habboclient;
|
||||||
|
|
||||||
import main.misc.OSValidator;
|
import main.misc.OSValidator;
|
||||||
|
import main.protocol.HConnection;
|
||||||
import main.protocol.memory.habboclient.linux.LinuxHabboClient;
|
import main.protocol.memory.habboclient.linux.LinuxHabboClient;
|
||||||
|
import main.protocol.memory.habboclient.windows.WindowsHabboClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Jonas on 13/06/18.
|
* Created by Jonas on 13/06/18.
|
||||||
@ -9,8 +11,9 @@ import main.protocol.memory.habboclient.linux.LinuxHabboClient;
|
|||||||
public class HabboClientFactory {
|
public class HabboClientFactory {
|
||||||
|
|
||||||
|
|
||||||
public static HabboClient get() {
|
public static HabboClient get(HConnection connection) {
|
||||||
if (OSValidator.isUnix()) return new LinuxHabboClient();
|
if (OSValidator.isUnix()) return new LinuxHabboClient(connection);
|
||||||
|
if (OSValidator.isWindows()) return new WindowsHabboClient(connection);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package main.protocol.memory.habboclient.linux;
|
package main.protocol.memory.habboclient.linux;
|
||||||
|
|
||||||
|
import main.protocol.HConnection;
|
||||||
import main.protocol.memory.habboclient.HabboClient;
|
import main.protocol.memory.habboclient.HabboClient;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class LinuxHabboClient implements HabboClient {
|
public class LinuxHabboClient extends HabboClient {
|
||||||
|
|
||||||
|
|
||||||
private static final String[] potentialProcessNames = {"--ppapi-flash-args", "plugin-container"};
|
private static final String[] potentialProcessNames = {"--ppapi-flash-args", "plugin-container"};
|
||||||
@ -16,7 +17,9 @@ public class LinuxHabboClient implements HabboClient {
|
|||||||
|
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
public LinuxHabboClient() {
|
public LinuxHabboClient(HConnection connection) {
|
||||||
|
super(connection);
|
||||||
|
|
||||||
File folder = new File("/proc");
|
File folder = new File("/proc");
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package main.protocol.memory.habboclient.windows;
|
||||||
|
|
||||||
|
import main.protocol.HConnection;
|
||||||
|
import main.protocol.memory.habboclient.HabboClient;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Jeunez on 27/06/2018.
|
||||||
|
*/
|
||||||
|
public class WindowsHabboClient extends HabboClient {
|
||||||
|
|
||||||
|
private static final boolean DEBUG = true;
|
||||||
|
private int[] PID; // list of potential PIDs
|
||||||
|
|
||||||
|
public WindowsHabboClient(HConnection connection) {
|
||||||
|
super(connection);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void obtain_PID () {
|
||||||
|
String command="cmd /C netstat -a -o -n | findstr "+hConnection.getClientHostAndPort()+" | findstr ESTABLISHED";
|
||||||
|
try {
|
||||||
|
Process process = Runtime.getRuntime().exec(command);
|
||||||
|
BufferedReader reader=new BufferedReader( new InputStreamReader(process.getInputStream()));
|
||||||
|
String s;
|
||||||
|
while ((s = reader.readLine()) != null){
|
||||||
|
String[] split = s.split(" ");
|
||||||
|
|
||||||
|
List<String> realSplit = new ArrayList<>();
|
||||||
|
for (String spli : split) {
|
||||||
|
if (!spli.equals("") && !spli.equals(" ")) {
|
||||||
|
realSplit.add(spli);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (realSplit.get(1).equals(hConnection.getClientHostAndPort())) {
|
||||||
|
// PID = Integer.parseInt(realSplit.get(4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<byte[]> getRC4possibilities() {
|
||||||
|
obtain_PID();
|
||||||
|
if (DEBUG) System.out.println("FLASH PROCESS ID: " + PID);
|
||||||
|
|
||||||
|
while (true) {}
|
||||||
|
// return null;
|
||||||
|
}
|
||||||
|
}
|
@ -48,6 +48,8 @@ class SimpleTerminalLogger implements PacketLogger {
|
|||||||
"<packet skipped>" :
|
"<packet skipped>" :
|
||||||
packet.toString()
|
packet.toString()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
System.out.println(output.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user