1target_host = "www.google.com"
2
3target_port = 80 # create a socket object
4client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
5
6# connect the client
7client.connect((target_host,target_port))
8
9# send some data
10request = "GET / HTTP/1.1\r\nHost:%s\r\n\r\n" % target_host
11client.send(request.encode())
12
13# receive some data
14response = client.recv(4096)
15http_response = repr(response)
16http_response_len = len(http_response)
17
18#display the response
19gh_imgui.text("[RECV] - length: %d" % http_response_len)
20gh_imgui.text_wrapped(http_response)