From 0ee5c8a24b4ea596ebed315270430dc69af2bcb9 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 10 May 2011 14:57:35 +0200 Subject: fixed minor fuckup(refactoring error),logging --- modules/people/src/arping.py | 4 +++- modules/people/src/arping_users.py | 13 ++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'modules/people/src') diff --git a/modules/people/src/arping.py b/modules/people/src/arping.py index 6c040969..eea176e0 100755 --- a/modules/people/src/arping.py +++ b/modules/people/src/arping.py @@ -2,6 +2,8 @@ import logging log = logging.getLogger('arpingy') +logging.disable(logging.WARNING) + import os,sys try: if (os.geteuid() != 0): @@ -12,7 +14,7 @@ try: log.debug("pinging "+ str(iprange)) """Arping function takes IP Address or Network, returns nested mac/ip list""" try: - conf.verb=0 + conf.verb=1 ans,unans=arping(iprange,iface=iface,timeout=1,retry=3) collection = [] diff --git a/modules/people/src/arping_users.py b/modules/people/src/arping_users.py index 1f936eba..d6f6826e 100755 --- a/modules/people/src/arping_users.py +++ b/modules/people/src/arping_users.py @@ -1,15 +1,14 @@ #!/usr/bin/python -from arping import arpingy import subprocess,re,logging + +from arping import arpingy from multiprocessing import Pool -logging.basicConfig(level=logging.ERROR) DEV='eth0' MAC_NAMES='mac_names.lst' data = [] ret = {} -names = load_names(FNAME) - +exit (0) def get_own_addr(): data = subprocess.Popen(['/sbin/ifconfig',DEV], stdout=subprocess.PIPE).communicate()[0].replace('\n','') @@ -20,9 +19,8 @@ def load_names(MAC_NAMES): names = {} f = open(MAC_NAMES) for l in f: - print l mac,name = l.split() - names[mac] = name + names[mac] = name.replace('\n','') f.close() return names @@ -33,6 +31,7 @@ for first in range(3): for second in range(255): data.append({'iprange':'10.42.'+str(first)+'.'+str(second),'iface':DEV}) +names = load_names(MAC_NAMES) try: p = Pool(20) ret = filter(lambda x:x , p.map(arping_helper, data)) @@ -46,4 +45,4 @@ except: for p in ret: if p[1] in names: - print name + " is online" + print names[p[1]]+ " is online" -- cgit v1.2.3