diff --git a/scapy/arch.py b/scapy/arch.py index 7d1f70510b4d44ee3ff6961ec1aaf661380c7b6f..7e48272c1013fa3ab96346bc365b7630a89b9a60 100644 --- a/scapy/arch.py +++ b/scapy/arch.py @@ -2,7 +2,8 @@ import sys,os,struct,socket,time from fcntl import ioctl from data import * -from config import conf + +import config try: import Gnuplot @@ -177,7 +178,7 @@ else: if not TCPDUMP: return try: - f = os.popen("%s -i %s -ddd -s 1600 '%s'" % (conf.prog.tcpdump,conf.iface,filter)) + f = os.popen("%s -i %s -ddd -s 1600 '%s'" % (config.conf.prog.tcpdump,config.conf.iface,filter)) except OSError,msg: log_interactive.warning("Failed to execute tcpdump: (%s)") return @@ -379,7 +380,7 @@ if 0 and DNET: ## XXX Can't use this because it does not resolve IPs not in cach tmp = map(ord, inet_aton(ip)) if (tmp[0] & 0xf0) == 0xe0: # mcast @ return "01:00:5e:%.2x:%.2x:%.2x" % (tmp[1]&0x7f,tmp[2],tmp[3]) - iff,a,gw = conf.route.route(ip) + iff,a,gw = config.conf.route.route(ip) if iff == "lo": return "ff:ff:ff:ff:ff:ff" if gw != "0.0.0.0": @@ -394,14 +395,14 @@ else: tmp = map(ord, inet_aton(ip)) if (tmp[0] & 0xf0) == 0xe0: # mcast @ return "01:00:5e:%.2x:%.2x:%.2x" % (tmp[1]&0x7f,tmp[2],tmp[3]) - iff,a,gw = conf.route.route(ip) - if ( (iff == "lo") or (ip == conf.route.get_if_bcast(iff)) ): + iff,a,gw = config.conf.route.route(ip) + if ( (iff == "lo") or (ip == config.conf.route.get_if_bcast(iff)) ): return "ff:ff:ff:ff:ff:ff" if gw != "0.0.0.0": ip = gw - if conf.arp_cache.has_key(ip): - mac, timeout = conf.arp_cache[ip] + if config.conf.arp_cache.has_key(ip): + mac, timeout = config.conf.arp_cache[ip] if not timeout or (time.time()-timeout < ARPTIMEOUT): return mac @@ -414,7 +415,7 @@ else: nofilter=1) if res is not None: mac = res.payload.hwsrc - conf.arp_cache[ip] = (mac,time.time()) + config.conf.arp_cache[ip] = (mac,time.time()) return mac return None diff --git a/scapy/base_classes.py b/scapy/base_classes.py index bf151bd5f25ebd3e5d0e440c71618cfaf8b86006..30f91738987c0d4b30a879d30138293eb1b2ba0b 100644 --- a/scapy/base_classes.py +++ b/scapy/base_classes.py @@ -166,3 +166,6 @@ class BasePacket(Gen): class BasePacketList: pass + + + diff --git a/scapy/config.py b/scapy/config.py index 5d7872fffaf698a8ac519d7aade6c950b20aa972..e97ee34d95fe2f2bb60daeb6f24b2a380d50a4aa 100644 --- a/scapy/config.py +++ b/scapy/config.py @@ -1,8 +1,7 @@ import os -from arch import * from data import * -from themes import * import base_classes +import arch,themes ############ ## Config ## @@ -138,7 +137,7 @@ extensions_paths: path or list of paths where extensions are to be looked for version = "2.0.0.1 alpha" session = "" stealth = "not implemented" - iface = get_working_if() + iface = arch.get_working_if() layers = LayersList() checkIPID = 0 checkIPsrc = 1 @@ -161,7 +160,7 @@ extensions_paths: path or list of paths where extensions are to be looked for route = None # Filed by arch auto_fragment = 1 debug_dissector = 0 - color_theme = DefaultTheme() + color_theme = themes.DefaultTheme() warning_threshold = 5 prog = ProgPath() resolve = Resolve() diff --git a/scapy/fields.py b/scapy/fields.py index b402ac391ae3acd7b371e162f41dd51d082c1128..6cf178f9c2a4d86bbf88a817d571ebd1a2f64252 100644 --- a/scapy/fields.py +++ b/scapy/fields.py @@ -3,7 +3,7 @@ from config import conf from volatile import VolatileValue from data import * from utils import * -from base_classes import BasePacket +from base_classes import BasePacket,Gen,Net ############ diff --git a/scapy/themes.py b/scapy/themes.py index e7676cce1efc6b82083faa6bd1ab7d33fbcf28aa..2dc6a860f758374760b1ffe26067aec9421f61e4 100644 --- a/scapy/themes.py +++ b/scapy/themes.py @@ -1,4 +1,4 @@ -from config import conf +import config ################## ## Color themes ## @@ -237,12 +237,12 @@ class ColorPrompt: __prompt = ">>> " def __str__(self): try: - ct = conf.color_theme + ct = config.conf.color_theme if isinstance(ct, AnsiColorTheme): ## ^A and ^B delimit invisible caracters for readline to count right - return "\001%s\002" % ct.prompt("\002"+conf.prompt+"\001") + return "\001%s\002" % ct.prompt("\002"+config.conf.prompt+"\001") else: - return ct.prompt(conf.prompt) + return ct.prompt(config.conf.prompt) except: return self.__prompt