Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import os
  2. import sys
  3.  
  4. # Open a file
  5. path = "."
  6. dirs = os.listdir(path)
  7.  
  8. user_name = "GailOllis"
  9. foundPass = 0
  10. # This would print all the files and directories
  11. for file in dirs:
  12. for i in range(0, len(file)):
  13. if file[i] == ".":
  14. with open(file, 'rb') as f:
  15. count = 0
  16. for x, line in enumerate(f):
  17. splitLine = line.split()
  18. print(splitLine)
  19. for splitLineLenght in range(0, len(splitLine)):
  20. if splitLine[splitLineLenght] == user_name:
  21. foundPass = splitLineLenght + 1
  22. if x == foundPass:
  23. with open("GailOllisPasswords.txt", "w+") as passwords:
  24. passwords.write("Password found for username: " + user_name + "\n")
  25. passwords.write("Password is: " + str(splitLine[1]) + "\n")
  26. print(file)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement