SHARE
TWEET

Untitled

radon5k Mar 22nd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3.  
  4. import socket
  5.  
  6. try:
  7.     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  8.     print ("Socket successfully created")
  9. except socket.error as err:
  10.     print ("socket creation failed with error %s") %(err)
  11.  
  12. port = 3800
  13.  
  14. try:
  15.     host_ip = socket.gethostbyname('64.183.98.170')
  16. except socket.gaierror:
  17.  
  18.     print ("there was an error resolving the host")
  19.  
  20. print("Connecting to " + host_ip + ":" + str(port))
  21. s.connect((host_ip, port))
  22. data = s.recv(512)
  23. b = bytearray("version\n", encoding="utf-8")
  24. s.send(b)
  25. output = "".join( chr(x) for x in bytearray(data) )
  26. print(output)
  27. data = s.recv(512)
  28. output = "".join( chr(x) for x in bytearray(data) )
  29. print("Version info: " + str(output))
  30. s.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top