-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathparse_example.py
More file actions
executable file
·40 lines (33 loc) · 1.62 KB
/
parse_example.py
File metadata and controls
executable file
·40 lines (33 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
import json
import cper
def main():
cper_raw = (
b"\x43\x50\x45\x52\x01\x01\xff\xff\xff\xff\x01\x00\x03"
b"\x00\x00\x00\x00\x00\x00\x00\x28\x01\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x78"
b"\xe4\x01\xa9\x73\x11\xef\x11\x96\xa8\x5f\xa6\xbe\xf5"
b"\xee\xa4\xac\xd5\xa9\x09\x04\x52\x14\x42\x96\xe5\x94"
b"\x99\x2e\x75\x2b\xcd\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc8\x00"
b"\x00\x00\x60\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00"
b"\x00\xf2\x44\x52\x6d\x12\x27\xec\x11\xbe\xa7\xcb\x3f"
b"\xdb\x95\xc7\x86\x4a\x33\x4f\xcc\x63\xc5\xeb\x11\x8f"
b"\x88\x9f\x7a\xc7\x6c\x6f\x0c\x03\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x44\x52\x41\x4d\x2d\x43\x48\x41"
b"\x4e\x4e\x45\x4c\x53\x00\x00\x00\x00\x20\x00\x00\x03"
b"\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\xbe"
b"\x02\x04\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00"
b"\x00\x04\xbe\x02\x04\x00\x10\x00\x00\xff\xff\xff\xff"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
)
result = cper.parse(cper_raw)
print(json.dumps(result, indent=4))
if __name__ == "__main__":
main()