@echo off
rem Script by Adrian Puente Z.
rem Powered by Hackarandas www.hackarandas.com
rem Licensed by GNU GPLv3
rem http://www.gnu.org/licenses/gpl-3.0.txt
CLS 
ECHO.
ECHO         ..:: H4ckarandas ::..
ECHO   ----- Null Session Scanner -----
ECHO.

IF "%1"=="" GOTO NOARGUMENT
IF NOT EXIST %1 ECHO [-] File %1 Does not exist. && GOTO END

SET OUTFILE=validnullsession.txt
DEL %OUTFILE% >NUL 2>&1
FOR /F %%i in (%1) DO echo [+] %%i && net use \\%%i\IPC$ /user:"" "" 1>NUL 2>&1 && echo [*] %%i && ECHO %%i >> %OUTFILE% && net use /delete \\%%i\IPC$ > NUL
ECHO [*] The list of IPs with NULL session is: %OUTFILE%.


GOTO END
:NOARGUMENT
ECHO.
ECHO  Usage: %~n0  ip_list_file
ECHO.

:END