diff --git a/tools/indy/fir_tool2.py b/tools/indy/fir_tool2.py index c831ac955..fc087fde4 100644 --- a/tools/indy/fir_tool2.py +++ b/tools/indy/fir_tool2.py @@ -19,12 +19,15 @@ import os import sys import array -from struct import unpack +from struct import unpack, Struct import ctypes from binascii import hexlify, unhexlify from optparse import OptionParser -version_id = "0.5 (20Mar2010)" +#version_id = "0.5 (20Mar2010)" #indy's legacy version +version_id = "0.6 (Oct2025)" #python 3 compatibility and some code factorisation + +#tested with 7D000125.FIR, 80D00103.FIR, 7D200113.FIR, EOSR0180.FIR, EOSR6190.FIR # updater decoding tables. since 1d Mark III (2/2007) # See 20 dec 2007 (soldeersmurfje), 40D firmware decryption, http://tech.groups.yahoo.com/group/canondigicamhacking/message/7883 @@ -88,26 +91,10 @@ 0x3C, 0xF1, 0x17, 0x8F, 0x50, 0xE4, 0xFD, 0x33, 0xBD, 0x46, 0x83, 0x41, 0x0E, 0xD5, 0x27, 0x0D, 0xB2, 0x87, 0x86, 0x16, 0x82, 0x1D, 0xDD, 0xE7, 0xE1, 0xEF, 0x29, 0x5D, 0x48, 0xF4, 0xFC, 0xF2, 0x1D ] -VXWORKS = 0 -DRYOS = 1 -osName = [ 'VxWorks', 'DryOS' ] -models = [ [ 0x80000169, VXWORKS, '1D Mark III'], [ 0x80000176, VXWORKS, '450D / Rebel XSi'], - [ 0x80000190, VXWORKS, '40D'], [ 0x80000213, VXWORKS, '5D'], - [ 0x80000215, VXWORKS, '1Ds Mark III'], [ 0x80000218, DRYOS, '5D Mark II'], - [ 0x80000234, VXWORKS, '30D'], [ 0x80000236, VXWORKS, '400D / Rebel XTi'], - [ 0x80000250, DRYOS, '7D'], [ 0x80000252, DRYOS, '500D / T1i'], - [ 0x80000254, VXWORKS, '1000D / Rebel XS'], [ 0x80000261, DRYOS, '50D'], - [ 0x80000270, DRYOS, '550D / T2i'], [ 0x80000281, DRYOS, '1D Mark IV'], - [ 0x80000241, DRYOS, 'WFT-E2'], [ 0x80000246, DRYOS, 'WFT-E3'] ] def getLongLE(d, a): return unpack('0 or out.find(b'gaonisoy')>0: return True else: return False def decipher_updater( xorSeed, offset, len, filename): out = xor_decode( xorSeed, offset, len) - print ' xor_decoding [0x%x-0x%x]...' % ( offset, offset+len), - if check_xor_decoding( os, out): - print 'OK (%s)' % filename + print (' xor_decoding [0x%x-0x%x]...' % ( offset, offset+len),end='') + if check_xor_decoding( out): + print ('OK (%s)' % filename) f = open(filename, 'wb') - out.tofile(f) + f.write(out) f.close() else: - print 'KO' + print ('KO') + +def enc_header(header): + updater1len, l, z, seed = Struct('