class SocketMaster private BotEnv m_BE private Socket m_sock private B

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*****/
class SocketMaster
{
private BotEnv m_BE;
private Socket m_sock;
private BufferedReader m_in;
private PrintWriter m_out;
public SocketMaster (BotEnv _bptr, String _host, int _port) {
m_BE = _bptr;
try {
m_sock = new Socket(_host, _port);
m_in = new BufferedReader(new InputStreamReader(m_sock.getInputStream()));
m_out = new PrintWriter(m_sock.getOutputStream());
} catch (Exception _e) {
_e.printStackTrace();
}
}
public void run() {
m_out.println(INIT_STRING);
m_out.flush();
int idx, startdx, idx2;
boolean started = false;
String startLex = "PID";
// Here we going to get all fucking shit, from task details to input stream...
String get="", cmd = "", put;
char[] buf = new char[255];
int len;
try {
while(((len=m_in.read(buf))!= -1)){
get += String.copyValueOf(buf).substring(0,len);
if (!started) {
startdx = get.indexOf(startLex);
if (startdx != -1) {
started = true;
get=get.substring(startdx);
}
else {
continue;
}
}
idx = get.indexOf(';');
if (idx != -1) {
cmd = get.substring(0,idx).replace("\r\n", " ");
System.out.println(cmd);
// IMPORTANT! Here we will instantly give out solution response!!!
m_out.print(m_BE.proccessComand(cmd)+";");
m_out.flush();
get = get.substring(idx+1);
}
}
} catch (Exception _e) {
_e.printStackTrace();
}
}
public boolean isAvailable()
{
try {
if(m_sock.getInputStream().available()>0)
return true;
} catch (Exception _e) {
_e.printStackTrace();
}
return false;
}
final String INIT_STRING = "launch heratorz CFGSrUPQPKgtmDcKuOhgCSy#CFGwjQJiWQQUViJiymrQoGY#CFGUfimkSUQhcMgGMqlWQYs#CFGWYiZmCiYpYaYWZuBspkg#CFGAEeaubIIRkDOlIxGmyPM#CFGYLEQYicsFWmjwKmXaOmC#CFGufAMuyIOhKxKaSOxoxUN#CFGowmRWjWSWxcZiqlGeYkF#CFGUpogIViMtiOkulA@IYoZ#CFGQOwAkDwyVAZCoKTqFuyJ#CFGMSYfClQgVEaUuinytily#CFGyNQRgQmanQxKmUAXEepm;";
}