Skip to content

Commit

Permalink
Initial test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed May 6, 2019
1 parent 0455b73 commit f9dcd31
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#Tests for Npcap.

Requirements:

* Npcap installed
* Nmap installed
* Some examples from the SDK

##SDK examples required

From `Examples-pcap`:

* iflist.exe
* pcap_filter.exe
* sendpack.exe
* readfile.exe

From `Examples-remote`:

* sendcap.exe
38 changes: 38 additions & 0 deletions test/make_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
echo Testing iflist...
for /f "TOKENS=1,2" %%a in ('nmap --iflist') do @if %%a==lo0 set devname=%%b
if not %devname:~0,12%==\Device\NPF_ goto :error
.\iflist.exe

echo Testing Loopback operations...
echo Testing pcap_filter...
del loopback.pcap
start .\pcap_filter.exe -o loopback.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...
nmap -F -O -d -n localhost || goto :error
nmap -F -O -d -n -6 localhost || goto :error

echo Testing sendpack...
.\sendpack.exe %devname% || goto :error

echo Killing pcap_filter...
taskkill /PID %SAVEPID% || goto :error

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

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


echo Running nmap...
nmap -F -O -d -n scanme.nmap.org || goto :error

pause
exit

:error
echo Failed: %errorlevel%
pause
exit /b %errorlevel%

0 comments on commit f9dcd31

Please sign in to comment.