diff options
-rw-r--r-- | autoscan/autoscan.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/autoscan/autoscan.py b/autoscan/autoscan.py new file mode 100644 index 0000000..0c9a06b --- /dev/null +++ b/autoscan/autoscan.py @@ -0,0 +1,30 @@ +#!/bin/env python + +# autoscan - keep logs of visited networks +# XXX IN PROGRESS 20130721 laurent +# 2013, Laurent Ghigonis <laurent@gouloum.fr> + +# Each time internet connectivity become available after a cut-off, +# keep a log of the following +# * ifconfig +# * if WIFI, iwconfig +# * route -n +# * traceroute +# * local net IP scan + +import subprocess + +TARGET = "8.8.8.8" +LOG = "autoscan.log" + +log = open(LOG, "a") + +res = -1 +while True: + res = subprocess.call(['ping', '-W', '1', '-c', '1', TARGET]) + if res == 0: + print "ping to", address, "OK" + elif res == 2: + print "no response from", address + else: + print "ping to", address, "failed!" |