-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcallback.php
167 lines (127 loc) · 4.27 KB
/
callback.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?PHP
die();
include_once('slack.php');
if (isset($_GET['msg'])){
$msg = htmlspecialchars($_GET['msg']);
}
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$host = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$host = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$host = $_SERVER['REMOTE_ADDR'];
}
slack_bypass("*$host Hack Attempt*: $msg",'anti-hack');
function AB_test($host){
$command = "ab -n 100000 -c 100 -H \"Host: example.com\" http://$host/ ";
slack_bypass("Starting: $command",'anti-hack-tools');
$last_line = system($command, $retval);
slack_bypass("Finished: $command $last_line",'anti-hack-tools');
}
function check_WWW_80($host){
$www = "http://$host";
$info = get_headers($www, 1);
foreach($info as $type => $value){
slack_bypass("Probe Back HTTP $type: $value",'anti-hack');
}
}
function check_WWW_443($host){
$www = "https://$host";
$info = get_headers($www, 1);
foreach($info as $type => $value){
slack_bypass("Probe Back HTTPS $type: $value",'anti-hack');
}
}
function check_FTP($ftp_server){
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or slack_bypass("Couldn't connect FTP to $ftp_server",'anti-hack');
// try to login
if (@ftp_login($conn_id, "anonymous", "")) {
slack_bypass("Probe FTP as anonymous@$ftp_server",'anti-hack');
} else {
slack_bypass("Probe failed to connect FTP as anonymous",'anti-hack');
}
// close the connection
ftp_close($conn_id);
}
function check_SMPT($host){
require_once "Mail.php";
$from = "Web Master <[email protected]>";
$to = "Nobody <[email protected]>";
$subject = "Test email using PHP SMTP\r\n\r\n";
$body = "This is a test email message";
//$host = "pop.emailsrvr.com";
$username = "[email protected]";
$password = "yourPassword";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
slack_bypass('Probe Back SMTP: '. $mail->getMessage() .'!','anti-hack');
} else {
echo("<p>Message successfully sent!</p>");
slack_bypass('Probe Back SMTP: Message successfully sent!','anti-hack');
}
}
function check_SMPT2($host){
require_once "Mail.php";
$from = "Web Master <[email protected]>";
$to = "Nobody <[email protected]>";
$subject = "Test email using PHP SMTP\r\n\r\n";
$body = "This is a test email message";
//$host = "pop.emailsrvr.com";
$username = "[email protected]";
$password = "yourPassword";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => false));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
slack_bypass('Probe Back SMTP2: '. $mail->getMessage() .'!','anti-hack');
} else {
echo("<p>Message successfully sent!</p>");
slack_bypass('Probe Back SMTP2: Message successfully sent!','anti-hack');
}
}
//$host = 'google.com';
$ports = array(21, 25, 80, 81, 110, 143, 443, 587, 2525, 3306);
foreach ($ports as $port)
{
$connection = @fsockopen($host, $port, $errno, $errstr, 2);
if (is_resource($connection))
{
echo '<h2>' . $host . ':' . $port . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.</h2>' . "\n";
slack_bypass('Probe: '.$host . ':' . $port . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.','anti-hack');
if ($port == 21){
check_FTP($host);
}
if ($port == '25'){
check_SMPT($host);
check_SMPT2($host);
}
if ($port == '80'){
check_WWW_80($host);
AB_test($host);
}
if ($port == '443'){
check_WWW_443($host);
}
fclose($connection);
}
else
{
echo '<h2>' . $host . ':' . $port . ' is not responding.</h2>' . "\n";
}
}
?>