-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostCommand.php
76 lines (60 loc) · 1.78 KB
/
postCommand.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
<?php
error_reporting(0);
$command = $_POST["command"];
$fullCommand = explode(" ", $command);
function sendEcho($message, $speed)
{
global $command;
$returnEcho["message"] = "Matth.ee/w > " . $message;
$returnEcho["speed"] = $speed;
echo json_encode($returnEcho);
exit();
}
if(empty($command))
{
sendEcho("Do you expect me to understand that??", 40);
}
if($fullCommand[0] == "get")
{
if($fullCommand[1] == "website")
{
$checkBefore = str_split($fullCommand[2], 7);
if($checkBefore[0] == "http://" || $checkBefore[0] == "https:/")
{
$sourceCode = file_get_contents($fullCommand[2]);
}
else
{
$sourceCode = file_get_contents("http://" . $fullCommand[2]);
}
if(!empty($sourceCode))
{
$highCode = curl_init('https://tohtml.com/');
curl_setopt( $highCode, CURLOPT_POST, 1);
curl_setopt( $highCode, CURLOPT_POSTFIELDS, 'style=black&code_src=' . urlencode($sourceCode));
curl_setopt( $highCode, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $highCode, CURLOPT_HEADER, 0);
curl_setopt( $highCode, CURLOPT_RETURNTRANSFER, 1);
$fullCode = curl_exec($highCode);
$pregMatch = preg_match_all("/<div style=\"overflow: scroll; width: 100%;\">(.*?)<\/div>/s", $fullCode, $htmlCode);
$finalCode = str_replace("background:", "matth:", $htmlCode[1][0]);
sendEcho($finalCode, 1);
}
else
{
sendEcho("Unable to resolve hostname", 40);
}
}
}
if($fullCommand[0] == "set")
{
if($fullCommand[1] == "speed")
{
sendEcho('New speed is set to ' . $fullCommand[2], 1);
}
}
if($fullCommand[0] == "help")
{
sendEcho('Help? What?', 1);
}
?>