Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PS Squared: Ping Sweeper and Port Scanner Combo - Batch Code Bank


PS Squared: Ping Sweeper and Port Scanner Combo
this is a simple batch program that sweeps through IPs starting with your desired starting IP. It can also perform a port scan on an IP of your choice. It then records all the information to a log file within the same directory (except for the port scan that you will have to copy manually). To use the program just follow the on screen instructions when the batch runs.
                @echo OFF
@ color A

:begin
set /P lname="What is the name of the log you want? (No Spaces): "
@ echo ''
set /P name="What is your name?: "
@ echo ''
set /P purpose="What is your purpose for running this program? : "
@ echo ''
echo ******************************** >> %lname%_pingsweeper_LOG.txt
echo *    START OF SWEEP            * >> %lname%_pingsweeper_LOG.txt
echo ******************************** >> %lname%_pingsweeper_LOG.txt
echo Ping Sweeper 1.0 >> %lname%_pingsweeper_LOG.txt
echo Program made by : sh4d0-haxor >> %lname%_pingsweeper_LOG.txt
echo Date of Creation : March 30, 2009 >> %lname%_pingsweeper_LOG.txt
echo ******************* >> %lname%_pingsweeper_LOG.txt
echo Progrqam Run by: %name% >> %lname%_pingsweeper_LOG.txt
echo Purpose of use >> %lname%_pingsweeper_LOG.txt
echo %purpose% >> %lname%_pingsweeper_LOG.txt
echo ******************* >> %lname%_pingsweeper_LOG.txt
echo Date used >> %lname%_pingsweeper_LOG.txt
date /T >> %lname%_pingsweeper_LOG.txt
echo Time Used >> %lname%_pingsweeper_LOG.txt
time /T >> %lname%_pingsweeper_LOG.txt
echo ******************* >> %lname%_pingsweeper_LOG.txt
echo Local Computer Statistics statistics >> %lname%_pingsweeper_LOG.txt
ipconfig /all >> %lname%_pingsweeper_LOG.txt
echo ******************* >> %lname%_pingsweeper_LOG.txt

set /P choice="Would you like to do a port scan or a ping sweep? ('scan' fro 

portscan and 'sweep' for ping sweep) [NOTE: scan might not work on all 

computers and the information must be manually copied] : "
@ echo ''
if '%choice%' == 'scan' goto scan

set /P ip="Enter the first part of IP you wish to ping (e.g. 192.168.1 

[note: dont put an end dot]): "
@ echo ''
set /P ip2="Enter the second part of IP you wish to ping (e.g. last [dont 

put a dot] x): "
@ echo ''
echo Please note that Ctrl+C is the escape character the scan will keep 

going untill you press Ctrl+C or untill the end IP number hits 225 once it 

hits 225 you can start a new scan. (NOTE: If you hit Ctrl+C the whole 

program will be stopped which means you'd have to reopen the program to 

rerun it, but all the informtion will still be recorded)
pause

:start
echo IP address being pinged  : %ip%.%ip2% >> %lname%_pingsweeper_LOG.txt
echo --- >> %lname%_pingsweeper_LOG.txt
ping %ip%.%ip2% -n 1 -i 225 >> %lname%_pingsweeper_LOG.txt
echo *** >> %lname%_pingsweeper_LOG.txt
nslookup %ip%.%ip2%  >> %lname%_pingsweeper_LOG.txt
echo *** >> %lname%_pingsweeper_LOG.txt
echo IP: %ip%.%ip2% is done...
@ echo ''
echo --- >> %lname%_pingsweeper_LOG.txt
set /A ip2+=1
set /A ipsleft= 255-%ip2%
echo There are %ipsleft% IP addresses left in this block
@ echo ''
if '%ip2%' == '255' goto end
goto start


:scan
echo ******************************* >> %lname%_pingsweeper_LOG.txt
echo *         Port Scanner        * >> %lname%_pingsweeper_LOG.txt
echo ******************************* >> %lname%_pingsweeper_LOG.txt
set /P ip3="Enter the IP you wish to scan (e.g. 192.168.1.132 : "
@ echo ''
echo Ip being scanned: %ip3% >> %lname%_pingsweeper_LOG.txt
echo ***** >> %lname%_pingsweeper_LOG.txt
echo (NOTE: Press Esc when telnet opens to continue the scan)
pause
set port=0

:loop
set /a port=%port% + 1
@ echo ***
echo Trying port %port%...
set /A portsleft= 65535-%port%
echo There are %portsleft% ports left to scan
telnet %ip3% %port%
@ echo ***
set /P ans="Did the port connect? ('y' for yes): "
if '%ans%' == 'y' goto portfound
if '%ans%' == 'n' goto portclosed

:test
if "%port%"=="65535" goto end
goto loop


:portclosed
echo this port is closed : %port% >> %lname%_pingsweeper_LOG.txt
goto test

:portfound
echo open port was found on Port :%port% >> %lname%_pingsweeper_LOG.txt
goto test

:end
echo thank you for using Ping Sweeper 1.0 >> %lname%_pingsweeper_LOG.txt
echo ******************************** >> %lname%_pingsweeper_LOG.txt
echo *    END OF SWEEP and SCAN     * >> %lname%_pingsweeper_LOG.txt
echo ******************************** >> %lname%_pingsweeper_LOG.txt
set /P restart="Would you like to run a port scan? (yes to scan) :"
if '%restart%' == 'yes' goto scan
set /P restart2="Would you like to run the scan again using a different IP 

range? (y to restart) :"
@ echo ''
if '%restart2%' == 'y' goto begin
            
Comments
Sorry but there are no comments to display