Aadeshnpn
Aadeshnpn

Reputation: 31

Convert raw socket data into readable form

I am working on network analyzer. I have used code available form http://www.binarytides.com/python-packet-sniffer-code-linux/. The data section output of the program is as follows:

Content-Type: text/html; charset=iso-8859-1

M�Ak�0 ���ZO�aQz��▒�&e�� �s�эU���V:���� ����'qW�oձ.�U�UP7/�~ ��}�v��*n�<���J&��W/�%mb��$7��a���I�����G���D�RYO�&�Gx֗�uC▒~t�!B�7�.@ !� ��>�6��yԭ%��X9�7�i�i ��w���

�� O��?6�]��l���K��

I need to convert this raw data into readable form and then analyze the data.I am using using python 2.7.

Upvotes: 0

Views: 518

Answers (1)

Some programmer dude
Some programmer dude

Reputation: 409442

If you look at the Content-Encoding header, it says gzip. This means that the web-page is compressed using the gzip algorithm. As such it's binary data that you can't print out, you have to uncompress it first.

You can use the Python gzip module for that.

Upvotes: 1

Related Questions