Skip to content

Commit fe5f084

Browse files
committed
updated readme
1 parent 2257bae commit fe5f084

File tree

2 files changed

+93
-8
lines changed

2 files changed

+93
-8
lines changed

README.md

Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Universal Header Decoder
22
=================
33

4-
This tool takes one or more description of a binary header and decodes the header of a given file.
4+
This tool takes one or more descriptions of a binary header and decodes the header of a given file. The main purpose of this tool is for debugging file formats.
55

66
# Usage
77

@@ -17,22 +17,107 @@ or
1717
```
1818
Name: Size in bits: display type
1919
```
20-
20+
or
21+
```
22+
Name: Size in bits: display type: condition
23+
```
2124
+ **Name** is displayed as field name
2225
+ **Size in bits** determines the field size in bits.
2326
It can also be a mathematical expression and can use previously parsed fields (referenced by their name)
2427
+ **display type** (optional) defines how the value should be displayed.
2528
It is a comma separated list with the following possible types: *int*, *hex*, *str*, *bin*, *intE* (int with changed endianness).
2629
The default is *int, hex, bin* if this field is not given.
30+
+ **condition** (optional) the field is only considered if the condition is fulfilled. The condition can contain any logical expression and the names of already parsed fields.
2731

28-
# Example
32+
# Examples
2933

3034
## IPv6 Packets
3135

32-
`python3 ./hdec.py sample/ipv6_icmpv6 hex header/IPv6 header/ICMPv6`
33-
`python3 ./hdec.py sample/ipv6_udp hex header/IPv6 header/UDP`
34-
`python3 ./hdec.py sample/6lowpan_iphc hex header/IPHC`
35-
36+
* `python3 ./hdec.py sample/ipv6_icmpv6 hex header/IPv6 header/ICMPv6`
37+
```
38+
File: sample/ipv6_icmpv6.txt
39+
Definition: header/IPv6, header/ICMPv6
40+
Type: hex
41+
42+
Version: 6
43+
TrafficClass: 0x00
44+
FlowLabel: 0x10000
45+
Length: 24
46+
NextHeader: 0x3a 58
47+
HopLimit: 64
48+
Source: 0xfe8000000000000002124b0006a0f908
49+
Destination: 0xfe8000000000000002124b00068a090f
50+
51+
Type: 128 0x80
52+
Code: 0 0x00
53+
Checksum: 0xb924
54+
Identifier: 0x0000
55+
Sequence: 0x0000
56+
Payload: 0x04040404040404040404040404040404
57+
```
58+
* `python3 ./hdec.py sample/ipv6_udp hex header/IPv6 header/UDP`
59+
```
60+
File: sample/ipv6_upd.txt
61+
Definition: header/IPv6, header/UDP
62+
Type: hex
63+
64+
Version: 6
65+
TrafficClass: 0x00
66+
FlowLabel: 0x00000
67+
Length: 16
68+
NextHeader: 0x11 17
69+
HopLimit: 64
70+
Source: 0xfe8000000000000002124b0006a0f908
71+
Destination: 0xfe8000000000000002124b00068a090f
72+
73+
SourcePort: 7778 0x1e62
74+
DestinationPort: 7777 0x1e61
75+
Length: 16 0x0010
76+
Checksum: 0xea70
77+
Payload: 0x0000320000320000
78+
```
79+
* `python3 ./hdec.py sample/6lowpan_iphc hex header/IPHC`
80+
```
81+
File: sample/6lowpan_iphc.txt
82+
Definition: header/IPHC
83+
Type: hex
84+
85+
Start: 0b011
86+
TF: 0b01 1
87+
NH: 0b0
88+
HopLimit: 0b10 2
89+
CID: 0b0
90+
SAC: 0b0
91+
SAM: 0b11 3
92+
M: 0b0
93+
DAC: 0b0
94+
DAM: 0b11 3
95+
ECN: 0b00 0
96+
Padding: 0b00
97+
FlowLabel: 0x10000
98+
NextHeader: 0x3a 58
99+
```
36100
## Bitmap
37101

38-
`python3 ./hdec.py sample/bitmap.bmp raw header/BMP`
102+
* `python3 ./hdec.py sample/bitmap.bmp raw header/BMP`
103+
```
104+
File: sample/bitmap.bmp
105+
Definition: header/BMP
106+
Type: raw
107+
108+
Magic: 0x424d BM
109+
FileSize: 307338
110+
Zero: 0x00000000
111+
Position: 138
112+
HeaderLen: 124
113+
Width: 320
114+
Height: 320
115+
Layers: 1
116+
Depth: 24
117+
Compression: 0
118+
DataLength: 307200
119+
XPixelMeter: 2835
120+
YPixelMeter: 2835
121+
UsedColors: 0
122+
ImportantColors: 0
123+
```
File renamed without changes.

0 commit comments

Comments
 (0)