summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorroot <root@krebs>2011-05-10 14:57:35 +0200
committerroot <root@krebs>2011-05-10 14:57:35 +0200
commit0ee5c8a24b4ea596ebed315270430dc69af2bcb9 (patch)
tree00eeae06dfe957e0463945155156300894d11d44 /modules
parentb9b5122481ed6fbf6899549e9936a76493e407e4 (diff)
fixed minor fuckup(refactoring error),logging
Diffstat (limited to 'modules')
-rwxr-xr-xmodules/people/src/arping.py4
-rwxr-xr-xmodules/people/src/arping_users.py13
2 files changed, 9 insertions, 8 deletions
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"