import os
import random
import subprocess
pas = ''
while True:
for x in range(4):
pas = pas + random.choice(list('1234567890'))
print('your password is: ', pas)
cmd = f'torsocks -P {pas}'
stdout=subprocess.PIPE
p = subprocess.Popen(cmd, shell = True)
print ('consol:', p.stdout)
if '3333' in p.stdout.read().decode('utf-8'):
fp = open('/home/kali/test.txt', 'w')
fp.write(p)
fp.close()
break
write:
> your password is: 7352
> consol: None
> Traceback (most recent call last):
> File "/home/kali/test.py", line 13, in <module>
if '3333' in p.stdout.read().decode('utf-8'):
AttributeError: 'NoneType' object has no attribute 'read'
Please provide an application to torify.
Python parsing console and write to file.