diff options
-rwxr-xr-x | reversing_tools/abbott/extract_freestyle.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/reversing_tools/abbott/extract_freestyle.py b/reversing_tools/abbott/extract_freestyle.py index 39c52ad..69f0d02 100755 --- a/reversing_tools/abbott/extract_freestyle.py +++ b/reversing_tools/abbott/extract_freestyle.py @@ -25,8 +25,15 @@ import usbmon import usbmon.chatter import usbmon.pcapng +_KEEPALIVE_TYPE = 0x22 + _UNENCRYPTED_TYPES = ( - 0x01, 0x04, 0x05, 0x06, 0x0c, 0x0d, 0x14, 0x15, 0x33, 0x34, 0x35, 0x71,) + 0x01, 0x04, 0x05, 0x06, 0x0c, 0x0d, + 0x14, 0x15, + 0x33, 0x34, 0x35, + 0x71, + _KEEPALIVE_TYPE, +) def main(): if sys.version_info < (3, 7): @@ -53,6 +60,11 @@ def main(): 'will be dumped with the undecoded length as well.')) parser.add_argument( + '--print_keepalive', action='store_true', + help=('Whether to print the keepalive messages sent by the device. ' + 'Keepalive messages are usually safely ignored.')) + + parser.add_argument( 'pcap_file', action='store', type=str, help='Path to the pcapng file with the USB capture.') @@ -91,6 +103,9 @@ def main(): message_type = packet.payload[0] + if message_type == _KEEPALIVE_TYPE and not args.print_keepalive: + continue + if args.libre2 and message_type not in _UNENCRYPTED_TYPES: # On Libre 2 (expected encrypted communication), we ignore the # message_length and we keep it with the whole message. |