3

まず第一に、StackOverflowのコミュニティに感謝します。ここでたくさんの有能な答えを見つけたので、私は自分自身の質問をしようとします。

ネットワークトラフィックをHexcodeとして「ダンプ」するWinPcapサンプルプログラムがあります。定期的にテキスト(22バイト)を送信する単純なサーバー/クライアントペアを作成しました。

問題:
この16進ダンプをC ++で解析し、Wiresharkやphdのように(コンソールで)出力を生成します。

いくつかのTCP/IP参照(1)を読み取った後、すべてのバイトの「値」を判別できません。たとえば、76バイトあり、逆方向に読み取ります。

  • 最初の22バイトは私のデータです。
  • 次に、TCPヘッダー用に20があります。
  • IPヘッダーの場合は20、次に他のいくつかのバイトの場合は、それらが何を表しているのかわかりません。私はIPプロトコルについてあまり知識がありません。

16進数の例を次に示します。

08 00 27 b3 23 63 f4 6d 04 2e 68 24 08 00 45 00
00 3e 31 c4 40 00 80 06 45 9e c0 a8 01 03 c0 a8
01 04 0b 27 04 d2 b0 f7 47 61 28 6c fd a7 50 18
fa f0 8e a0 00 00 48 61 6c 6c 6f 20 64 61 73 20
69 73 74 20 65 69 6e 20 54 65 73 74  

質問:
誰かがこれらの最初のバイトが何のためにあるのか、そしてネットワークトラフィックがどのように構成されているかについての(簡単な)説明をどこで入手できるのか教えてもらえますか?

(1)TCPリファレンスIPリファレンス

4

1 に答える 1

1

私はPacketDumpDecodeを使用し、これを次のデータにデコードしました... pdd16進ダンプをwiresharkで使用できるものに変換します...次にwireshark情報から逆方向に作業してパケットを分解しました...

Ethernet Header
---------------
08 00 27 b3 23 63 f4 6d 04 2e 68 24 08 00 

IP Header
---------
45 00 00 3e 31 c4 40 00 80 06 45 9e 
c0 a8 01 03 c0 a8 01 04

TCP Header
----------
0b 27 04 d2 b0 f7 47 61 28 6c fd a7 50 18
fa f0 8e a0 00 00

TCP Data Payload
----------------
48 61 6c 6c 6f 20 64 61 73 20
69 73 74 20 65 69 6e 20 54 65 73 74

そして、完全なwiresharkデコード...

Frame 1: 76 bytes on wire (608 bits), 76 bytes captured (608 bits)
    WTAP_ENCAP: 1
    Arrival Time: Nov 24, 2012 07:12:54.000000000 Central Standard Time
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1353762774.000000000 seconds
    [Time delta from previous captured frame: 0.000000000 seconds]
    [Time delta from previous displayed frame: 0.000000000 seconds]
    [Time since reference or first frame: 0.000000000 seconds]
    Frame Number: 1
    Frame Length: 76 bytes (608 bits)
    Capture Length: 76 bytes (608 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: eth:ip:tcp:data]
Ethernet II, Src: AsustekC_2e:68:24 (f4:6d:04:2e:68:24), Dst: CadmusCo_b3:23:63 (08:00:27:b3:23:63)
    Destination: CadmusCo_b3:23:63 (08:00:27:b3:23:63)
        Address: CadmusCo_b3:23:63 (08:00:27:b3:23:63)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Source: AsustekC_2e:68:24 (f4:6d:04:2e:68:24)
        Address: AsustekC_2e:68:24 (f4:6d:04:2e:68:24)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 192.168.1.3 (192.168.1.3), Dst: 192.168.1.4 (192.168.1.4)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
    Total Length: 62
    Identification: 0x31c4 (12740)
    Flags: 0x02 (Don't Fragment)
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    Fragment offset: 0
    Time to live: 128
    Protocol: TCP (6)
    Header checksum: 0x459e [correct]
        [Good: True]
        [Bad: False]
    Source: 192.168.1.3 (192.168.1.3)
    Destination: 192.168.1.4 (192.168.1.4)
    [Source GeoIP: Unknown]
    [Destination GeoIP: Unknown]
Transmission Control Protocol, Src Port: msrp (2855), Dst Port: search-agent (1234), Seq: 1, Ack: 1, Len: 22
    Source port: msrp (2855)
    Destination port: search-agent (1234)
    [Stream index: 0]
    Sequence number: 1    (relative sequence number)
    [Next sequence number: 23    (relative sequence number)]
    Acknowledgment number: 1    (relative ack number)
    Header length: 20 bytes
    Flags: 0x018 (PSH, ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgment: Set
        .... .... 1... = Push: Set
        .... .... .0.. = Reset: Not set
        .... .... ..0. = Syn: Not set
        .... .... ...0 = Fin: Not set
    Window size value: 64240
    [Calculated window size: 64240]
    [Window size scaling factor: -1 (unknown)]
    Checksum: 0x8ea0 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
    [SEQ/ACK analysis]
        [Bytes in flight: 22]
Data (22 bytes)

0000  48 61 6c 6c 6f 20 64 61 73 20 69 73 74 20 65 69   Hallo das ist ei
0010  6e 20 54 65 73 74                                 n Test
    Data: 48616c6c6f20646173206973742065696e2054657374
    [Length: 22]
于 2012-11-24T13:21:40.043 に答える