diff --git a/lanscan.py b/lanscan.py index a35613a..4de6f10 100644 --- a/lanscan.py +++ b/lanscan.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- + """ Author: skywebsys contact at gmail.com License: GPL v2 @@ -14,7 +16,8 @@ fin,fout=os.popen4("ip route list | grep proto | awk '{print $1}'") lan_network = fout.read() -wr = csv.writer(open('mac.csv', 'wb'), delimiter=',', quoting=csv.QUOTE_ALL) +f = open('mac.csv', 'wb') +wr = csv.writer(f, delimiter=',', quoting=csv.QUOTE_ALL) try: alive,dead=srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=lan_network), timeout=2, verbose=1) @@ -29,3 +32,6 @@ pass +f.close() + +