aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-07-22 17:29:11 +0200
committerLaurent Ghigonis <laurent@p1sec.com>2013-07-22 17:29:11 +0200
commitca737ae83ee6f3af257eb003ffcf09b837a172ff (patch)
tree3a78239add7372b87201cc98d9c1df5b22e4f7e1
parentautoscan: some code and add tests (diff)
downloadlaurent-tools-ca737ae83ee6f3af257eb003ffcf09b837a172ff.tar.xz
laurent-tools-ca737ae83ee6f3af257eb003ffcf09b837a172ff.zip
autoscan: almost done
-rwxr-xr-xautoscan/tests/spoofbin/curl3
-rwxr-xr-xautoscan/tests/spoofbin/nmap16
-rwxr-xr-xautoscan/tests/spoofbin/traceroute18
-rwxr-xr-xautoscan/tests/test_autoscan.sh13
4 files changed, 46 insertions, 4 deletions
diff --git a/autoscan/tests/spoofbin/curl b/autoscan/tests/spoofbin/curl
new file mode 100755
index 0000000..f3788e4
--- /dev/null
+++ b/autoscan/tests/spoofbin/curl
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo "1.2.3.4"
diff --git a/autoscan/tests/spoofbin/nmap b/autoscan/tests/spoofbin/nmap
new file mode 100755
index 0000000..50bfb50
--- /dev/null
+++ b/autoscan/tests/spoofbin/nmap
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+oa=""
+while true; do
+ case $1 in
+ -oA) oa=$2; shift ;;
+ *) shift ;;
+ esac
+ [[ $# -eq 1 ]] && break
+done
+
+if [ X"$oa" != X"" ]; then
+ touch $oa/localnet.xml
+ touch $oa/localnet.gnmap
+ touch $oa/localnet.nmap
+fi
diff --git a/autoscan/tests/spoofbin/traceroute b/autoscan/tests/spoofbin/traceroute
new file mode 100755
index 0000000..36546a5
--- /dev/null
+++ b/autoscan/tests/spoofbin/traceroute
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+echo "traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
+ 1 10.137.2.1 (10.137.2.1) 0.781 ms 0.683 ms 0.608 ms
+ 2 172.28.194.1 (172.28.194.1) 115.733 ms 115.752 ms 115.763 ms
+ 3 * * *
+ 4 * * *
+ 5 bhs-g2-6k.qc.ca (198.27.73.15) 124.822 ms 125.331 ms 129.664 ms
+ 6 198.27.73.206 (198.27.73.206) 139.953 ms * *
+ 7 ash-1-6k.va.us (178.32.135.233) 124.985 ms 134.881 ms *
+ 8 198.27.73.105 (198.27.73.105) 182.568 ms 182.509 ms 182.519 ms
+ 9 216.239.46.250 (216.239.46.250) 138.474 ms 216.239.46.248 (216.239.46.248) 137.078 ms 216.239.46.250 (216.239.46.250) 123.555 ms
+10 72.14.236.146 (72.14.236.146) 124.983 ms 72.14.236.148 (72.14.236.148) 121.850 ms 127.460 ms
+11 72.14.235.12 (72.14.235.12) 131.885 ms 133.096 ms 133.784 ms
+12 72.14.234.53 (72.14.234.53) 133.715 ms 72.14.234.55 (72.14.234.55) 133.535 ms 72.14.234.67 (72.14.234.67) 135.416 ms
+13 * * *
+14 google-public-dns-a.google.com (8.8.8.8) 131.568 ms 131.605 ms 133.601 ms
+"
diff --git a/autoscan/tests/test_autoscan.sh b/autoscan/tests/test_autoscan.sh
index bea2c34..816646f 100755
--- a/autoscan/tests/test_autoscan.sh
+++ b/autoscan/tests/test_autoscan.sh
@@ -5,15 +5,20 @@ err() {
exit 1
}
-export PATH="./spoofbin/:$PATH"
-
-../autoscan.py -f -o test_output/ -r eth0 ||err "autoscan execution failed"
+sudo PATH="./spoofbin/:$PATH" ../autoscan.py -v -f -p 127.0.0.1 -o test_output/ -r eth0 ||err "autoscan execution failed"
# XXX test output dirs
dir="test_output/$(ls -1 test_output |tail -n1)"
-[[ $(cat $dir/route/gw) = "10.137.2.1" ]] ||err "route/gw"
+[[ -e $dir/pcap/tcpdump.pcap ]] ||err "pcap/tcpdump.pcap"
[[ $(cat $dir/ifconfig/ip4) = "10.137.2.9" ]] ||err "ifconfig/ip4"
[[ $(cat $dir/ifconfig/ip6) = "fe80::216:3eff:fe5e:6c07" ]] ||err "ifconfig/ip6"
+[[ $(cat $dir/route/gw) = "10.137.2.1" ]] ||err "route/gw"
[[ $(cat $dir/pubip_ping/code) = "0" ]] ||err "pubip_ping/code"
+[[ -e $dir/resolv/resolv.conf ]] ||err "resolv/resolv.conf"
+[[ $(cat $dir/pubip_get/ip) = "1.2.3.4" ]] ||err "pubip_get/ip"
+[[ -e $dir/pubip_traceroute/out ]] ||err "pubip_traceroute/out"
+[[ -e $dir/resolv_traceroute/out ]] ||err "resolv_traceroute/out"
+[[ -e "$dir/explor_traceroute/out_192.168.0.1" ]] ||err "explor_traceroute/out_192.168.0.1"
+[[ -e $dir/explor_scan/localnet.nmap ]] ||err "explor_scan/localnet.nmap"
echo "TEST OK"