From 12c77cdbfa4ec48d935af3ae7cf1118e38bec6e1 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 29 May 2011 15:47:21 +0200 Subject: lowered filesystem hierarchy--everything are modules --- modules/people/Makefile | 6 ----- modules/people/README.md | 13 ---------- modules/people/TODO.md | 3 --- modules/people/VERSION | 1 - modules/people/arping.py | 37 ----------------------------- modules/people/arping_users.py | 54 ------------------------------------------ modules/people/mac_names.lst | 1 - 7 files changed, 115 deletions(-) delete mode 100644 modules/people/Makefile delete mode 100644 modules/people/README.md delete mode 100644 modules/people/TODO.md delete mode 100644 modules/people/VERSION delete mode 100755 modules/people/arping.py delete mode 100755 modules/people/arping_users.py delete mode 100644 modules/people/mac_names.lst (limited to 'modules/people') diff --git a/modules/people/Makefile b/modules/people/Makefile deleted file mode 100644 index 2c6c1c03..00000000 --- a/modules/people/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -.phony: all - -all: arping.py arping_users.py - echo "call python ./arping_users.py v" -install: - apt-get install python-scapy diff --git a/modules/people/README.md b/modules/people/README.md deleted file mode 100644 index e45d39c1..00000000 --- a/modules/people/README.md +++ /dev/null @@ -1,13 +0,0 @@ -ARPING Users -========== - -This is a simplified python script which checks the available subnet for computers online and returns a list of users which are online based on their mac-address - - -arping_users.py: - call `python arping_users.py v` for verbose output -> print all discovered hosts - -SNMPWALK Command -=============== - -snmpwalk -c shammunity 10.42.0.1 1.3.6.1.2.1.3.1.1.2 diff --git a/modules/people/TODO.md b/modules/people/TODO.md deleted file mode 100644 index daacfd58..00000000 --- a/modules/people/TODO.md +++ /dev/null @@ -1,3 +0,0 @@ -BUGS -===== - diff --git a/modules/people/VERSION b/modules/people/VERSION deleted file mode 100644 index 6c50e659..00000000 --- a/modules/people/VERSION +++ /dev/null @@ -1 +0,0 @@ -+++++++[>+++++++>+++++++<<-]>.>---.<-. diff --git a/modules/people/arping.py b/modules/people/arping.py deleted file mode 100755 index 1b51ab1b..00000000 --- a/modules/people/arping.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python - -import logging -log = logging.getLogger('arpingy') -logging.disable(logging.WARNING) - -import os,sys -try: - if (os.geteuid() != 0): - raise Exception('no root permissions') - from scapy.all import * #might throws "no such module" - - def arpingy(iprange="10.42.1.0/24",iface='eth0'): - log.debug("pinging "+ str(iprange)) - """Arping function takes IP Address or Network, returns nested mac/ip list""" - try: - conf.verb=0 - ans,unans=arping(iprange,iface=iface,timeout=1,retry=3) - - collection = [] - for snd, rcv in ans: - result = rcv.sprintf(r"%ARP.psrc% %Ether.src%").split() - log.debug(result) - return result # take just the first arp reply - except Exception as e: - print ("something went wrong while arpinging " + str(e)) - return [] - -except Exception as e: - log.error("Cannot load arping functions!" + str(e)) - def arpingy(iprange='',iface=''): - raise Exception ('arping not available') - - -if __name__ =='__main__': - logging.basicConfig(level=logging.DEBUG) - arpingy(sys.argv[1],sys.argv[2]) diff --git a/modules/people/arping_users.py b/modules/people/arping_users.py deleted file mode 100755 index c576e4f3..00000000 --- a/modules/people/arping_users.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/python -import subprocess,re,logging,sys - -from arping import arpingy -from multiprocessing import Pool -DEV='eth0' -MAC_NAMES='mac_names.lst' -data = [] -ret = {} -verb = False - -if len(sys.argv) > 1 and sys.argv[1] == 'v': - verb = True -def get_own_addr(): - data = subprocess.Popen(['/sbin/ifconfig',DEV], - stdout=subprocess.PIPE).communicate()[0].replace('\n','') - return re.sub(r'.*HWaddr ([0-9A-Fa-f:]*).*inet addr:([0-9.]*).*' , - r'\1 \2',data).split() - -def load_names(MAC_NAMES): - names = {} - f = open(MAC_NAMES) - for l in f: - mac,name = l.split() - names[mac] = name.replace('\n','') - f.close() - return names - -def arping_helper(dic): - return arpingy(**dic) - -for first in range(4): - 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)) - myip,mymac = get_own_addr() - ret.append([mymac,myip]) - p.terminate() -except Exception as e: - print 'you fail '+str(e) - - - -for p in ret: - if verb: - print p[0] + " => " + p[1] - if p[1] in names: - print names[p[1]]+ " is online" - - diff --git a/modules/people/mac_names.lst b/modules/people/mac_names.lst deleted file mode 100644 index dcd3c2b0..00000000 --- a/modules/people/mac_names.lst +++ /dev/null @@ -1 +0,0 @@ -00:40:63:c8:b5:a0 krebs -- cgit v1.2.3