D
D
Dimaste2020-08-10 11:57:54
Python
Dimaste, 2020-08-10 11:57:54

Why doesn't python go through each value of the outer loop?

usernames = open(args['u'].name)
passwords = open(args['p'].name)
#tagret = open(args['t'].name)

payloads_file = open('.\payloads.txt', 'w+')

i = 0

for user in usernames:
    for password in passwords:
        i = i + 1
        payload = user + ':' + password
        payload_encoded = str(base64.b64encode(payload.encode('utf_8')).decode('utf_8'))
        #payloads_file.write(payload_encoded + '\n')
        
print (i)
payloads_file.close()
usernames.close()
passwords.close()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2020-08-10
@Dimaste

Indeed, an interesting case. This loop reads the file line by line to the end, and when it re-enters the second iteration of the outer loop, it does not return a single line.
for line in file:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question