Thursday, August 13, 2015

Php port scanner

Myanmar security forum က​ေတြ႕လို မလာတယ္​ဗ်
Port scanner with php တဲ့
တား​ေတာ့ဘာမွန္​းကိုမသိဘူး
သိသူမ်ားစမ္​းၾကည္​့ၾကပါဗ်ိဳ႕:-)

#ရပ္​​ေစာက္​သား

<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 00 #9acc85;
-webkit-box-shadow:inset 0 1px 00 #9acc85;
box-shadow:inset 01px 0 0#9acc85;
background:linear-gradient
(tobottom,#74ad5a5%,#68a54b100%);
filter:progid:DXImageTransform.Microsoft.gradient
(startColorstr='#74ad5a',endCol​
orstr='#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',endCol​
orstr='#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>
scanner.php save shell
....
...
PHP ....

Ref Myanmar Security Forum

0 comments:

Post a Comment