Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Raw socket returns raw hexadecimal data?

I'm not that inclined with raw sockets, so I'm trying to make a browser using them; sounds kind of stupid, but it's a kind of personal journey since [INSERT FEW YEARS AGO THIS AND THIS HAPPENED]. But on my quest I have encountered a discrepancy -- here is my code;

Code
from socket import *
headers = ["GET / HTTP/1.1\r\n",\
           "Host: www.evilzone.org\r\n",\
           "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)\r\n",\
           "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n",\
           "Accept-Language: en-us,en;q=0.5\r\n",\
           "Accept-Encoding: gzip,deflate\r\n",\
            "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n",\
            "Keep-Alive: 300\r\n",\
            "Connection: keep-alive\r\n",\
            "Pragma: no-cache\r\n",\
            "Cache-Control: no-cache\r\n\r\n"]
a = socket(AF_INET, SOCK_STREAM)
a.connect(("www.evilzone.org", 80))
for x in headers: a.send(x)
buffer_ = a.recv(1024)
print buffer_

Not necessarily the prettiest, but here's my problem;

[Image: 5GqtxiG.png]

A t and a domino is returned as the supposed-to-be HTML, now I did my Googling; I'm not that contradictory of myself to constantly tell people to Google it and never do so myself -- the closest I got to figuring out what this was is a Stackoverflow/exchange post claiming it's a binary frame of some sort; here's the raw data from the 't/domino' combination;

Code
\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03\xb3Q\xd4\xd5U\xf0H\xcd\xc9\xc9\xb7W\xd0\xd5\xb5\xe3\xb2\xc9\xccMW(.J\xb6U*\xc9HM\xcdK\xd1+\xc8KW\xb2\xe3\x02\x02\x1b\x90\xca\xf0\x8c\xc4\x12\x88B\xb8\x90\xa7By~^Jj\x91B9PN!\xb3X\x01H\x02\xf5*\x005+\xe4\xa7)$\xe6\xe4\x00\xb9\x99y\xe9\xc5\x10\xf3AZ\xbc=\x83\x83\xe1\x86 L\x8a\x89A(14A\xb0\xf5\xf5\xc1l\x00\xe0Q\xd3\x01\xab\x00\x00\x00

Maybe I'm just retarded, but I can't seem to figure out this issue :(

Thanks for any help in advance.
Contact for professional programming services.
unazed#5906
Code
"Accept-Encoding: gzip,deflate\r\n",

The server is probably returning gzip encoded data in the response, hence the binary shit. Also, that is not a "raw socket", it is a TCP connection you are doing.

Edit: Definitely think it is gzip. The "\x1f\x8b" is indicative of that.
(Jan 30, 2017 01:25 PM)nooelec Wrote:  
Code
"Accept-Encoding: gzip,deflate\r\n",

The server is probably returning gzip encoded data in the response, hence the binary shit. Also, that is not a "raw socket", it is a TCP connection you are doing.

Edit: Definitely think it is gzip. The "\x1f\x8b" is indicative of that.

Yeah I think this is right. Your response encoding is messed up.
(Jan 30, 2017 01:25 PM)nooelec Wrote:  
Code
"Accept-Encoding: gzip,deflate\r\n",

The server is probably returning gzip encoded data in the response, hence the binary shit. Also, that is not a "raw socket", it is a TCP connection you are doing.

Edit: Definitely think it is gzip. The "\x1f\x8b" is indicative of that.

Oooh, alright; thanks. I'll look into it.

[Image: xlFOgbv.png]


YESSS I LOVEE YOU ALLL
Contact for professional programming services.
unazed#5906


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by ShallowMEFeb 1, 2020 01:26 PM 5 203 Feb 1, 2020 01:26 PM
Last Post: m1n0r1tyrep0rt
[C#] by ๖ۣۜchαmєllєσJan 2, 2020 04:29 PM 3 246 Jan 2, 2020 04:29 PM
Last Post: Stanley
[C] by lockheadJan 17, 2019 04:55 AM 9 337 Jan 17, 2019 04:55 AM
Last Post: you_can_never_hack_me