From 8ac76661cea2a67570ff6b8830dcb7130e4d7bad Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Mon, 22 Feb 2021 22:23:13 +0100 Subject: [PATCH] shadysim.py: use string multiplication to add padding --- shadysim/shadysim.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shadysim/shadysim.py b/shadysim/shadysim.py index bab254c..6fc9382 100755 --- a/shadysim/shadysim.py +++ b/shadysim/shadysim.py @@ -115,9 +115,7 @@ class AppLoaderCommands(object): if ((spi_1 & 0x04) != 0): # check ciphering bit len_cipher = 6 + len_sig + (len(data) / 2) pad_cnt = 8 - (len_cipher % 8) # 8 Byte blocksize for DES-CBC (TODO: different padding) - # TODO: there is probably a better way to add "pad_cnt" padding bytes - for i in range(0, pad_cnt): - data = data + '00'; + data += '00' * pad_cnt # CHL + SPI first octet part_head = ('%02x' % (0x0D + len_sig)) + ('%02x' % (spi_1))