Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- # Open a file
- path = "."
- dirs = os.listdir(path)
- user_name = "GailOllis"
- foundPass = 0
- # This would print all the files and directories
- for file in dirs:
- for i in range(0, len(file)):
- if file[i] == ".":
- with open(file, 'rb') as f:
- count = 0
- for x, line in enumerate(f):
- splitLine = line.split()
- print(splitLine)
- for splitLineLenght in range(0, len(splitLine)):
- if splitLine[splitLineLenght] == user_name:
- foundPass = splitLineLenght + 1
- if x == foundPass:
- with open("GailOllisPasswords.txt", "w+") as passwords:
- passwords.write("Password found for username: " + user_name + "\n")
- passwords.write("Password is: " + str(splitLine[1]) + "\n")
- print(file)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement