ip_scanner
This is an old revision of the document!
IP Scanner
There's a simple auto-scanner at cyli.org that you can use to see your IP address and run a fast nmap1) scan against your routable IP address.
There are three files that make up the scanner, the first, in the root directory of the web server is index.php. It shows your routable IP address and displays a button to run nmap against that address. ;
- index.php
<HTML> <HEAD> <TITLE>Steve Jones' Web Stuff</TITLE> <BODY><center> <?php $Addr = $_SERVER["REMOTE_ADDR"]; echo "Your IP address<br>" ; echo " $Addr <br>" ; $Command = '/usr/bin/geoiplookup "'.$Addr.'" | grep "City Edition"'; $ShellOut = shell_exec($Command); echo trim($ShellOut); ?> <br>This product includes GeoLite2 data created by MaxMind, available from <a href="https://www.maxmind.com">https://www.maxmind.com</a>. <hr> <form action="https://cyli.org/ip/scan.php"> <input type="submit" value="nmap scan against your IP address"> </form> <hr> <a href="subnet_sheet.html">Subnet Cheat Sheet</a> <hr> <a href="https://en.wikipedia.org/wiki/Reserved_IP_addresses">Reserved IP Addresses (Wikipedia)</a> <hr> </center> </BODY> </HTML>
That button calls a second page at ip/scan.php;
- scan.php
<?php $Addr = $_SERVER["REMOTE_ADDR"]; $Command = '/var/www/html/ip/ScanThem "'.$Addr.'"'; shell_exec($Command); ?> <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <meta http-equiv="refresh" content="1;url=http://cyli.org/ip/LastScan.html"> <script type="text/javascript"> window.location.href = "http://cyli.org/ip/LastScan.html" </script> <title>Scanning...</title> </head> <body> <!-- Note: don't tell people to `click` the link, just tell them that it is a link. --> If you are not redirected automatically, follow the <a href='http://cyli.org/ip/LastScan.html'>link to LastScan.</a> </body> </html>
The page above initiates the scan, and then redirects the browser to the file containing the results of the scan. The scanner is;
- ip/ScanThem
#!/bin/bash Date=$(date +"%Y-%m-%d-%H-%M-%S") Addr="${1}" Dir="/var/www/html/ip" rm "${Dir}/LastScan.html" /usr/bin/nmap -FoX - "${Addr}" \ | /usr/bin/xsltproc --output ${Dir}/LastScan-${Date}.html - ln -s ${Dir}/LastScan-${Date}.html ${Dir}/LastScan.html
An example of the output is LastScan-2023-11-10-03-19-28.html, this is from one of the many crawlers that wander about the Internet…
ip_scanner.1776698656.txt.gz · Last modified: by steve
