CCSDS_study project
This commit is contained in:
41
test/run_usb_mouse_protocol.py
Normal file
41
test/run_usb_mouse_protocol.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import binascii
|
||||
import logging
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, '/home/zjz/CCSDS_study/netzob-030/test/src')
|
||||
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
||||
|
||||
from netzob.all import *
|
||||
|
||||
samples = [
|
||||
"00ff1f000000", "00fe1f000000", "00fe1f000000", "00fe1f000000",
|
||||
"00ff1f000000", "00ff1f000000", "00ff0f000000", "00fe2f000000",
|
||||
"00fe1f000000", "00ff0f000000", "000010000000", "00fe1f000000",
|
||||
"00ff1f000000", "00ff0f000000", "00ff1f000000", "000010000000",
|
||||
"00ff0f000000", "000010000000", "00ff1f000000", "00ff0f000000",
|
||||
"00ff1f000000", "00fe0f000000", "00ff1f000000", "00ff1f000000",
|
||||
"00ff0f000000", "00fe1f000000", "00fe2f000000", "00fe1f000000",
|
||||
"00fe1f000000", "00fe1f000000", "000010000000", "00ff0f000000",
|
||||
"000010000000", "00fe0f000000", "00ff1f000000", "00fe1f000000",
|
||||
"00ff1f000000", "00ff1f000000", "00ff0f000000", "000010000000",
|
||||
"00fe1f000000", "00ff2f000000", "00fe1f000000", "00fe1f000000",
|
||||
"00ff1f000000", "00ff1f000000", "00ff1f000000", "00ff1f000000",
|
||||
"00fe1f000000", "00fe2f000000",
|
||||
]
|
||||
|
||||
messages = [RawMessage(data=binascii.unhexlify(s)) for s in samples]
|
||||
symbol = Symbol(messages=messages)
|
||||
symbol.addEncodingFunction(TypeEncodingFunction(HexaString))
|
||||
|
||||
print("=== 原始消息 ===")
|
||||
print(symbol)
|
||||
|
||||
# 静态字段切分(保留相邻动态字段分离)
|
||||
Format.splitStatic(symbol, mergeAdjacentDynamicFields=False)
|
||||
|
||||
print("\n=== splitStatic 推理结果 ===")
|
||||
print(symbol)
|
||||
|
||||
print("\n=== 字段结构 ===")
|
||||
for i, field in enumerate(symbol.children):
|
||||
print(f"Field[{i}]: {field.name} domain={field.domain}")
|
||||
Reference in New Issue
Block a user