From 0bfd4ac82ade05f768e38515217abccd71b7d9da Mon Sep 17 00:00:00 2001 From: "Alexander \"Tarh" Date: Sun, 14 Apr 2024 01:54:45 +0300 Subject: [PATCH] [WIP] Minor cleanup committed --- .../xiaomi_cloud_map_extractor/ijai/aes_decryptor.py | 4 ---- .../xiaomi_cloud_map_extractor/ijai/map_data_parser.py | 3 --- 2 files changed, 7 deletions(-) diff --git a/custom_components/xiaomi_cloud_map_extractor/ijai/aes_decryptor.py b/custom_components/xiaomi_cloud_map_extractor/ijai/aes_decryptor.py index 25bb701..fdd297e 100644 --- a/custom_components/xiaomi_cloud_map_extractor/ijai/aes_decryptor.py +++ b/custom_components/xiaomi_cloud_map_extractor/ijai/aes_decryptor.py @@ -43,7 +43,6 @@ def md5key(string: str, model: str, device_mac: str): tempKey = pjstr + tempModel aeskey = aesEncrypted(string, tempKey) - #aeskey = string temp = MD5.new(aeskey.encode('utf-8')).hexdigest() if isEncryptKeyTypeHex: @@ -59,8 +58,5 @@ def genMD5key(wifi_info_sn: str, owner_id: str, device_id: str, model: str, devi def unGzipCommon(data: str, wifi_info_sn: str, owner_id: str, device_id: str, model: str, device_mac: str) -> bytes: - #base64map = base64.b64encode(data) -# with open("0.encrypted.map", 'wb') as file: -# file.write(data) return aesDecrypted(data, genMD5key(wifi_info_sn, owner_id, device_id, model, device_mac)) diff --git a/custom_components/xiaomi_cloud_map_extractor/ijai/map_data_parser.py b/custom_components/xiaomi_cloud_map_extractor/ijai/map_data_parser.py index e83b978..a25de88 100644 --- a/custom_components/xiaomi_cloud_map_extractor/ijai/map_data_parser.py +++ b/custom_components/xiaomi_cloud_map_extractor/ijai/map_data_parser.py @@ -40,16 +40,13 @@ def parse(raw: bytes, colors: Colors, drawables: Drawables, texts: Texts, sizes: _LOGGER.debug(f"Skipping {offset1} bytes, value: {buf._data[buf._offs]:#x}") feature_flags = MapDataParserIjai.FEATURE_IMAGE - #feature_flags = buf.get_uint32('feature_flags') map_id = buf.peek_uint32('map_id') - #_LOGGER.debug('feature_flags: 0x%x, map_id: %d, some_hash: %s', feature_flags, map_id, some_hash) if feature_flags & MapDataParserIjai.FEATURE_ROBOT_STATUS != 0: MapDataParserIjai.parse_section(buf, 'robot_status', map_id) buf.skip('unknown1', 0x28) if feature_flags & MapDataParserIjai.FEATURE_IMAGE != 0: - #MapDataParserIjai.parse_section(buf, 'image', map_id) buf.set_name('image') map_data.image, map_data.rooms, map_data.cleaned_rooms = \ MapDataParserIjai.parse_image(buf, colors, image_config, DRAWABLE_CLEANED_AREA in drawables)