Hack Forums
[PHP] [ps.php] - light-weight port scanner - gotta get those 50posts - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] [ps.php] - light-weight port scanner - gotta get those 50posts (/showthread.php?tid=5238217)



[ps.php] - light-weight port scanner - gotta get those 50posts - ImDeepWithWindows - Apr 15, 2016

im mostly posting this to get that first 50 posts so i can psot in market place section and include urls in my posts

here it is a port scanner written in php (yes i know this is rookie stuff like i said rushing to 50 posts)

Code
<?php
if (!$_REQUEST['targ']) {
echo "target will see you as: [".$_SERVER['SERVER_ADDR']."]<br/> and maybe: [".$_SERVER['SERVER_NAME']."]<br/>";
echo "<form method=REQUEST ><input type=text name=targ value=tcp:// /><input type=submit value=scan />";
} else {
$targ = $_REQUEST['targ'];
echo "scanning [ ".$_REQUEST['targ']." ] ...<br/>\r\n<hr/>\r\nlist of open ports:<br/>\r\n";
for ($p = 1; $p < 1000; $p++) {
if (@$conn = fsockopen($targ,$p,$errno, $errstr, 2)) {
echo "open port: [ ".$p." ]<br/>\r\n";
fclose($conn);
}
}
echo "<hr/>\r\ndone scanning<br/>\r\n<form method=REQUEST ><input type=submit value=NewScan /><br/>\r\n";
}
?>



* - Sakuto - Apr 15, 2016

Please stop sharing this kind of script, they suck and are useless.


* - 3yZtwglFSCUs - Apr 15, 2016

this are like snippet why not share the whole thing