forked from pencurry/exploit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
port-scanner.php
97 lines (91 loc) · 2.76 KB
/
port-scanner.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
<?php
/**
* @package PHP PORT SCANNER
* @author Z0NK3X
* @link https://fb.com/aardzz
*
*/
$green = "\e[1;92m";
$cyan = "\e[1;36m";
$normal = "\e[0m";
$blue = "\e[34m";
$green1 = "\e[0;92m";
$yellow = "\e[93m";
$red = "\e[1;91m";
function banner(){
$green = "\e[1;92m";
$cyan = "\e[1;36m";
$normal = "\e[0m";
$blue = "\e[1;34m";
$green1 = "\e[0;92m";
$yellow = "\e[93m";
$red = "\e[1;91m";
$banner = $cyan."
▄███████▄ ▀████ ▐████▀
██▀ ▄██ ███▌ ████▀
▄███▀ ███ ▐███
▀█▀▄███▀▄▄ ▀███▄███▀
▄███▀ ▀ ████▀██▄
▄███▀ ▐███ ▀███
███▄ ▄█ ▄███ ███▄
▀████████▀ ████ ███▄
".$normal.$red."Z0NK3X".$normal."
[".date("Y-m-d H:i:s")."]
".$yellow."╔═╗╔═╗╦═╗╔╦╗ ".$normal.$red."┌─┐┌─┐┌─┐┌┐┌┌┐┌┌─┐┬─┐
".$yellow."╠═╝║ ║╠╦╝ ║ ".$normal.$red."└─┐│ ├─┤││││││├┤ ├┬┘
".$yellow."╩ ╚═╝╩╚═ ╩ ".$normal.$red."└─┘└─┘┴ ┴┘└┘┘└┘└─┘┴└─
\n".$normal;
echo $banner;
}
$host = "127.0.0.1";
banner()."\n";
echo " [+] Default Hostname : ".php_uname("n")."\n";
echo " [+] Using Host : ".$cyan.$host.$normal."\n";
$start = readline(" [?] Port Start : ");
$end = readline(" [?] Port End : ");
$packetContent = "GET / HTTP/1.1\r\n\r\n";
if (!is_numeric($start) | !is_numeric($end)) {
exit();
}
echo "\r\n\r\n";
if (ctype_xdigit($packetContent)) $packetContent = @pack("H*", $packetContent);
else {
$packetContent = str_replace(array(
"\r",
"\n"
) , "", $packetContent);
$packetContent = str_replace(array(
"\\r",
"\\n"
) , array(
"\r",
"\n"
) , $packetContent);
}
echo "---------------------------------------------------~\n";
for ($i = $start; $i <= $end; $i++) {
$sock = @fsockopen($host, $i, $errno, $errstr, 3);
if ($sock) {
stream_set_timeout($sock, 5);
fwrite($sock, $packetContent . "\r\n\r\n\x00");
$counter = 0;
$maxtry = 1;
$bin = "";
do {
$line = fgets($sock, 1024);
if (trim($line) == "") $counter++;
$bin.= $line;
}
while ($counter < $maxtry);
fclose($sock);
echo $green1."Port $i Is Open!\n".$normal;
if (!empty($bin)) {
echo "$bin\n";
}else{
echo $red."Response is empty!\n".$normal;
}
echo "---------------------------------------------------~\n";
}
flush();
}
?>