我有一个任务,其中有两个文件,即“user.txt”、“pwd.txt”,现在我想基本上遍历这些文件的每个值,即“John”和“pwd.txt”中的所有值,然后是“user.txt”中的另一个值,所有值都是“pwd.txt”。
这里我想实现线程。
这是我的代码,
import threading
f1 = open("user.txt", "r")
f2 = open("pwd.txt", "r")
threads = []
def brute():
for letter in f1.readlines():
print "[+]First Value: {}".format(letter)
for second_letter in f2.readlines():
print "[+]Second Value: {}".format(second_letter)
threads.append(threading.Thread(target=runner, args=(letter,second_letter,)))
for thread in threads:
thread.start()
for thread in threads:
thread.join()
def runner(word1,word2):
print("[+]I am just a worker class: {0}:{1}".format(word1,word2))
输出来了
[+]First Value: john
[+]Second Value: test1234
[+]Second Value: socool!
[+]Second Value: abcde1234
[+]Second Value: password1
[+]Second Value: Passw0rd
[+]Second Value: adminRocks
[+]First Value: dean
[+]First Value: harry
[+]First Value: sam
[+]First Value: joseph
[+]First Value: rick
[+]I am just a worker class: john:test1234
[+]I am just a worker class: john:socool!
[+]I am just a worker class: john:abcde1234
[+]I am just a worker class: john:password1
[+]I am just a worker class: john:Passw0rd
[+]I am just a worker class: john:adminRocks
[Finished in 0.3s]
我不确定如何在此处使用密码文件中的所有密码打印所有用户值。非常感谢任何帮助。
倚天杖
相关分类