From 804463e5329eeba96b4eb3e20b3911317492088f Mon Sep 17 00:00:00 2001 From: Phil <phil@secdev.org> Date: Tue, 4 Dec 2007 20:10:02 +0100 Subject: [PATCH] Added StopAutorun exception and code managing it StopAutorun can be raised in a piece of code aimed at being autorun and will not be catched by autorun_* functions --- scapy.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scapy.py b/scapy.py index 1d657489..9e90ed62 100755 --- a/scapy.py +++ b/scapy.py @@ -13250,6 +13250,8 @@ country_loc_kdb = CountryLocKnowledgeBase(conf.countryLoc_base) ##### Autorun stuff ##### ######################### +class StopAutorun(Scapy_Exception): + pass class ScapyAutorunInterpreter(code.InteractiveInterpreter): def __init__(self, *args, **kargs): @@ -13260,6 +13262,9 @@ class ScapyAutorunInterpreter(code.InteractiveInterpreter): return code.InteractiveInterpreter.showsyntaxerror(self, *args, **kargs) def showtraceback(self, *args, **kargs): self.error = 1 + exc_type, exc_value, exc_tb = sys.exc_info() + if isinstance(exc_value, StopAutorun): + raise exc_value return code.InteractiveInterpreter.showtraceback(self, *args, **kargs) -- GitLab