Skip to content

Commit

Permalink
Keep pcaps for all tested archs in test dir; Additional checks for in…
Browse files Browse the repository at this point in the history
…terface names
  • Loading branch information
bonsaiviking committed May 23, 2022
1 parent 35d8791 commit 453c94c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions test/make_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ goto :quit
:DO_TEST

echo Testing iflist...
set devname=""
for /f "TOKENS=1,2" %%a in ('nmap --iflist') do @if %%a==lo0 set devname=%%b
if not "%devname%"=="\Device\NPF_Loopback" goto :error
.\%1\iflist.exe || goto :error

echo Testing Loopback operations...
echo Testing pcap_filter...
del loopback.pcap
start .\%1\pcap_filter.exe -o loopback.pcap -s %devname% -f tcp
del loopback-%1.pcap
start .\%1\pcap_filter.exe -o loopback-%1.pcap -s %devname% -f tcp
for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq pcap_filter.exe"') do set SAVEPID=%%b
if "%SAVEPID%" == "" goto :error

Expand All @@ -61,21 +62,23 @@ taskkill /PID %SAVEPID% || goto :error
SET SAVEPID=0

echo Reading dump file...
.\%1\readfile.exe loopback.pcap || goto :error
.\%1\readfile.exe loopback-%1.pcap || goto :error

echo Replaying dump file...
.\%1\sendcap.exe loopback.pcap %devname% || goto :error
.\%1\sendcap.exe loopback-%1.pcap %devname% || goto :error


echo Checking for Internet...
set devname=""
for /f "TOKENS=1,3" %%a in ('nmap --route-dst scanme.nmap.org') do @if %%b==srcaddr set ifname=%%a
if %ifname%=="" goto :error
if %ifname%=="No" goto :error
for /f "TOKENS=1,2" %%a in ('nmap --iflist') do @if %%a==%ifname% set devname=%%b
if not %devname:~0,12%==\Device\NPF_ goto :error

echo Testing pcap_filter...
del scanme.pcap
start .\%1\pcap_filter.exe -o scanme.pcap -s %devname% -f tcp
del scanme-%1.pcap
start .\%1\pcap_filter.exe -o scanme-%1.pcap -s %devname% -f tcp
for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq pcap_filter.exe"') do set SAVEPID=%%b

echo Running nmap...
Expand All @@ -91,9 +94,9 @@ taskkill /PID %SAVEPID% || goto :error
SET SAVEPID=0

echo Reading dump file...
.\%1\readfile.exe scanme.pcap || goto :error
.\%1\readfile.exe scanme-%1.pcap || goto :error

echo Replaying dump file...
.\%1\sendcap.exe scanme.pcap %devname% || goto :error
.\%1\sendcap.exe scanme-%1.pcap %devname% || goto :error

goto :EOF

0 comments on commit 453c94c

Please sign in to comment.