forked from dzxs/jrat-web
/
slave.php
112 lines (90 loc) · 2.37 KB
/
slave.php
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
require_once "operatingsystem.php";
require_once "countries.php";
class Slave {
public $array;
public function makearray($s) {
$data = explode(":", $s);
$this->array = array(
"strid" => $data[0],
"id" => $data[1],
"selected" => $data[2],
"country" => $data[3],
"userstring" => $data[4],
"os" => $data[5],
"ip" => $data[6],
"version" => $data[7],
"ping" => $data[8],
);
}
public function getStringId() {
return $this->array['strid'];
}
public function getUniqueId() {
return $this->array['id'];
}
public function isSelected() {
return $this->array['selected'];
}
public function getDisplayCountry() {
$flagname = strtolower($this->array["country"]);
$flagpath = "images/flags/" . $flagname . ".png";
if (!file_exists($flagpath)) {
$flagpath = "images/flags/unknown.png";
}
return $country = '<img src="' . $flagpath . '"> ' . Countries::short2long($this->array['country']);
}
public function getIdentifier() {
return $userstring = '<b>' . $this->array['userstring'] . '</b>';
}
public function getIP() {
return $this->array['ip'];
}
public function getOperatingSystem() {
$os = $this->array['os'];
$osIcon = '<img src="' . OperatingSystem::getIcon($os) . '"> ' . $os;
return $osIcon;
}
public function getVersion() {
$ver = $this->array['version'];
if (strpos($ver, "jRAT") !== false) {
$verIcon = '<img src="images/icons/icon.png"> ' . $ver;
} else {
$verIcon = $ver;
}
return $verIcon;
}
public function getPing() {
if ($this->isOffline()) {
return '<button type="submit" name="command" class="btn btn-danger btn-xs"> Offline';
} else {
$ping = $this->array['ping'];
if ($ping < 50) {
$icon = 0;
} else if ($ping < 100) {
$icon = 1;
} else if ($ping < 200) {
$icon = 2;
} else if ($ping < 400) {
$icon = 3;
} else if ($ping < 1000) {
$icon = 4;
} else {
$icon = 5;
}
return '<img src="images/icons/ping' . $icon . '.png"> ' . $ping . ' ms';
}
}
public function getSessionId() {
return md5(implode(":", $this->array));
}
public function isOffline() {
return substr($this->array['id'], 0, 1) == "-";
}
public static function none() {
$slave = new Slave();
$s = "Nothing found";
$slave->makearray($s . ":" . $s . ":" . $s . ":" . $s . ":" . $s . ":" . $s . ":" . $s);
return $slave;
}
}