File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,19 @@ def load_exploits(path, node="exploits"):
4848 """
4949 retval = []
5050 file_list = os .listdir (path )
51+ selected = False
5152 if len (file_list ) != 1 :
5253 lib .output .info ("total of {} exploit files discovered for use, select one:" .format (len (file_list )))
53- for i , f in enumerate (file_list , start = 1 ):
54- print ("{}. '{}'" .format (i , f [:- 5 ]))
55- action = raw_input (lib .settings .AUTOSPLOIT_PROMPT )
56- selected_file = file_list [int (action ) - 1 ]
54+ while not selected :
55+ for i , f in enumerate (file_list , start = 1 ):
56+ print ("{}. '{}'" .format (i , f [:- 5 ]))
57+ action = raw_input (lib .settings .AUTOSPLOIT_PROMPT )
58+ try :
59+ selected_file = file_list [int (action ) - 1 ]
60+ selected = True
61+ except Exception :
62+ lib .output .warning ("invalid selection ('{}'), select from below" .format (action ))
63+ selected = False
5764 else :
5865 selected_file = file_list [0 ]
5966
You can’t perform that action at this time.
0 commit comments