So I am very new to networking and I was using the Python Socket library to connect to a server that is suposed to giveme time from the server.
Here is the code used.
import socket
import requests
import urllib3
Headers = {
'Host':'iqoption.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0',
'Accept' : '*/*',
'Accept-Encoding': 'gzip, deflate',
'Sec-WebSocket-Version' : '13',
'Origin' : 'https://iqoption.com',
'Sec-WebSocket-Key': 'iExBWv1j6sC12qD+QPQ==',
'Connection' : 'keep-alive, Upgrade',
'Upgrade': 'websocket'
}
proxies = {"http": "http://127.0.0.1:8080", "https": "http://127.0.0.1:8080"}
urllib3.disable_warnings()
r = requests.get('https://iqoption.com/echo/websocket', stream=True,headers = Headers, proxies=proxies, verify=False)
s = socket.fromfd(r.raw.fileno(), socket.AF_INET, socket.SOCK_STREAM)
data = "ds"
bytes = s.recv(6000)
print(bytes)
This is the response expected
{"name":"timeSync","msg":1582082211799}
But i get all this code in the console
b'\x17\x03\x03\x00A\x00\x00\x00\x00\x00\x00\x00\x02\xd2D[\xac\xece\x97\xe4\x01\x83\x9c"\x9d\x89[=\xd6\xa5\x96\x9a"A\x16\x8b(\xc5+\xaf5X\xf7\xb2\x1ai\xd2\x03\x90\x17\n\xa9h\xc7\xc3\xab\xf4jm\xaf\xdf\xa3\x80j\xb5I\x06p~'
I decided to do a purpsuite check to see what was happening
And I received exactly the information I needed, I will put a capture
Screenshot of intercepted data in burpsuite
But I do not understand why when you pass the information to python, print these strange numbers
I'm really lost in this problem, I hope someone finds a solution :))