From 540caf9cef013b4ec8b3110d5e05ed60622c64be Mon Sep 17 00:00:00 2001
From: Dirk Loss <mail@dirk-loss.de>
Date: Tue, 12 Jan 2010 11:15:13 +0100
Subject: [PATCH] Fixed command line argument handling when using IPython

With IPython support enabled, any command line arguments
given to Scapy were incorrectly interpreted by the embedded
IPython shell as IPython command line arguments.
For example, "scapy -d" (to increase Scapy's debug level) did not work.
---
 scapy/main.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scapy/main.py b/scapy/main.py
index d50763f2..b8fc3f3a 100644
--- a/scapy/main.py
+++ b/scapy/main.py
@@ -308,7 +308,8 @@ def interact(mydict=None,argv=None,mybanner=None,loglevel=20):
         
     if IPYTHON:
         banner = the_banner % (conf.version) + " using IPython %s" % IPython.__version__
-        ipshell = IPython.Shell.IPShellEmbed(banner = banner)
+        args = ['']  # IPython command line args (will be seen as sys.argv)
+        ipshell = IPython.Shell.IPShellEmbed(args, banner = banner)
         ipshell(local_ns=session)
     else:
         code.interact(banner = the_banner % (conf.version),
-- 
GitLab