Skip to content

Commit 5368024

Browse files
committed
readme updated
1 parent b21d0ca commit 5368024

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,38 @@
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.
45

6+
# Usage
7+
8+
`python3 ./hdec.py <file-to-decode> <type> <header description> [<header 2 description> ...]`
9+
10+
# Header
11+
12+
Header files consist of a line-by-line description of each header field. Each line has the form
13+
```
14+
Name: Size in bits
15+
```
16+
or
17+
```
18+
Name: Size in bits: display type
19+
```
20+
21+
+ **Name** is displayed as field name
22+
+ **Size in bits** determines the field size in bits.
23+
It can also be a mathematical expression and can use previously parsed fields (referenced by their name)
24+
+ **display type** (optional) defines how the value should be displayed.
25+
It is a comma separated list with the following possible types: *int*, *hex*, *str*, *bin*, *intE* (int with changed endianness).
26+
The default is *int, hex, bin* if this field is not given.
27+
28+
# Example
29+
30+
## IPv6 Packets
31+
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+
## Bitmap
37+
38+
`python3 ./hdec.py sample/bitmap.bmp raw header/BMP`

0 commit comments

Comments
 (0)