mirror of https://github.com/secdev/scapy.git
- added threshold for warnings
This commit is contained in:
parent
e7ec66355a
commit
97e3fb4755
30
scapy.py
30
scapy.py
|
@ -21,6 +21,9 @@
|
||||||
|
|
||||||
#
|
#
|
||||||
# $Log: scapy.py,v $
|
# $Log: scapy.py,v $
|
||||||
|
# Revision 0.9.17.77 2005/04/23 13:36:15 pbi
|
||||||
|
# - added threshold for warnings
|
||||||
|
#
|
||||||
# Revision 0.9.17.76 2005/04/23 11:27:51 pbi
|
# Revision 0.9.17.76 2005/04/23 11:27:51 pbi
|
||||||
# - Renamed SndRcvAns into SndRcvList
|
# - Renamed SndRcvAns into SndRcvList
|
||||||
#
|
#
|
||||||
|
@ -715,7 +718,7 @@
|
||||||
|
|
||||||
from __future__ import generators
|
from __future__ import generators
|
||||||
|
|
||||||
RCSID="$Id: scapy.py,v 0.9.17.76 2005/04/23 11:27:51 pbi Exp $"
|
RCSID="$Id: scapy.py,v 0.9.17.77 2005/04/23 13:36:15 pbi Exp $"
|
||||||
|
|
||||||
VERSION = RCSID.split()[2]+"beta"
|
VERSION = RCSID.split()[2]+"beta"
|
||||||
|
|
||||||
|
@ -1035,7 +1038,30 @@ def checksum(pkt):
|
||||||
s += s >> 16
|
s += s >> 16
|
||||||
return ~s & 0xffff
|
return ~s & 0xffff
|
||||||
|
|
||||||
|
|
||||||
|
warning_table = {}
|
||||||
|
|
||||||
def warning(x):
|
def warning(x):
|
||||||
|
wt = conf.warning_threshold
|
||||||
|
if wt > 0:
|
||||||
|
stk = traceback.extract_stack(limit=1)
|
||||||
|
caller = stk[0][1]
|
||||||
|
tm,nb = warning_table.get(caller, (0,0))
|
||||||
|
ltm = time.time()
|
||||||
|
if ltm-tm > wt:
|
||||||
|
tm = ltm
|
||||||
|
nb = 0
|
||||||
|
else:
|
||||||
|
if nb < 2:
|
||||||
|
nb += 1
|
||||||
|
if nb == 2:
|
||||||
|
x = "more "+x
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
warning_table[caller] = (tm,nb)
|
||||||
|
|
||||||
|
|
||||||
|
print
|
||||||
print "WARNING:",x
|
print "WARNING:",x
|
||||||
|
|
||||||
|
|
||||||
|
@ -7475,6 +7501,7 @@ padding : includes padding in desassembled packets
|
||||||
except_filter : BPF filter for packets to ignore
|
except_filter : BPF filter for packets to ignore
|
||||||
debug_match : when 1, store received packet that are not matched into debug.recv
|
debug_match : when 1, store received packet that are not matched into debug.recv
|
||||||
route : holds the Scapy routing table and provides methods to manipulate it
|
route : holds the Scapy routing table and provides methods to manipulate it
|
||||||
|
warning_threshold : how much time between warnings from the same place
|
||||||
"""
|
"""
|
||||||
session = ""
|
session = ""
|
||||||
stealth = "not implemented"
|
stealth = "not implemented"
|
||||||
|
@ -7503,6 +7530,7 @@ route : holds the Scapy routing table and provides methods to manipulate it
|
||||||
wepkey = ""
|
wepkey = ""
|
||||||
debug_dissector = 0
|
debug_dissector = 0
|
||||||
color_theme = DefaultTheme
|
color_theme = DefaultTheme
|
||||||
|
warning_threshold = 5
|
||||||
|
|
||||||
|
|
||||||
conf=Conf()
|
conf=Conf()
|
||||||
|
|
Loading…
Reference in New Issue