Created
March 3, 2016 07:40
-
-
Save gbossert/5abf130a65b54e6ff4eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from netzob.all import * | |
# | |
# current knownledge of the fields definition | |
# | |
f_type = Field(domain=Raw(nbBytes=1), name="Type") | |
f_dev_id = Field(domain=Raw(nbBytes=1), name="Dev_id") | |
f_cmd = Field(domain=Raw(nbBytes=2), name="Command") | |
f_payload = Field(domain=Raw(nbBytes=(0, 10)), name="Payload") | |
s = Symbol(fields=[f_type, f_dev_id, f_cmd, f_payload]) | |
# | |
# lets generate some random messages (that follows the spec) | |
# and attach them as RawMesages to the symbol | |
# | |
messages = [RawMessage(s.specialize()) for x in range(10)] | |
s.messages = messages | |
# | |
# display the symbol | |
# | |
print s | |
# /tmp$ ./test.py | |
# Warning: FastBinaryTree not available, using Python version BinaryTree. | |
# Warning: FastAVLTree not available, using Python version AVLTree. | |
# Warning: FastRBTree not available, using Python version RBTree. | |
# Type | Dev_id | Command | Payload | |
# ------ | ------ | ---------- | -------------------------------- | |
# '\x99' | '\xf9' | '\xea\x90' | 'V\xa1\x9f\xcf\x02Mw\xf8g' | |
# '\xd9' | '9' | '\x8b\x1f' | '3|' | |
# '@' | 'Q' | '\xe1\x96' | 'G\x1f' | |
# '\xd1' | '\xfe' | "P'" | '\r' | |
# 'I' | '\xd7' | 'su' | '' | |
# '\xd9' | ';' | '\x03\xd5' | '\x0e\xdc_\x95\x9c<' | |
# 'i' | '\xa1' | '\xb3\x81' | 'U\x1dN' | |
# 'k' | '1' | '\xbb\x16' | '' | |
# '\xd8' | '_' | 'N\x11' | '\xf8\xc9\xf6q' | |
# '\xa7' | '\xf1' | '+\xc7' | '\xe7\xac\x85U\xa2\xfb\x87S\x96' | |
# ------ | ------ | ---------- | -------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment