From 7309dfcce6626cb62e827c9a0fcd47d138b52da7 Mon Sep 17 00:00:00 2001 From: derv82 Date: Sun, 2 Sep 2018 09:58:26 -0700 Subject: [PATCH] Interrupting mid-attack, users can Continue/Skip/Exit. --- wifite/attack/all.py | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/wifite/attack/all.py b/wifite/attack/all.py index e1b3e3e..3eeb728 100755 --- a/wifite/attack/all.py +++ b/wifite/attack/all.py @@ -85,8 +85,13 @@ class AttackAll(object): continue except KeyboardInterrupt: Color.pl('\n{!} {O}Interrupted{W}\n') - if not cls.user_wants_to_continue(targets_remaining, len(attacks)): - return False # Stop attacking other targets + answer = cls.user_wants_to_continue(targets_remaining, len(attacks)) + if answer is True: + continue # Keep attacking the same target (continue) + elif answer is None: + return True # Keep attacking other targets (skip) + else: + return False # Stop all attacks (exit) if attack.success: attack.crack_result.save() @@ -109,15 +114,30 @@ class AttackAll(object): prompt_list.append(Color.s('{C}%d{W} attack(s)' % attacks_remaining)) if targets_remaining > 0: prompt_list.append(Color.s('{C}%d{W} target(s)' % targets_remaining)) - prompt = ' and '.join(prompt_list) - Color.pl('{+} %s remain, Do you want to continue?' % prompt) + prompt = ' and '.join(prompt_list) + ' remain' + Color.pl('{+} %s' % prompt) - prompt = Color.s('{+} Type {G}c{W} to {G}continue{W}' + - ' or {R}s{W} to {R}stop{W}: ') + prompt = '{+} Do you want to' + options = '(' + + if attacks_remaining > 0: + prompt += ' {G}continue{W} attacking,' + options += '{G}C{W}{D}, {W}' + + if targets_remaining > 0: + prompt += ' {O}skip{W} to the next target,' + options += '{O}s{W}{D}, {W}' + + options += '{R}e{W})' + prompt += ' or {R}exit{W} %s? {C}' % options from ..util.input import raw_input - if raw_input(prompt).lower().startswith('s'): - return False - else: - return True + answer = raw_input(Color.s(prompt)).lower() + + if answer.startswith('s'): + return None # Skip + elif answer.startswith('e'): + return False # Exit + else: + return True # Continue