Guest User

Untitled

a guest
Oct 20th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. import socket
  2.  
  3. target_host = 'www.google.com'
  4. target_port = 80
  5.  
  6.  
  7. client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  8.  
  9. client.connect((target_host, target_port))
  10. client.send('GET / HTTP /1.1rnHost: google.comrnrn')
  11.  
  12. response = client.recv(4096)
  13.  
  14. print(response);
  15.  
  16. Traceback (most recent call last):
  17. File "dns.py", line 7, in <module>
  18. client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  19. AttributeError: module 'socket' has no attribute 'socket'
  20. Error in sys.excepthook:
  21. Traceback (most recent call last):
  22. File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
  23. from apport.fileutils import likely_packaged, get_recent_crashes
  24. File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
  25. from apport.report import Report
  26. File "/usr/lib/python3/dist-packages/apport/report.py", line 21, in <module>
  27. from urllib.request import urlopen
  28. File "/usr/lib/python3.5/urllib/request.py", line 88, in <module>
  29. import http.client
  30. File "/usr/lib/python3.5/http/client.py", line 739, in <module>
  31. class HTTPConnection:
  32. File "/usr/lib/python3.5/http/client.py", line 749, in HTTPConnection
  33. def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
Add Comment
Please, Sign In to add comment