MCPcopy Index your code
hub / github.com/secdev/scapy / interact

Function interact

scapy/main.py:646–946  ·  view source on GitHub ↗

Starts Scapy's console.

(mydict=None,
             argv=None,
             mybanner=None,
             mybanneronly=False,
             loglevel=logging.INFO)

Source from the content-addressed store, hash-verified

644
645
646def interact(mydict=None,
647 argv=None,
648 mybanner=None,
649 mybanneronly=False,
650 loglevel=logging.INFO):
651 # type: (Optional[Any], Optional[Any], Optional[Any], bool, int) -> None
652 """
653 Starts Scapy's console.
654 """
655 # We're in interactive mode, let's throw the DeprecationWarnings
656 warnings.simplefilter("always")
657
658 # Set interactive mode, load the color scheme
659 from scapy.config import conf
660 conf.interactive = True
661 conf.color_theme = DefaultTheme()
662 if loglevel is not None:
663 conf.logLevel = loglevel
664
665 STARTUP_FILE = DEFAULT_STARTUP_FILE
666 PRESTART_FILE = DEFAULT_PRESTART_FILE
667
668 if argv is None:
669 argv = sys.argv
670
671 try:
672 opts = getopt.getopt(argv[1:], "hs:Cc:Pp:d:H")
673 for opt, param in opts[0]:
674 if opt == "-h":
675 _usage()
676 elif opt == "-H":
677 conf.fancy_banner = False
678 conf.verb = 1
679 conf.logLevel = logging.WARNING
680 elif opt == "-c":
681 STARTUP_FILE = param
682 elif opt == "-C":
683 STARTUP_FILE = None
684 elif opt == "-p":
685 PRESTART_FILE = param
686 elif opt == "-P":
687 PRESTART_FILE = None
688 elif opt == "-d":
689 conf.logLevel = max(1, conf.logLevel - 10)
690
691 if len(opts[1]) > 0:
692 raise getopt.GetoptError(
693 "Too many parameters : [%s]" % " ".join(opts[1])
694 )
695
696 except getopt.GetoptError as msg:
697 log_loading.error(msg)
698 sys.exit(1)
699
700 # Reset sys.argv, otherwise IPython thinks it is for him
701 sys.argv = sys.argv[:1]
702
703 if PRESTART_FILE:

Callers 11

__main__.pyFile · 0.90
__init__.pyFile · 0.90
dropFunction · 0.90
tacacs.pyFile · 0.90
rtr.pyFile · 0.90
skinny.pyFile · 0.90
vtp.pyFile · 0.90
ospf.pyFile · 0.90
ms_nrtp.pyFile · 0.90
main.pyFile · 0.85

Calls 12

DefaultThemeClass · 0.90
BlackAndWhiteClass · 0.90
apply_ipython_styleFunction · 0.90
_usageFunction · 0.85
_read_config_fileFunction · 0.85
_scapy_prestart_builtinsFunction · 0.85
init_sessionFunction · 0.85
get_fancy_bannerFunction · 0.85
_check_permsFunction · 0.85
joinMethod · 0.80
loadallMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected