The start parameter for enumerate()

Since python version 2.6 the start parameter was added and can be used
This commit is contained in:
deix
2017-08-28 18:14:09 +02:00
parent 00e5246f96
commit dbc0d995e3
5 changed files with 12 additions and 14 deletions

View File

@@ -47,8 +47,8 @@ class Wifite(object):
return
with open(name, 'r') as fid:
json = loads(fid.read())
for (index, item) in enumerate(json):
Color.pl('\n{+} Cracked target #%d:' % (index + 1))
for idx, item in enumerate(json, start=1):
Color.pl('\n{+} Cracked target #%d:' % (idx))
cr = CrackResult.load(item)
cr.dump()
@@ -88,11 +88,11 @@ class Wifite(object):
attacked_targets = 0
targets_remaining = len(targets)
for index, t in enumerate(targets):
for idx, t in enumerate(targets, start=1):
attacked_targets += 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})' % (idx, len(targets)) +
' starting attacks against {C}%s{W} ({C}%s{W})'
% (t.bssid, t.essid if t.essid_known else "{O}ESSID unknown"))
if 'WEP' in t.encryption: