#NEWLINE# def autorun_commands( cmds , my_globals = None , verb = 0 ) : #NEWLINE# #INDENT# sv = conf . verb #NEWLINE# import builtins #NEWLINE# try : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( my_globals is None ) : #NEWLINE# #INDENT# my_globals = __import__ ( 'scapy.all' ) . all . __dict__ #NEWLINE# #UNINDENT# conf . verb = verb #NEWLINE# interp = ScapyAutorunInterpreter ( my_globals ) #NEWLINE# cmd = '' #NEWLINE# cmds = cmds . splitlines ( ) #NEWLINE# cmds . append ( '' ) #NEWLINE# cmds . reverse ( ) #NEWLINE# builtins . __dict__ [ '_' ] = None #NEWLINE# while 1 : #NEWLINE# #INDENT# if cmd : #NEWLINE# #INDENT# sys . stderr . write ( sys . __dict__ . get ( 'ps2' , '... ' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sys . stderr . write ( str ( sys . __dict__ . get ( 'ps1' , ColorPrompt ( ) ) ) ) #NEWLINE# #UNINDENT# l = cmds . pop ( ) #NEWLINE# print ( l ) #NEWLINE# cmd += ( '\n' + l ) #NEWLINE# if interp . runsource ( cmd ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if interp . error : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# cmd = '' #NEWLINE# if ( len ( cmds ) <= 1 ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except SystemExit : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# conf . verb = sv #NEWLINE# #UNINDENT# return _