Input validation, show # targets attacked when completed

This commit is contained in:
derv82
2017-05-15 23:32:53 -04:00
parent e6c02bd98b
commit c23e228d3c
2 changed files with 7 additions and 3 deletions

View File

@@ -86,8 +86,10 @@ class Wifite(object):
else: else:
targets = s.select_targets() targets = s.select_targets()
attacked_targets = 0
targets_remaining = len(targets) targets_remaining = len(targets)
for index, t in enumerate(targets): for index, t in enumerate(targets):
attacked_targets += 1
targets_remaining -= 1 targets_remaining -= 1
Color.pl('\n{+} ({G}%d{W}/{G}%d{W})' % (index + 1, len(targets)) + Color.pl('\n{+} ({G}%d{W}/{G}%d{W})' % (index + 1, len(targets)) +
@@ -133,7 +135,7 @@ class Wifite(object):
if attack.success: if attack.success:
attack.crack_result.save() attack.crack_result.save()
Color.pl("{+} Finished attacking {C}%d{W} target(s), exiting" % len(targets)) Color.pl("{+} Finished attacking {C}%d{W} target(s), exiting" % attacked_targets)
def print_banner(self): def print_banner(self):

View File

@@ -169,11 +169,13 @@ class Scanner(object):
if '-' in choice: if '-' in choice:
# User selected a range # User selected a range
(lower,upper) = [int(x) - 1 for x in choice.split('-')] (lower,upper) = [int(x) - 1 for x in choice.split('-')]
for i in xrange(lower, upper): for i in xrange(lower, min(len(self.targets), upper)):
chosen_targets.append(self.targets[i]) chosen_targets.append(self.targets[i])
else: elif choice.isdigit():
choice = int(choice) - 1 choice = int(choice) - 1
chosen_targets.append(self.targets[choice]) chosen_targets.append(self.targets[choice])
else:
pass
return chosen_targets return chosen_targets