Added tests

This commit is contained in:
Jonny007-MKD 2020-02-28 20:56:56 +01:00 committed by root
parent f35340ff25
commit 079723e951
3 changed files with 48 additions and 0 deletions

23
test/run.sh Executable file
View File

@ -0,0 +1,23 @@
dir="`dirname $0`"
ERROR=false
for f in `ls $dir/*.input`; do
RESULT="`$dir/../check_nmap.sh --input $f --known 25 --known 80`"
EXPECTED="`cat $dir/$(basename $f .input).output`"
if [ "$RESULT" != "$EXPECTED" ]; then
echo "Error for test $(basename $f .input):"
echo " Expected"
echo " '$EXPECTED'"
echo " and got"
echo " '$RESULT'"
ERROR=true
fi
done
if $ERROR; then
exit 1;
else
echo "Tests passed."
exit 0;
fi

23
test/yello1.input Normal file
View File

@ -0,0 +1,23 @@
Starting Nmap 7.70 ( https://nmap.org ) at 2020-02-27 21:08 CET
Nmap scan report for nordlichter-brv.de (217.79.178.131)
Host is up (0.030s latency).
Other addresses for nordlichter-brv.de (not scanned): 2001:4ba0:cafe:9d3::1
Not shown: 65520 closed ports
PORT STATE SERVICE
25/tcp open smtp
80/tcp open http
135/tcp filtered msrpc
137/tcp filtered netbios-ns
138/tcp filtered netbios-dgm
139/tcp filtered netbios-ssn
143/tcp open imap
443/tcp open https
445/tcp filtered microsoft-ds
587/tcp open submission
993/tcp open imaps
5355/tcp filtered llmnr
5665/tcp open unknown
32022/tcp open unknown
32119/tcp open unknown
Nmap done: 1 IP address (1 host up) scanned in 80.69 seconds

2
test/yello1.output Normal file
View File

@ -0,0 +1,2 @@
CRITICAL - These ports should not be open: 143 443 587 993 5665 32022 32119 | 'smtp (25): open'=0 'http (80): open'=0 'msrpc (135): filtered'=0 'netbios-ns (137): filtered'=0 'netbios-dgm (138): filtered'=0 'netbios-ssn (139): filtered'=0 'imap (143): open'=0 'https (443): open'=0 'microsoft-ds (445): filtered'=0 'submission (587): open'=0 'imaps (993): open'=0 'llmnr (5355): filtered'=0 'unknown (5665): open'=0 'unknown (32022): open'=0 'unknown (32119): open'=0