diff options
author | Diego Elio Pettenò <flameeyes@flameeyes.com> | 2020-01-24 21:06:37 +0100 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@flameeyes.com> | 2020-01-24 21:06:37 +0100 |
commit | edc9c04b9a3d32ed50d1ce810afd5fc526099893 (patch) | |
tree | a038f76978caedf9dab92bfee5ec7211d14cf695 | |
parent | freestyle: only send command 0x01 to initialize the device. (diff) | |
download | glucometerutils-edc9c04b9a3d32ed50d1ce810afd5fc526099893.tar glucometerutils-edc9c04b9a3d32ed50d1ce810afd5fc526099893.tar.gz glucometerutils-edc9c04b9a3d32ed50d1ce810afd5fc526099893.tar.bz2 glucometerutils-edc9c04b9a3d32ed50d1ce810afd5fc526099893.tar.lz glucometerutils-edc9c04b9a3d32ed50d1ce810afd5fc526099893.tar.xz glucometerutils-edc9c04b9a3d32ed50d1ce810afd5fc526099893.tar.zst glucometerutils-edc9c04b9a3d32ed50d1ce810afd5fc526099893.zip |
-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. |