forked from Francesco-Chen/PHP-Port-Scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscanmultiport.php
113 lines (109 loc) · 3.41 KB
/
scanmultiport.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Port Scanner</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
}
h1 {
font-size: 24px;
margin-bottom: 10px;
}
form,div{
background-color: #fff;
border: 1px solid #ccc;
padding: 20px;
margin: 20px auto;
max-width: 600px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
label {
display: inline-block;
width: 100px;
margin-bottom: 10px;
}
input[type="text"] {
padding: 8px;
margin: 4px 0;
border: 1px solid #ccc;
border-radius: 3px;
font-size: 16px;
width: calc(100% - 105px);
box-sizing: border-box;
}
input[type="submit"] {
background-color: #4CAF50;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 3px;
font-size: 16px;
cursor: pointer;
width: 100%
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
.result {
margin-top: 20px;
}
.result h2 {
font-size: 18px;
margin-bottom: 10px;
}
.result p {
margin: 5px 0;
}
.result .open {
color: green;
font-weight: bold;
}
.result .closed {
color: red;
font-weight: bold;
}
</style>
</head>
<body>
<h1 style="text-align: center;">Scan ports</h1>
<div>You can scan multiple ports at once, separated by commas, such as 80,443.
<p><strong>Common ports:</strong> 21, 22, 25, 53, 80, 443, 445, 3389, 5000</p>
<p><strong>Mail server ports:</strong> 25, 110, 143, 465, 587, 993, 995, 2525, 4190, 5222, 6010, 9025, 10019</p>
<p><strong>CF HTTP & HTTPS ports:</strong> 80, 443, 2052, 2053, 2082, 2083, 2086, 2087, 2095, 2096, 8080, 8443</p>
</div>
<!-- comon ports 21,22,25,53,80,443,445,3389,5000
mail server 25, 110, 143, 465, 587, 993, 995, 2525, 4190, 5222, 6010, 9025, 10019
CF http&https 80, 443, 2052, 2053, 2082, 2083, 2086, 2087, 2095, 2096, 8080, 8443 -->
<form method="post">
<label>Domain/IP:</label>
<input type="text" name="domain" />
<br />
<label>Ports:</label>
<input type="text" name="port" />
<br />
<input type="submit" value="Scan" />
</form>
<?php
if(!empty($_POST['domain']) && !empty($_POST['port'])) {
$domain = $_POST['domain'];
echo "<div class=\"result\"><h2>Results for $domain:</h2>";
$ports = explode(",", $_POST['port']);
foreach ($ports as $port) {
$port = trim($port);
$prot = getservbyport($port, "tcp");
echo "<p>Port $port ($prot): ";
if ($pf = @fsockopen($domain, $port, $err, $err_string, 1)) {
echo "<span class=\"open\">open</span></p>";
fclose($pf);
} else {
echo "<span class=\"closed\">closed</span></p>";
}
}
echo "</div>";
}
?>
</body>
</html>