Port scanners are created to find opened/closed ports in a host, you can get the same results in this Port Scanner coded in php by the way I wouldn't take all the credits to this because i am a php beginner so I had to make this from scratch also there are many more open source advanced Port Scanners. You can also easily add Ports if you need to.
Codes :
Enter domain or ip address and click on the button then it would take around a minute and would return back with the ports & it's status.
This is what I got for my Domain :
Enjoy the port scanner..
<html>
<head>
<title>Port Scanner</title>
</head>
<form method="post" >
Domain name/IP:
<input type="text" class = text name="domain" />
<input type="submit" class="s" value="Scan" />
</form>
<style type="text/css">
.text {
font-weight:400;
color:#000;
letter-spacing:1pt;
word-spacing:2pt;
font-size:12px;
text-align:left;
font-family:arial, helvetica, sans-serif;
line-height:1;
}
.s {
-moz-box-shadow:inset 0 1px 0 0 #9acc85;
-webkit-box-shadow:inset 0 1px 0 0 #9acc85;
box-shadow:inset 0 1px 0 0 #9acc85;
background:linear-gradient(tobottom,#74ad5a5%,#68a54b100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#74ad5a',endColorstr='#68a54b',GradientType=0);
background-color:#74ad5a;
border:1px solid #3b6e22;
display:inline-block;
color:#fff;
font-family:arial;
font-size:13px;
font-weight:700;
text-decoration:none;
padding:6px 12px;
}
.s:hover {
background:linear-gradient(tobottom,#68a54b5%,#74ad5a100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#68a54b',endColorstr='#74ad5a',GradientType=0);
background-color:#68a54b;
}
.s:active {
position:relative;
top:1px;
}
<br /> <?php if(!empty($_POST['domain'])) { //ports $ports = array(20, 21, 22, 23, 25, 53, 443, 143, 80, 109, 110, 1433, 1434, 156, 994); $results = array(); foreach($ports as $port) { if($pwn = @fsockopen($_POST['domain'], $port, $str, $str_string, 1)) { $results[$port] = true; fclose($pwn); } else { $results[$port] = false; } } foreach($results as $port=>$val) { $port = getservbyport($port,"tcp"); echo "Port $port ($port): "; if($val) { echo "<span style=\"color:green\">Opened</span><br/>"; } else { echo "<span style=\"color:red\">Closed</span><br/>"; } } } ?> </html>Usage :
Enter domain or ip address and click on the button then it would take around a minute and would return back with the ports & it's status.
This is what I got for my Domain :
Referrance
- Port ftp-data (ftp-data): Closed
- Port ftp (ftp): Closed
- Port ssh (ssh): Closed
- Port telnet (telnet): Closed
- Port smtp (smtp): Opened
- Port domain (domain): Closed
- Port https (https): Opened
- Port imap (imap): Opened
- Port http (http): Opened
- Port pop2 (pop2): Closed
- Port pop3 (pop3): Opened
- Port ms-sql-s (ms-sql-s): Closed
- Port ms-sql-m (ms-sql-m): Closed
- Port sqlsrv (sqlsrv): Closed
- Port ircs (ircs): Closed
Enjoy the port scanner..
4 comments
you forget some end tags
Reply:D
i was checked and worked Thanks
not working
ReplyAssigning Values to Variables
ReplyRetrieving Values
Freeing Memory
Constants
Operators
Logical and Relational Operators
Bitwise Operators
Miscellaneous Operators
Assignment Operators
Expressions
CONTROL STATEMENTS
True and False
The if Statement
The ? Operator
The switch Statement
Loops
The while Statement
The break Statement
The continue Statement
The do...while Statement
The for Statement
The foreach Statement
exit, die, and return
Evaluation of Boolean Expressions
PHP Training in Chennai | PHP Training | PHP Training Institutes in Chennai | PHP Online Training | PHP Online Training India
ReplyPost a Comment
Note: Only a member of this blog may post a comment.