Advertisement
DeaD_EyE

echo_client_tor

Oct 7th, 2019
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import sys
  2. import socks
  3.  
  4. # pip install pysocks [--user] oder in einem venv
  5. # https://pypi.org/project/PySocks/
  6. # tor muss laufen
  7.  
  8.  
  9. def echo_client(host, port, msg, proxy_ip='localhost', proxy_port=9050):
  10.     sock = socks.socksocket()
  11.     sock.set_proxy(socks.SOCKS5, proxy_ip, proxy_port)
  12.     sock.connect((host, port))
  13.     sock.sendall(msg)
  14.     return sock.recv(1024)
  15.  
  16. try:
  17.     msg = input('Bitte Nachricht eingeben: ')
  18. except KeyboardInterrupt:
  19.     sys.exit(1)
  20.  
  21. host, port = 'nnpa3jqbdjoafuzh.onion', 5000
  22. # demo server läuft momentan
  23. # have fun with hacking, server is up
  24.  
  25. try:
  26.     rep = echo_client(host, port, msg.encode())
  27. except Exception as e:
  28.     print(e)
  29. except KeyboardInterrupt:
  30.     pass
  31. else:
  32.     print(rep.decode())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement