Ticket #144: geoip-nmap-modules-fixes.diff
| File geoip-nmap-modules-fixes.diff, 2.5 kB (added by stack.box@gmail.com, 3 months ago) |
|---|
-
scapy-2.0.0.10/scapy/modules/geoip.py
old new 52 52 ip=map(int,ip.split(".")) 53 53 ip = ip[3]+(ip[2]<<8L)+(ip[1]<<16L)+(ip[0]<<24L) 54 54 55 cloc = co untry_loc_kdb.get_base()56 db = IP_country_kdb.get_base()55 cloc = conf.country_loc_kdb.get_base() 56 db = conf.IP_country_kdb.get_base() 57 57 58 58 d=0 59 59 f=len(db)-1 -
scapy-2.0.0.10/scapy/modules/nmap.py
old new 6 6 from scapy.data import KnowledgeBase 7 7 from scapy.config import conf 8 8 9 conf.nmap_base ="/usr/share/nmap/nmap-os-fingerprints" 9 from scapy.layers.inet import * 10 11 conf.nmap_base = "/usr/share/nmap/nmap-os-fingerprints" 12 #conf.nmap_base = "/usr/share/nmap/nmap-os-db" 10 13 11 14 12 15 ###################### … … 22 25 return 23 26 24 27 self.base = [] 25 name = None28 sig = name = None 26 29 try: 27 for l in f :30 for l in f.readlines(): 28 31 l = l.strip() 29 32 if not l or l[0] == "#": 30 33 continue 31 if l [:12] == "Fingerprint ":32 if name is not None :34 if l.startswith("Fingerprint "): 35 if name is not None and sig is not None: 33 36 self.base.append((name,sig)) 34 37 name = l[12:].strip() 35 38 sig={} 36 39 p = self.base 37 40 continue 38 elif l[:6] == "Class ": 41 elif l.startswith("Class "): 42 continue 43 if not name: 39 44 continue 45 40 46 op = l.find("(") 41 47 cl = l.find(")") 42 48 if op < 0 or cl < 0: … … 48 54 for n,v in s: 49 55 si[n] = v 50 56 sig[test]=si 51 if name is not None :57 if name is not None and sig is not None: 52 58 self.base.append((name,sig)) 53 except :59 except Exception, err: 54 60 self.base = None 55 61 warning("Can't read nmap database [%s](new nmap version ?)" % self.filename) 56 62 f.close()