TechKnow

Author Topic: [BAT] SSPBNS the Shit Simple Ping Based Network Scanner with progressbar  (Read 874 times)

0 Members and 1 Guest are viewing this topic.

Offline HcH

  • TechKnow Owner, Ethical Hacker
  • Administrator
  • Uber Member
  • *****
  • Posts: 9936
  • Karma: +2284/-111
SSPBNS
Shit Simple Ping Based Network Scanner
with progressbar in batch!



This is a small batch script, it's just 9 lines and simply scans the network using pings. If you want to adept this script, make sure you change the network as the script doesn't lookup your gateway and determines what your current network is. It's default to scan 192.168.1.x. Be aware of line 8, which is quite long, resulting in possible multiline copy/past failures!

REM This is just for clean output:
echo off

REM Choose whatever color scheme you want, if any ...
color 2a

REM We will expand in loops, so ...
SETLOCAL ENABLEDELAYEDEXPANSION

REM Remove any other previous scanresults:
IF EXIST IPLIST.TXT DEL IPLIST.TXT

REM Define the lenght of the bar but also the steps in our loop at the same time in this example:
SET BARLENGHT=254

REM Generate a lenghty string given %BARLENGHT% as the EMPTY part of the bar:
for /L %%a in (1, 1, %BARLENGHT%) do (set EMPTYBAR=0!EMPTYBAR!)

REM Start scanning, using a single ping we can retrieve errorlevels! If ERRORLEVEL==0 then output the ping to the results text file:
for /L %%a in (1, 1, %BARLENGHT%) do (ping -n 1 -l 8 -w 8 -i 8 192.168.1.%%a >NUL && IF %ERRORLEVEL%==0 ECHO 192.168.1.%%a>>IPLIST.TXT

REM Output the screen, here it adds characters to the filled part of the progressbar and deducts strings of the empty part of the progressbar. If there is no IPLIST.txt found, it means there are currently no scan results, so to make that clear we output that there are no results currently.
cls&&echo Shit-Simple-Ping-Based-Network-Scanner&&echo.&&echo Scanning: 192.168.1.%%a && echo. && set BAR=1!BAR!&& echo !BAR!!EMPTYBAR!&& set EMPTYBAR=!EMPTYBAR:~0,-1!&& echo. && echo Active IP addresses: && echo. && IF NOT EXIST IPLIST.TXT (echo NONE FOUND YET) ELSE type IPLIST.TXT)

REM The final results screen:
cls&&echo Scan results:&&echo.&&type IPLIST.TXT&&echo.&&pause

That's all!
  • echo off
  • color 2a
  • SETLOCAL ENABLEDELAYEDEXPANSION
  • IF EXIST IPLIST.TXT DEL IPLIST.TXT
  • SET BARLENGHT=254
  • for /L %%a in (1, 1, %BARLENGHT%) do (set EMPTYBAR=0!EMPTYBAR!)
  • for /L %%a in (1, 1, %BARLENGHT%) do (ping -n 1 -l 8 -w 8 -i 8 192.168.1.%%a >NUL && IF %ERRORLEVEL%==0 ECHO 192.168.1.%%a>>IPLIST.TXT
  • cls&&echo Shit-Simple-Ping-Based-Network-Scanner&&echo.&&echo Scanning: 192.168.1.%%a && echo. && set BAR=1!BAR!&& echo !BAR!!EMPTYBAR!&& set EMPTYBAR=!EMPTYBAR:~0,-1!&& echo. && echo Active IP addresses: && echo. && IF NOT EXIST IPLIST.TXT (echo NONE FOUND YET) ELSE type IPLIST.TXT)
  • cls&&echo Scan results:&&echo.&&type IPLIST.TXT&&echo.&&pause
Attached to this post a zip file containing the batch file (registered members only)
« Last Edit: October 02, 2016, 01:43:13 PM by HardcoreHacker »