A
A
Alexander2018-06-22 17:01:34
Computer networks
Alexander, 2018-06-22 17:01:34

What to do with Tcp packet encoding (PacketDotNet)?

I use SharpPcap to capture packets. There is this code:

// Когда приходит пакет, вызывается это событие
private static void Program_OnPacketArrival(object sender, CaptureEventArgs e)
{
    Packet packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data);
    TcpPacket tcp = (TcpPacket)packet.Extract(typeof(TcpPacket));

    if (tcp != null)
    {
        byte[] data = tcp.PayloadData;
        Console.WriteLine(Encoding.UTF8.GetString(data)); // Внимание сюда
    }
}

When I access google.com in the browser, it prints
such

???N?O?????? ???X?QO QC?\?????lD??Y.I??1a????X?n_qMC?J?0?????Iz???e?~??? lu?
w?=???{?q?y'}???(?(??5?:[email protected]?18p7'8??M?&?????'???3?dk????h?i????ZYx%D?!?C_ ???+?M~?????#?&?1????j-?^r?PLZNWWI?]?m?&C????se?9??.??:???f[????/J??f?KJ???:?\ [email protected]
? ?a4^"???????_????_T??Ec?5??=??3??]E?x? ???v????;????m??r???0?,??GG?!?d?w?'???Z; ?pV??J?z?"??4n?ku?I???O{[email protected]??S?.5Gb?Ja?A?Z??V??v????|o?4r??^[email protected] M??t?M,[email protected]?v??s?Sp?K?R?f
*?9?[?1:?/ 7/?uG?<?E???
и т.д.

I tried different encodings: ASCII, BigEndianUnicode, Unicode, UTF8/7/32, windows-1251, but I don't get meaningful text.
Please tell me what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
Wexter, 2018-06-22
@AlexNineteen

Most likely what you see is encrypted https traffic

R
Ruslan Fedoseev, 2018-06-22
@martin74ua

Are you sure that there is readable text there?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question