@ECHO OFF CLS REM Call this command file passing the full IP Address of a network device, REM i.e. Pingsweep 192.168.1.1 REM Set the Variable "IP" to the IP range passed to the CMD file. This needs to be done REM because parsing the sub-net from the passed variable does not work. REM ************************************************************************************************* Set IP=%1 REM Parse the subnet to the "NewIP" variable. REM this takes each class range of the IP address using the "." as the delimiter REM and assigns it to the String "NewIP" and adds the necessary "." back in REM so that the subnet is recreated properly regardless of the subnet IP structure. REM This does however assume you are pinging a class C network. REM ************************************************************************************************* FOR /F "tokens=1,2,3* delims=." %%a in ("%IP%") do set NewIP=%%a.%%b.%%c. REM Echo the Subnet being scanned, and pause to allow continuation or cancel of the PingSweep command. REM ************************************************************************************************* ECHO The SubNet being scanned is: %NewIP% REM Give the choice to continue the PingSweep or exit REM ************************************************************************************************* :menu CHOICE /C YN /M "Do you wish to Ping Sweep this network?" IF ERRORLEVEL 2 GOTO Exit IF ERRORLEVEL 1 GOTO PingIt REM If not the right subnet, then exit :Exit exit :PingIt REM Ping the subnet from "0" to "255" showing only those devices who "Reply" REM the "0" and "255" will return the providers IP address. You can use whois.arin.net to REM find the service provider. For example 63.232.116.198 returns REM Quest Communications Company REM ************************************************************************************************* CLS ECHO The first and last IP's returned reflect the Internet Providers address. >C:\PingSweep.txt ECHO You can use whois.arin.net to find the service provider. >> C:\PingSweep.txt ECHO For example 63.232.116.198 returns Quest Communications Company >> C:\PingSweep.txt ECHO ************************************************************************** >> C:\PingSweep.txt ECHO : >> C:\PingSweep.txt ECHO PLEASE WAIT WHILE THE C:\PINGSWEEP.TXT FILE IS BEING CREATED ECHO IT WILL BE AUTOMATICALLY OPENED WHEN THE SWEEP IS FINISHED ECHO ************************************************************* FOR /l %%i in (0,1,255) do @ping %NewIP%%%i -n 1 -w 100 | find "Reply" >> C:\PingSweep.txt | ECHO %NewIP%%%i START Notepad.exe "C:\PingSweep.txt"