HKM999 commited on
Commit
a1c647c
·
verified ·
1 Parent(s): 4b003f6

I need to convert this code generating calculator into a professional and distinctive looking calculator.#!/usr/bin/env python3 # -*- coding: utf-8 -*- # (c) B.Kerler 2019 under MIT license # If you use my code, make sure you refer to my name # If you want to use in a commercial product, ask me before integrating it import serial import sys import argparse from binascii import hexlify, unhexlify ''' C7 = 7 0 0 2 7 5 0 C6 = 3 1 7 0 3 0 1 C5 = 0 2 5 3 0 3 2 C8 = 1 3 3 1 5 7 3 C4 = 5 4 1 4 1 1 4 ''' prodtable = { "MDM8200": dict(openlock=0, openmep=1, opencnd=0, clen=8, init=[1,3,5,7,0], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 2, 4, 1, 3, 0, 3, 4, 0)"), # MC878XC_F1.2.3.15 verified, key may be stored in nvitem 0x4e21;MC8700 M3.0.9.0 verified "MDM9200": dict(openlock=0, openmep=1, opencnd=0, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # AC881U, EM8805 SWI9X15C_05.05.58.00, at!openlock?6A1F1CEA298A14B0 => AT!OPENLOCK="3A9EA70D86FEE58C" "MDM9200_V1": dict(openlock=2, openmep=1, opencnd=0, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # AC710 "MDM9200_V2": dict(openlock=3, openmep=1, opencnd=0, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # AC775 "MDM9200_V3": dict(openlock=8, openmep=1, opencnd=8, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # AC775 #"MDM9x15": dict(openlock=0, openmep=1, opencnd=0, clen=8, init=[5,0,3,7,1], run="resultbuffer[i]=self.SierraCalc9x15(challenge[i])"), # 9x15C 06.03.32.02, AC340U 1.13.12.14 verified, #AT!CUSTOM=\"ADBENABLE\",1 "MDM9x15": dict(openlock=0, openmep=1, opencnd=0, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # 9x15C 06.03.32.02, AC340U 1.13.12.14 verified, #AT!CUSTOM=\"ADBENABLE\",1 #"MDM9x28": dict(openlock=9, openmep=10, opencnd=9, clen=8, init=[5,0,3,7,1], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 0, 1, 2, 3, 4, 3, 1, 0)"), # SWI9X07Y_02.25.02.01 "MDM9x28": dict(openlock=9, openmep=10, opencnd=9, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # SWI9X07Y_02.25.02.01 #"MDM9x30": dict(openlock=0, openmep=1, opencnd=0, clen=8, init=[0,7,5,3,1], run="resultbuffer[i]=self.SierraCalc9x30(challenge[i])"), # MC7455_2.30.01.01 #4 "MDM9x30": dict(openlock=5, openmep=4, opencnd=5, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # MC7455_2.30.01.01 #4 "MDM9x30_V1": dict(openlock=17, openmep=15, opencnd=17, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # AC791L/AC790S NTG9X35C_02.08.29.00 #"MDM9x40": dict(openlock=11, openmep=1, opencnd=11, clen=8, init=[0,7,5,3,1], run="resultbuffer[i]=self.MDM9x40(challenge[i], 2, 0, 3, 1, 4, 1, 0, 0)"), "MDM9x40": dict(openlock=11, openmep=12, opencnd=11, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # AC815s "MDM9x50_V1": dict(openlock=11, openmep=12, opencnd=11, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), #"MDM9x50": dict(openlock=7, openmep=6, opencnd=7, clen=8, init=[7,0,1,3,5], run="resultbuffer[i]=self.SierraCalc9x50(challenge[i])"), "MDM9x50": dict(openlock=7, openmep=6, opencnd=7, clen=8, init=[7,3,0,1,5], run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # EM7565 } infotable = { "MDM8200": ["M81A", "M81B", "AC880", "AC881", "MC8780", "MC8781", "AC880E", "AC881E", "EM8780", "EM8781", "MC8780V", "MC8781V", "MC8700", "AC308U"], "MDM9200": ["AC710", "MC8775", "MC8775V", "AC875", "MC8700", "AC313U", "MC8801", "MC7700", "MC7750", "MC7710", "EM7700"], "MDM9200_V1": ["AC710", "MC8775", "MC8775V", "AC875", "MC8700", "AC313U", "MC8801", "MC7700", "MC7750", "MC7710", "EM7700"], "MDM9200_V2": ["AC775", "PC7200"], "MDM9x28": ["SWI9X07Y", "WP76xx"], "MDM9x15": ["SWI9X15C", "AR7550", "AR7552", "AR7554", "EM7355", "EM7655", "MC7354", "WP7100", "WP7102", "WP7104", "MC7305", "EM7305", "MC8805", "EM8805", "MC7350", "MC7350-L", "MC7802", "MC7304", "AR7556", "AR7558", "WP75xx", "WP85xx", "WP8548", "WP8548G", "AC340U"], "MDM9x30": ["EM7455", "MC7455", "EM7430", "MC7430"], "MDM9x30_V1" : ["Netgear AC790/MDM9230"], "MDM9x40": ["AC815s", "AC785s"], "MDM9x50": ["EM7565", "EM7565-9", "EM7511"], "MDM9x50_V1" : ["Netgear MR1100"] } keytable = bytearray([0xF0, 0x14, 0x55, 0x0D, 0x5E, 0xDA, 0x92, 0xB3, 0xA7, 0x6C, 0xCE, 0x84, 0x90, 0xBC, 0x7F, 0xED, #0 MC8775_H2.0.8.19 !OPENLOCK, !OPENCND .. MC8765V,MC8765,MC8755V,MC8775,MC8775V,MC8775,AC850,AC860,AC875,AC881,AC881U,AC875, AC340U 1.13.12.14 0x61, 0x94, 0xCE, 0xA7, 0xB0, 0xEA, 0x4F, 0x0A, 0x73, 0xC5, 0xC3, 0xA6, 0x5E, 0xEC, 0x1C, 0xE2, #1 MC8775_H2.0.8.19 AC340U, OPENMEP default 0x39, 0xC6, 0x7B, 0x04, 0xCA, 0x50, 0x82, 0x1F, 0x19, 0x63, 0x36, 0xDE, 0x81, 0x49, 0xF0, 0xD7, #2 AC750,AC710,AC7XX,SB750A,SB750,PC7000,AC313u OPENMEP 0xDE, 0xA5, 0xAD, 0x2E, 0xBE, 0xE1, 0xC9, 0xEF, 0xCA, 0xF9, 0xFE, 0x1F, 0x17, 0xFE, 0xED, 0x3B, #3 AC775,PC7200 0xFE, 0xD4, 0x40, 0x52, 0x2D, 0x4B, 0x12, 0x5C, 0xE7, 0x0D, 0xF8, 0x79, 0xF8, 0xC0, 0xDD, 0x37, #4 MC7455_02.30.01.01 OPENMEP 0x3B, 0x18, 0x99, 0x6B, 0x57, 0x24, 0x0A, 0xD8, 0x94, 0x6F, 0x8E, 0xD9, 0x90, 0xBC, 0x67, 0x56, #5 MC7455_02.30.01.01 OPENLOCK 0x47, 0x4F, 0x4F, 0x44, 0x4A, 0x4F, 0x42, 0x44, 0x45, 0x43, 0x4F, 0x44, 0x49, 0x4E, 0x47, 0x2E, #6 SWI9x50 Openmep Key SWI9X50C_01.08.04.00 0x4F, 0x4D, 0x41, 0x52, 0x20, 0x44, 0x49, 0x44, 0x20, 0x54, 0x48, 0x49, 0x53, 0x2E, 0x2E, 0x2E, #7 SWI9x50 Openlock Key SWI9X50C_01.08.04.00 0x8F, 0xA5, 0x85, 0x05, 0x5E, 0xCF, 0x44, 0xA0, 0x98, 0x8B, 0x09, 0xE8, 0xBB, 0xC6, 0xF7, 0x65, #8 MDM8200 Special 0x4D, 0x42, 0xD8, 0xC1, 0x25, 0x44, 0xD8, 0xA0, 0x1D, 0x80, 0xC4, 0x52, 0x8E, 0xEC, 0x8B, 0xE3, #9 SWI9x07 Openlock Key 02.25.02.01 0xED, 0xA9, 0xB7, 0x0A, 0xDB, 0x85, 0x3D, 0xC0, 0x92, 0x49, 0x7D, 0x41, 0x9A, 0x91, 0x09, 0xEE, #10 SWI9x07 Openmep Key 02.25.02.01 0x8A, 0x56, 0x03, 0xF0, 0xBB, 0x9C, 0x13, 0xD2, 0x4E, 0xB2, 0x45, 0xAD, 0xC4, 0x0A, 0xE7, 0x52, #11 NTG9X40C_11.14.08.11 / mdm9x40r11_core AC815s / SWI9x50 MR1100 Openlock Key 0x2A, 0xEF, 0x07, 0x2B, 0x19, 0x60, 0xC9, 0x01, 0x8B, 0x87, 0xF2, 0x6E, 0xC1, 0x42, 0xA8, 0x3A, #12 SWI9x50 MR1100 Openmep Key 0x28, 0x55, 0x48, 0x52, 0x24, 0x72, 0x63, 0x37, 0x14, 0x26, 0x37, 0x50, 0xBE, 0xFE, 0x00, 0x00, #13 SWI9x50 Unknown key 0x22, 0x63, 0x48, 0x02, 0x24, 0x72, 0x27, 0x37, 0x19, 0x26, 0x37, 0x50, 0xBE, 0xEF, 0xCA, 0xFE, #14 SWI9x50 IMEI nv key 0x98, 0xE1, 0xC1, 0x93, 0xC3, 0xBF, 0xC3, 0x50, 0x8D, 0xA1, 0x35, 0xFE, 0x50, 0x47, 0xB3, 0xC4, #15 NTG9X35C_02.08.29.00 Openmep Key AC791L/AC790S Old 0x61, 0x94, 0xCE, 0xA7, 0xB0, 0xEA, 0x4F, 0x0A, 0x73, 0xC5, 0xC3, 0xA6, 0x5E, 0xEC, 0x1C, 0xE2, #16 NTG9X35C_02.08.29.00 Openmep Key AC791/AC790S 0xC5, 0x50, 0x40, 0xDA, 0x23, 0xE8, 0xF4, 0x4C, 0x29, 0xE9, 0x07, 0xDE, 0x24, 0xE5, 0x2C, 0x1D, #17 NTG9X35C_02.08.29.00 Openlock Key AC791/AC790S Old 0xF0, 0x14, 0x55, 0x0D, 0x5E, 0xDA, 0x92, 0xB3, 0xA7, 0x6C, 0xCE, 0x84, 0x90, 0xBC, 0x7F, 0xED, #18 NTG9X35C_02.08.29.00 Openlock Key AC791/AC790S ]) class SierraImplementationTest(): def SierraCalc9x50(self, challenge): r3 = self.rtbl[2] r4 = challenge r5 = r3 + 1 self.rtbl[2] = r5 & 0xFF #.new r5 = r5 & 0xFF r6 = self.rtbl[3] r3 = self.tbl[r3] r3 = r6 + r3 #r7 = r2 + r5 self.rtbl[3] = r3 & 0xFF #.new r3 = r3 & 0xFF r0 = self.rtbl[1] r14 = self.rtbl[0] #r13 = r2 + r3 r8 = self.tbl[r0] r9 = self.tbl[r3] #r28 = r2 + r14 r15 = self.rtbl[4] #memb(r12 + # 0) = r9 self.tbl[r0]=r9 #r18 = self.tbl[r14] #memb(r13 + # 0) = r18.new self.tbl[r3]=self.tbl[r14] #r5 = self.tbl[r5] #memb(r28 + # 0) = r5.new self.tbl[r14]=self.tbl[r5] # memb(r7 + # 0) = r8 self.tbl[r5]=r8 r1 = self.tbl[r8] r5 = r15 + r1 self.rtbl[4] = r5 & 0xFF #.new r5 = r5 & 0xFF r3 = self.tbl[r3] self.rtbl[0] = r4 #Disasm error, was 1 r3 = r3 + r8 r6 = self.tbl[r0] r7 = self.tbl[r14] r3 = r3 & 0xFF r5 = self.tbl[r5] r5 += r6 + r7 r3 = self.tbl[r3] r5 = r5 & 0xFF r3 = r3 ^ r4 r5 = self.tbl[r5] r5 = self.tbl[r5] r3 = r3 ^ r5 self.rtbl[1] = r3 # Disasm error, was 0 before return r3 def SierraCalc9x50_MR1100(self,challenge): ''' { r3 = memub(gp+#4192) r4 = memub(r17++#1) } { r5 = add(r3,#1) memb(gp+#4192) = r5.new } { r5 = and(r5,#255) r6 = memub(gp+#4193) r3 = memub(r2+r3<<#0) } { r3 = add(r6,r3) r7 = add(r2,r5) memb(gp+#4193) = r3.new } { r3 = and(r3,#255) r0 = memub(gp+#4191) r14 = memub(gp+#4190) } { r12 = add(r2,r0) r13 = add(r2,r3) r8 = memub(r2+r0<<#0) r9 = memub(r2+r3<<#0) } { r28 = add(r2,r14) r15 = memub(gp+#4194) memb(r12+#0) = r9 } { r18 = memub(r2+r14<<#0) memb(r13+#0) = r18.new } { r5 = memub(r2+r5<<#0) memb(r28+#0) = r5.new } { memb(r7+#0) = r8 } { r1 = memub(r2+r8<<#0) } { r5 = add(r15,r1) memb(gp+#4194) = r5.new } { r5 = and(r5,#255) r3 = memub(r2+r3<<#0) memb(gp+#4191) = r4 } { r3 = add(r3,r8) r6 = memub(r2+r0<<#0) r7 = memub(r2+r14<<#0) } { r3 = and(r3,#255) r5 = memub(r2+r5<<#0) } { r5 += add(r6,r7) r3 = memub(r2+r3<<#0) } { r5 = and(r5,#255) r3 = xor(r3,r4) } { r5 = memub(r2+r5<<#0) } { r5 = memub(r2+r5<<#0) } { r3 = xor(r3,r5) memb(gp+#4190) = r3.new } { nop memb(r16++#1) = r3 } :endloop0 ''' r3 = self.rtbl[2] r4 = challenge r5 = r3+1 self.rtbl[2] = r5 r5 = r5 & 0xFF r6 = self.rtbl[3] r3 = self.tbl[r3] r3 = r6+r3 #r7 = self.tbl[r5] self.rtbl[3] = r3 & 0xFF r3 = r3 & 0xFF r0 = self.rtbl[1] r14 = self.rtbl[0] #r12 = self.tbl[r0] #r13 = self.tbl[r3] r8 = self.tbl[r0] r9 = self.tbl[r3] #r28 = self.tbl[r14] r15 = self.rtbl[4] #memb(r12+#0) = r9 self.tbl[r0]=r9 r18 = self.tbl[r14] #memb(r13+#0) = r18 self.tbl[r3]=r18 #r5 = self.tbl[r5] #memb(r28+#0) = r5 #self.tbl[r14]=r5 self.tbl[r14]=self.tbl[r5] #memb(r7+#0) = r8 self.tbl[r5] = r8 r1 = self.tbl[r8] r5 = r15+r1 self.rtbl[4] = r5 & 0xFF r5 = r5 & 0xFF r3 = self.tbl[r3] self.rtbl[1] = r4 r3 = r3+r8 r6 = self.tbl[r0] r7 = self.tbl[r14] r3 = r3 & 0xFF r5 = self.tbl[r5] r5 += r6+r7 r3 = self.tbl[r3] r5 = r5 & 0xFF r3 = r3 ^ r4 r5 = self.tbl[r5] r5 = self.tbl[r5] r3 = r3 ^ r5 self.rtbl[0] = r3 #Fix tmp = self.rtbl[0] self.rtbl[0] = self.rtbl[1] self.rtbl[1] = tmp #Fix return r3 def SierraMDM9x40(self, challenge): r1 = self.rtbl[4] r3 = self.rtbl[3] r2 = r1 + 1 r4 = self.tbl[r1] r5 = self.rtbl[0] r1 = r3 + r4 r8 = r5 r3 = challenge r6 = self.rtbl[1] r4 = r1 & 0xFF r13 = r2 & 0xFF r9 = r6 r7 = self.tbl[r5] r15 = r4 r14 = r13 r28 = self.tbl[r4] r12 = self.rtbl[2] self.tbl[r8] = r28 self.rtbl[1] = r3 #Issue with decompiler, Radare2 was fine, IDA sucked r8 = self.tbl[r6] self.rtbl[3] = r1 & 0xFF self.tbl[r15] = r8 self.rtbl[4] = r2 r8 = self.tbl[r13] self.tbl[r9] = r8 self.tbl[r14] = r7 r9 = self.tbl[r7] r8 = self.tbl[r4] r4 = r12 + r9 r7 = r8 + r7 r5 = self.tbl[r5] r6 = self.tbl[r6] r9 = r4 & 0xFF r8 = r7 & 0xFF self.rtbl[2] = r4 & 0xFF r7 = self.tbl[r9] r8 = self.tbl[r8] r7 = r7 + (r5 + r6) r5 = r8 ^ r3 r6 = r7 & 0xFF r6 = self.tbl[r6] r3 = self.tbl[r6] r1 = r5 ^ r3 self.rtbl[0] = r1 #Issue with decompiler, Radare2 was fine, IDA sucked return r1 def SierraCalc9x30(self, challenge): r1 = self.rtbl[4] r3 = self.rtbl[3] r2 = r1 + 1 r4 = self.tbl[r1] r5 = self.rtbl[0] r1 = r3 + r4 r3 = challenge r6 = self.rtbl[1] r4 = r1 & 0xFF r13 = r2 & 0xFF r7 = self.tbl[r5] r28 = self.tbl[r4] r12 = self.rtbl[2] self.tbl[r5] = r28 self.rtbl[0] = r3 r8 = self.tbl[r6] self.rtbl[3] = r1 & 0xFF self.tbl[r4] = r8 self.rtbl[4] = r2 & 0xFF r8 = self.tbl[r13] self.tbl[r6] = r8 self.tbl[r13] = r7 r9 = self.tbl[r7] r8 = self.tbl[r4] r4 = r12 + r9 r7 = r8 + r7 r5 = self.tbl[r5] r6 = self.tbl[r6] r9 = r4 & 0xFF r8 = r7 & 0xFF self.rtbl[2] = r4 & 0xFF r7 = self.tbl[r9] r8 = self.tbl[r8] r7 = r7 + r5 + r6 r5 = r8 ^ r3 r6 = r7 & 0xFF r6 = self.tbl[r6] r3 = self.tbl[r6] r1 = r5 ^ r3 self.rtbl[1] = r1 ##Fix tmp = self.rtbl[1] self.rtbl[1] = self.rtbl[0] self.rtbl[0] = tmp ##Fix return r1 def SierraCalc9x07(self,challenge): r1 = self.rtbl[4] r3 = self.rtbl[2] r2 = r1 + 1 r4 = self.tbl[r1] r5 = self.rtbl[1] r1 = r3 + r4 r3 = challenge r6 = self.rtbl[3] r4 = r1 & 0xFF r13 = r2 & 0xFF r7 = self.tbl[r5] r28 = self.tbl[r4] r12 = self.rtbl[0] self.tbl[r5] = r28 self.rtbl[1] = r3 r8 = self.tbl[r6] self.rtbl[2] = r1 &0xFF self.tbl[r4] = r8 self.rtbl[4] = r2 r8 = self.tbl[r13] self.tbl[r6] = r8 self.tbl[r13] = r7 r9 = self.tbl[r7] r8 = self.tbl[r4] r4 = r12 + r9 r7 = r8 + r7 r5 = self.tbl[r5] r6 = self.tbl[r6] r9 = r4 & 0xFF r8 = r7 & 0xFF self.rtbl[0] = r4 &0xFF r7 = self.tbl[r9] r8 = self.tbl[r8] r7 = r7 + (r5 + r6) r5 = r8 ^ r3 r6 = r7 & 0xFF r6 = self.tbl[r6] r3 = self.tbl[r6] r1 = r5 ^ r3 self.rtbl[3] = r1 ##Fix tmp = self.rtbl[3] self.rtbl[3] = self.rtbl[1] self.rtbl[1] = tmp ##Fix return r1 def SierraCalc9x15(self, challenge): r6 = self.rtbl[4] r2 = self.rtbl[2] r3 = self.tbl[(r6 & 0xFF)] r5 = self.rtbl[1] r2 = r3 + r2 r6 = r6 + 1 & 0xFF r7 = challenge r3 = self.tbl[(r5 & 0xFF)] r2 = r2 & 0xFF r4 = self.rtbl[3] r8 = self.rtbl[0] r9 = self.tbl[(r2 & 0xFF)] self.rtbl[2] = r2 self.tbl[(r5 & 0xFF)] = r9 self.rtbl[4] = r6 r9 = self.tbl[(r4 & 0xFF)] self.rtbl[1] = r7 self.tbl[(r2 & 0xFF)] = r9 r9 = self.tbl[(r6 & 0xFF)] self.tbl[(r4 & 0xFF)] = r9 self.tbl[(r6 & 0xFF)] = r3 r9 = self.tbl[(r3 & 0xFF)] r6 = self.tbl[(r5 & 0xFF)] r8 = r9 + r8 r5 = self.tbl[(r4 & 0xFF)] r2 = self.tbl[(r2 & 0xFF)] r4 = r8 & 0xFF r3 = r2 + r3 r3 = r3 & 0xFF r2 = self.tbl[(r4 & 0xFF)] self.rtbl[0] = r4 r2 += r6 + r5 r3 = self.tbl[(r3 & 0xFF)] r2 = r2 & 0xFF r2 = self.tbl[(r2 & 0xFF)] r2 = self.tbl[(r2 & 0xFF)] r2 = r2 ^ (r7 ^ r3) r2 = r2 & 0xFF self.rtbl[3] = r2 ##Fix tmp = self.rtbl[3] self.rtbl[3] = self.rtbl[1] self.rtbl[1] = tmp ##Fix # r1 = r1+1 # memb (r17 + r1 << #0) = r2 return r2 class SierraGenerator(): tbl=bytearray() rtbl=bytearray() def __init__(self): for i in range(0, 0x14): self.rtbl.append(0x0) for i in range(0, 0x100): self.tbl.append(0x0) def run(self, devicegeneration, challenge, type): challenge = bytearray(unhexlify(challenge)) self.devicegeneration=devicegeneration if not devicegeneration in prodtable: print("Sorry, "+devicegeneration+" not supported.") exit(0) mepid = prodtable[devicegeneration]["openmep"] cndid = prodtable[devicegeneration]["opencnd"] lockid = prodtable[devicegeneration]["openlock"] clen=prodtable[devicegeneration]["clen"] if len(challenge)<clen: for i in range(0,clen-len(challenge)): challenge.append(0) challengelen=len(challenge) if type==0: #lockkey idf=lockid elif type==1: #mepkey idf=mepid elif type==2: #cndkey idf=cndid key = keytable[idf * 16:(idf * 16) + 16] resp = self.SierraKeygen(challenge, key, challengelen, 16)[:challengelen] resp=hexlify(resp).decode('utf-8').upper() return resp def test(self): #MSM9200 expected=AT!OPENLOCK?BE96CBBEE0829BCA => EEDBF8BFF8DAE346 (!OPENLOCK), 84E7405583ED5845 (!OPENMEP) #EM7305 expected=AT!OPENLOCK?8101A18AB3C3E66A => D1E128FCA8A963ED devicegeneration="MSM9200" challenge="BE96CBBEE0829BCA" openlock,openmep,opencnd=self.run(devicegeneration,challenge) if devicegeneration=="MSM9200": if openlock=="EEDBF8BFF8DAE346" and openmep=="84E7405583ED5845": challenge = "8101A18AB3C3E66A" openlock, openmep, opencnd = self.run(devicegeneration, challenge) if openlock == "D1E128FCA8A963ED": print("MSM9200 passed") elif devicegeneration=="MDM9x40": if openlock == "1033773720F6EE66": print("MDM9x40 passed") def SierraPreInit(self,counter, key, keylen, challengelen, mcount): if counter!=0: tmp2=0 i=1 while (i<counter): i=2*i+1 while (True): tmp=mcount mcount=tmp+1 challengelen=(key[tmp&0xFF] + self.tbl[(challengelen&0xFF)])&0xFF if (mcount>=keylen): mcount=0 challengelen = ((challengelen&0xFF)+keylen)&0xFF tmp2=tmp2+1 tmp3=((challengelen&0xFF) & i)&0xFF if tmp2>=0xB: tmp3=counter%tmp3 if tmp3 <= counter: break counter=tmp3 & 0xFF return [counter,challengelen,mcount] def SierraInit(self, key, keylen): if keylen==0 or keylen>0x20: retval=[0, keylen] elif keylen >= 1 and keylen <= 0x20: for i in range(0,0x100): self.tbl[i]=i&0xFF mcount=0 cl=keylen&0xffffff00 i=0xFF while i>-1: t,cl,mcount=self.SierraPreInit(i, key, keylen, cl, mcount) m=self.tbl[i] self.tbl[i]=self.tbl[(t&0xff)] i = i - 1 self.tbl[(t&0xFF)]=m self.rtbl[0]=self.tbl[prodtable[self.devicegeneration]["init"][0]] if prodtable[self.devicegeneration]["init"][0]!=0 else self.tbl[(cl&0xFF)] self.rtbl[1]=self.tbl[prodtable[self.devicegeneration]["init"][1]] if prodtable[self.devicegeneration]["init"][1]!=0 else self.tbl[(cl&0xFF)] self.rtbl[2]=self.tbl[prodtable[self.devicegeneration]["init"][2]] if prodtable[self.devicegeneration]["init"][2]!=0 else self.tbl[(cl&0xFF)] self.rtbl[3]=self.tbl[prodtable[self.devicegeneration]["init"][3]] if prodtable[self.devicegeneration]["init"][3]!=0 else self.tbl[(cl&0xFF)] self.rtbl[4]=self.tbl[prodtable[self.devicegeneration]["init"][4]] if prodtable[self.devicegeneration]["init"][4]!=0 else self.tbl[(cl&0xFF)] retval=[1, keylen] return retval def sierra_calc8F(self, challenge, a=0, b=1, c=2, d=3, e=4, ret=0, ret2=2): #MDM9200 self.rtbl[b] = (self.rtbl[b] + self.tbl[(self.rtbl[d] & 0xFF)]) & 0xFF uVar2 = self.rtbl[c] & 0xFF bVar1 = self.tbl[uVar2] uVar4 = self.rtbl[b] & 0xFF self.tbl[uVar2] = self.tbl[uVar4] self.rtbl[d] = (self.rtbl[d] + 1)&0xFF uVar5 = self.rtbl[a] & 0xFF self.tbl[uVar4] = self.tbl[uVar5] uVar3 = self.rtbl[d] & 0xFF self.tbl[uVar5] = self.tbl[uVar3] self.tbl[uVar3] = bVar1 self.rtbl[ret] = challenge #c self.rtbl[ret2] = self.tbl[self.tbl[(self.tbl[(self.rtbl[e] + self.tbl[bVar1]) & 0xFF] + (self.tbl[uVar5] & 0xFF) + (self.tbl[uVar2] & 0xFF) & 0xff) & 0xFF] & 0xFF] ^ self.tbl[((self.tbl[uVar4] & 0xFF) + (bVar1 & 0xff))&0xFF] ^ challenge #a self.rtbl[e] = (self.rtbl[e] + self.tbl[bVar1])&0xFF return self.rtbl[ret2] & 0xFF #a def SierraAlgo(self, challenge,a=0,b=1,c=2,d=3,e=4,ret=3,ret2=1,flag=1): #M9x15 v6=self.rtbl[e] v0 = (v6 + 1) & 0xFF self.rtbl[e]=v0 self.rtbl[c] = (self.tbl[v6+flag & 0xFF] + self.rtbl[c]) & 0xFF v4 = self.rtbl[c] & 0xFF v2 = self.rtbl[b] & 0xFF v1 = self.tbl[(v2&0xFF)] self.tbl[(v2&0xFF)] = self.tbl[(v4&0xFF)] v5=self.rtbl[d]&0xFF self.tbl[(v4&0xFF)] = self.tbl[(v5&0xFF)] self.tbl[(v5&0xFF)] = self.tbl[(v0&0xFF)] self.tbl[v0] = v1&0xFF u = self.tbl[(self.tbl[(self.tbl[((self.rtbl[a] + self.tbl[(v1&0xFF)])&0xFF)] + self.tbl[(v5&0xFF)] + self.tbl[(v2&0xFF)] &0xff)]&0xFF)] v = self.tbl[((self.tbl[(v4 & 0xFF)] + v1) & 0xFF)] self.rtbl[ret] = u ^ v ^ challenge self.rtbl[a] = (self.tbl[(v1 & 0xFF)]+self.rtbl[a]) & 0xFF self.rtbl[ret2] = challenge & 0xFF return self.rtbl[ret]&0xFF def SierraFinish(self): for i in range(0,0x100): self.tbl[i]=0 self.rtbl[0]=0 self.rtbl[1]=0 self.rtbl[2]=0 self.rtbl[3]=0 self.rtbl[4]=0 return 1 def SierraKeygen(self, challenge, key, challengelen,keylen): resultbuffer=bytearray() for i in range(0,0x100+1): resultbuffer.append(0x0) ret, keylen = self.SierraInit(key, keylen) if ret: for i in range(0,challengelen): exec(prodtable[self.devicegeneration]["run"]) self.SierraFinish() return resultbuffer def readreply(ser): info=[] while (True): tmp=ser.readline().decode('utf-8').replace('\r','').replace('\n','') if ("OK" in info): return info elif ("ERROR" in info) or info=="": return -1 info.append(tmp) return info def main(args): version = "1.0" info = 'Sierra Wireless Generator ' + version + ' (c) B. Kerler 2019' parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=info) parser.add_argument( '-openlock', '-l', help='AT!OPENLOCK? modem response', default="") parser.add_argument( '-openmep', '-m', help='AT!OPENMEP? modem response', default="") parser.add_argument( '-opencnd', '-c', help='AT!OPENCND? modem response', default="") parser.add_argument( '-devicegeneration', '-d', help='Device devicegeneration generation', default="") parser.add_argument( '-port', '-p', help='use com port for auto unlock', default="") parser.add_argument( '-unlock', '-u', help='use com port for auto unlock', default=False, action='store_true') args = parser.parse_args() openlock = args.openlock openmep = args.openmep opencnd = args.opencnd devicegeneration = args.devicegeneration if (devicegeneration == "" or (openlock == "" and openmep == "" and opencnd == "")) and not args.unlock: print(info) print("------------------------------------------------------------\n") print("Usage: ./sierrakeygen [-l,-m,-c] [challenge] -d [devicegeneration]") print("Example: ./sierrakeygen.py -l BE96CBBEE0829BCA -d MDM9200") print("or: ./sierrakeygen.py -u for auto unlock") print("or: ./sierrakeygen.py -u -p [portname] for auto unlock with given portname") print("Supported devicegenerations :") for key in infotable: info = f"\t{key}:\t\t" count = 0 for item in infotable[key]: count += 1 if (count > 15): info += "\n\t\t\t\t\t" count = 0 info += item + "," info = info[:-1] print(info) exit(0) if devicegeneration == "" and not args.unlock: print("You need to specific a device generation as well. Option -d") exit(0) keygen = SierraGenerator() port = "" if args.unlock: import serial.tools.list_ports if args.port != "": port = args.port else: for port in serial.tools.list_ports.comports(): if port.vid == 0x1199: portid = port.location[-1:] if int(portid) == 3: port = port.device print("Detected Sierra Wireless device at: " + port) break if port != "": ser = serial.Serial(port=port, baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=1) ser.write(b"ATI\r") info = readreply(ser) if info != -1: for line in info: if "Revision" in line: if "SWI9X15" in line: devicegeneration = "MDM9x15" elif "SWI9X30" in line: devicegeneration = "MDM9x30" elif "SWI9X40" in line: devicegeneration = "MDM9x40" elif "SWI9X50" in line: devicegeneration = "MDM9x50" break else: print("Error on getting ATI modem response. Wrong port? Aborting.") ser.close() exit(0) if devicegeneration == "": print("Unknown device generation. Please send me details :)") else: print("Device generation detected: " + devicegeneration) print("Sending AT!ENTERCND=\"A710\" request.") ser.write(b"AT!ENTERCND=\"A710\"\r") info = readreply(ser) if info == -1: print("Uhoh ... invalid entercnd password. Aborting ...") ser.close() exit(0) print("Sending AT!OPENLOCK? request") ser.write(b"AT!OPENLOCK?\r") info = readreply(ser) challenge = "" if info != -1: if len(info) > 2: challenge = info[1] else: print("Error on AT!OPENLOCK? request. Aborting.") ser.close() exit(0) if challenge == "": print("Error: Couldn't get challenge. Aborting.") ser.close() exit(0) resp = keygen.run(devicegeneration, challenge, 0) print("Sending AT!OPENLOCK=\"" + resp + "\" response.") ser.write(bytes("AT!OPENLOCK=\"" + resp + "\"\r", "utf-8")) info = readreply(ser) if info == -1: print("Damn. AT!OPENLOCK failed.") else: print("Success. Device is now engineer unlocked.") ser.close() exit(0) else: if openlock != "": resp = keygen.run(devicegeneration, openlock, 0) print("AT!OPENLOCK=\"" + resp + "\"") # -l BE96CBBEE0829BCA -d MDM9x40 ==> AT!OPENLOCK="1033773720F6EE66" elif openmep != "": resp = keygen.run(devicegeneration, openmep, 1) print("AT!OPENMEP=\"" + resp + "\"") elif opencnd != "": resp = keygen.run(devicegeneration, opencnd, 2) print("AT!OPENCND=\"" + resp + "\"") if __name__ == '__main__': main(sys.argv) - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +450 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Unlock Code
3
- emoji: 🐨
4
- colorFrom: pink
5
  colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: unlock-code
3
+ emoji: 🐳
4
+ colorFrom: blue
5
  colorTo: red
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,450 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Sierra Wireless Unlock Code Generator</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .gradient-bg {
11
+ background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
12
+ }
13
+ .device-card:hover {
14
+ transform: translateY(-5px);
15
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
16
+ }
17
+ .result-box {
18
+ transition: all 0.3s ease;
19
+ }
20
+ .copy-btn {
21
+ transition: all 0.2s ease;
22
+ }
23
+ .copy-btn:hover {
24
+ background-color: #3b82f6;
25
+ color: white;
26
+ }
27
+ .copy-btn:active {
28
+ transform: scale(0.95);
29
+ }
30
+ .tab-active {
31
+ border-bottom: 3px solid #3b82f6;
32
+ color: #3b82f6;
33
+ font-weight: 600;
34
+ }
35
+ </style>
36
+ </head>
37
+ <body class="bg-gray-50 min-h-screen">
38
+ <div class="gradient-bg text-white py-8 shadow-lg">
39
+ <div class="container mx-auto px-4">
40
+ <div class="flex items-center justify-between">
41
+ <div>
42
+ <h1 class="text-3xl font-bold flex items-center">
43
+ <i class="fas fa-unlock-alt mr-3"></i>
44
+ Sierra Wireless Unlock Code Generator
45
+ </h1>
46
+ <p class="text-blue-100 mt-2">Generate unlock codes for Sierra Wireless devices</p>
47
+ </div>
48
+ <div class="hidden md:block">
49
+ <div class="bg-white bg-opacity-20 rounded-full px-4 py-2 flex items-center">
50
+ <i class="fas fa-shield-alt mr-2"></i>
51
+ <span>Secure Calculation</span>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
57
+
58
+ <div class="container mx-auto px-4 py-8">
59
+ <div class="bg-white rounded-xl shadow-lg overflow-hidden">
60
+ <div class="flex border-b">
61
+ <button id="tab-generator" class="px-6 py-4 tab-active">Code Generator</button>
62
+ <button id="tab-devices" class="px-6 py-4 text-gray-600">Supported Devices</button>
63
+ <button id="tab-info" class="px-6 py-4 text-gray-600">Information</button>
64
+ </div>
65
+
66
+ <!-- Generator Tab -->
67
+ <div id="generator-content" class="p-6">
68
+ <div class="grid md:grid-cols-2 gap-8">
69
+ <div>
70
+ <h2 class="text-xl font-semibold mb-4">Generate Unlock Code</h2>
71
+
72
+ <div class="mb-6">
73
+ <label class="block text-gray-700 mb-2 font-medium">Device Generation</label>
74
+ <select id="device-generation" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
75
+ <option value="">Select a device generation</option>
76
+ <option value="MDM8200">MDM8200</option>
77
+ <option value="MDM9200">MDM9200</option>
78
+ <option value="MDM9200_V1">MDM9200_V1</option>
79
+ <option value="MDM9200_V2">MDM9200_V2</option>
80
+ <option value="MDM9200_V3">MDM9200_V3</option>
81
+ <option value="MDM9x15">MDM9x15</option>
82
+ <option value="MDM9x28">MDM9x28</option>
83
+ <option value="MDM9x30">MDM9x30</option>
84
+ <option value="MDM9x30_V1">MDM9x30_V1</option>
85
+ <option value="MDM9x40">MDM9x40</option>
86
+ <option value="MDM9x50">MDM9x50</option>
87
+ <option value="MDM9x50_V1">MDM9x50_V1</option>
88
+ </select>
89
+ </div>
90
+
91
+ <div class="mb-6">
92
+ <label class="block text-gray-700 mb-2 font-medium">Challenge Type</label>
93
+ <div class="flex space-x-4">
94
+ <label class="inline-flex items-center">
95
+ <input type="radio" name="challenge-type" value="openlock" checked class="h-4 w-4 text-blue-600 focus:ring-blue-500">
96
+ <span class="ml-2">OPENLOCK</span>
97
+ </label>
98
+ <label class="inline-flex items-center">
99
+ <input type="radio" name="challenge-type" value="openmep" class="h-4 w-4 text-blue-600 focus:ring-blue-500">
100
+ <span class="ml-2">OPENMEP</span>
101
+ </label>
102
+ <label class="inline-flex items-center">
103
+ <input type="radio" name="challenge-type" value="opencnd" class="h-4 w-4 text-blue-600 focus:ring-blue-500">
104
+ <span class="ml-2">OPENCND</span>
105
+ </label>
106
+ </div>
107
+ </div>
108
+
109
+ <div class="mb-6">
110
+ <label class="block text-gray-700 mb-2 font-medium">Challenge Code</label>
111
+ <input id="challenge-code" type="text" placeholder="Enter challenge code (e.g., BE96CBBEE0829BCA)" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
112
+ </div>
113
+
114
+ <button id="generate-btn" class="gradient-bg text-white px-6 py-3 rounded-lg font-medium hover:opacity-90 transition duration-300 flex items-center justify-center w-full">
115
+ <i class="fas fa-calculator mr-2"></i>
116
+ Generate Unlock Code
117
+ </button>
118
+ </div>
119
+
120
+ <div>
121
+ <h2 class="text-xl font-semibold mb-4">Result</h2>
122
+ <div id="result-container" class="bg-gray-50 border border-gray-200 rounded-lg p-6 h-64 flex flex-col justify-center items-center">
123
+ <div class="text-center text-gray-500">
124
+ <i class="fas fa-lock-open text-4xl mb-3"></i>
125
+ <p>Your unlock code will appear here</p>
126
+ </div>
127
+ </div>
128
+
129
+ <div id="copy-section" class="mt-4 hidden">
130
+ <div class="flex">
131
+ <input id="result-code" type="text" readonly class="flex-grow px-4 py-2 border border-gray-300 rounded-l-lg bg-gray-50">
132
+ <button id="copy-btn" class="copy-btn bg-gray-200 text-gray-700 px-4 py-2 rounded-r-lg border border-l-0 border-gray-300">
133
+ <i class="fas fa-copy mr-1"></i> Copy
134
+ </button>
135
+ </div>
136
+ <div id="copy-success" class="text-green-600 mt-2 hidden">
137
+ <i class="fas fa-check-circle mr-1"></i> Copied to clipboard!
138
+ </div>
139
+ </div>
140
+
141
+ <div class="mt-6 bg-blue-50 border-l-4 border-blue-500 p-4 rounded hidden" id="usage-instruction">
142
+ <div class="flex">
143
+ <div class="flex-shrink-0">
144
+ <i class="fas fa-info-circle text-blue-500"></i>
145
+ </div>
146
+ <div class="ml-3">
147
+ <h3 class="text-sm font-medium text-blue-800">Usage Instruction</h3>
148
+ <div id="command-text" class="mt-2 text-sm text-blue-700">
149
+ </div>
150
+ </div>
151
+ </div>
152
+ </div>
153
+ </div>
154
+ </div>
155
+ </div>
156
+
157
+ <!-- Devices Tab -->
158
+ <div id="devices-content" class="p-6 hidden">
159
+ <h2 class="text-xl font-semibold mb-6">Supported Devices</h2>
160
+
161
+ <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
162
+ <div class="device-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:shadow-md">
163
+ <h3 class="font-bold text-lg text-blue-600 mb-2">MDM8200</h3>
164
+ <ul class="text-gray-600 space-y-1">
165
+ <li>M81A, M81B</li>
166
+ <li>AC880, AC881</li>
167
+ <li>MC8780, MC8781</li>
168
+ <li>AC880E, AC881E</li>
169
+ <li>EM8780, EM8781</li>
170
+ <li>MC8780V, MC8781V</li>
171
+ <li>MC8700, AC308U</li>
172
+ </ul>
173
+ </div>
174
+
175
+ <div class="device-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:shadow-md">
176
+ <h3 class="font-bold text-lg text-blue-600 mb-2">MDM9200</h3>
177
+ <ul class="text-gray-600 space-y-1">
178
+ <li>AC710, MC8775</li>
179
+ <li>MC8775V, AC875</li>
180
+ <li>MC8700, AC313U</li>
181
+ <li>MC8801, MC7700</li>
182
+ <li>MC7750, MC7710</li>
183
+ <li>EM7700</li>
184
+ </ul>
185
+ </div>
186
+
187
+ <div class="device-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:shadow-md">
188
+ <h3 class="font-bold text-lg text-blue-600 mb-2">MDM9x15</h3>
189
+ <ul class="text-gray-600 space-y-1">
190
+ <li>SWI9X15C, AR7550</li>
191
+ <li>AR7552, AR7554</li>
192
+ <li>EM7355, EM7655</li>
193
+ <li>MC7354, WP7100</li>
194
+ <li>WP7102, WP7104</li>
195
+ <li>MC7305, EM7305</li>
196
+ <li>MC8805, EM8805</li>
197
+ <li>MC7350, MC7350-L</li>
198
+ <li>MC7802, MC7304</li>
199
+ <li>AR7556, AR7558</li>
200
+ <li>WP75xx, WP85xx</li>
201
+ <li>WP8548, WP8548G</li>
202
+ <li>AC340U</li>
203
+ </ul>
204
+ </div>
205
+
206
+ <div class="device-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:shadow-md">
207
+ <h3 class="font-bold text-lg text-blue-600 mb-2">MDM9x28</h3>
208
+ <ul class="text-gray-600 space-y-1">
209
+ <li>SWI9X07Y</li>
210
+ <li>WP76xx</li>
211
+ </ul>
212
+ </div>
213
+
214
+ <div class="device-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:shadow-md">
215
+ <h3 class="font-bold text-lg text-blue-600 mb-2">MDM9x30</h3>
216
+ <ul class="text-gray-600 space-y-1">
217
+ <li>EM7455, MC7455</li>
218
+ <li>EM7430, MC7430</li>
219
+ </ul>
220
+ </div>
221
+
222
+ <div class="device-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:shadow-md">
223
+ <h3 class="font-bold text-lg text-blue-600 mb-2">MDM9x40</h3>
224
+ <ul class="text-gray-600 space-y-1">
225
+ <li>AC815s</li>
226
+ <li>AC785s</li>
227
+ </ul>
228
+ </div>
229
+
230
+ <div class="device-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:shadow-md">
231
+ <h3 class="font-bold text-lg text-blue-600 mb-2">MDM9x50</h3>
232
+ <ul class="text-gray-600 space-y-1">
233
+ <li>EM7565</li>
234
+ <li>EM7565-9</li>
235
+ <li>EM7511</li>
236
+ </ul>
237
+ </div>
238
+
239
+ <div class="device-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:shadow-md">
240
+ <h3 class="font-bold text-lg text-blue-600 mb-2">MDM9x50_V1</h3>
241
+ <ul class="text-gray-600 space-y-1">
242
+ <li>Netgear MR1100</li>
243
+ </ul>
244
+ </div>
245
+ </div>
246
+ </div>
247
+
248
+ <!-- Info Tab -->
249
+ <div id="info-content" class="p-6 hidden">
250
+ <h2 class="text-xl font-semibold mb-6">About Sierra Wireless Unlock Codes</h2>
251
+
252
+ <div class="bg-blue-50 border-l-4 border-blue-500 p-4 rounded mb-6">
253
+ <div class="flex">
254
+ <div class="flex-shrink-0">
255
+ <i class="fas fa-info-circle text-blue-500"></i>
256
+ </div>
257
+ <div class="ml-3">
258
+ <h3 class="text-sm font-medium text-blue-800">What are Sierra Wireless Unlock Codes?</h3>
259
+ <div class="mt-2 text-sm text-blue-700">
260
+ <p>Sierra Wireless devices use challenge-response authentication for unlocking certain features. This tool generates the correct response code based on the challenge provided by your device.</p>
261
+ </div>
262
+ </div>
263
+ </div>
264
+ </div>
265
+
266
+ <div class="space-y-6">
267
+ <div>
268
+ <h3 class="font-medium text-lg text-gray-800 mb-2">How to use this tool</h3>
269
+ <ol class="list-decimal list-inside space-y-2 text-gray-700">
270
+ <li>Connect to your Sierra Wireless device using a terminal program</li>
271
+ <li>Send the appropriate AT command to get a challenge code:
272
+ <ul class="list-disc list-inside ml-6 mt-1">
273
+ <li><code>AT!OPENLOCK?</code> for device unlock</li>
274
+ <li><code>AT!OPENMEP?</code> for MEP unlock</li>
275
+ <li><code>AT!OPENCND?</code> for CND unlock</li>
276
+ </ul>
277
+ </li>
278
+ <li>Enter the challenge code in this tool along with your device generation</li>
279
+ <li>Generate the response code and send it back to your device</li>
280
+ </ol>
281
+ </div>
282
+
283
+ <div>
284
+ <h3 class="font-medium text-lg text-gray-800 mb-2">Common AT Commands</h3>
285
+ <div class="bg-gray-800 rounded-lg p-4 text-gray-100 overflow-x-auto">
286
+ <pre class="text-sm">
287
+ <span class="text-green-400"># Get device information</span>
288
+ ATI
289
+
290
+ <span class="text-green-400"># Get OPENLOCK challenge</span>
291
+ AT!OPENLOCK?
292
+
293
+ <span class="text-green-400"># Submit OPENLOCK response</span>
294
+ AT!OPENLOCK="XXXXXXXXXXXXXX"
295
+
296
+ <span class="text-green-400"># Enter CND mode (password is often A710)</span>
297
+ AT!ENTERCND="A710"
298
+
299
+ <span class="text-green-400"># Reset device to factory defaults</span>
300
+ AT!RESET
301
+
302
+ <span class="text-green-400"># Enable ADB on some devices</span>
303
+ AT!CUSTOM="ADBENABLE",1</pre>
304
+ </div>
305
+ </div>
306
+
307
+ <div class="border-t pt-6">
308
+ <h3 class="font-medium text-lg text-gray-800 mb-2">Disclaimer</h3>
309
+ <p class="text-gray-600">
310
+ This tool is provided for educational purposes only. Unlocking your device may void your warranty or violate your service agreement. Use at your own risk.
311
+ </p>
312
+ </div>
313
+ </div>
314
+ </div>
315
+ </div>
316
+ </div>
317
+
318
+ <footer class="bg-gray-100 border-t py-6 mt-8">
319
+ <div class="container mx-auto px-4 text-center text-gray-600">
320
+ <p>Sierra Wireless Unlock Code Generator &copy; 2023</p>
321
+ <p class="mt-1 text-sm">This is a frontend demonstration. Actual code generation requires server-side implementation.</p>
322
+ </div>
323
+ </footer>
324
+
325
+ <script>
326
+ // Tab switching
327
+ document.getElementById('tab-generator').addEventListener('click', function() {
328
+ document.getElementById('tab-generator').classList.add('tab-active');
329
+ document.getElementById('tab-devices').classList.remove('tab-active');
330
+ document.getElementById('tab-info').classList.remove('tab-active');
331
+ document.getElementById('generator-content').classList.remove('hidden');
332
+ document.getElementById('devices-content').classList.add('hidden');
333
+ document.getElementById('info-content').classList.add('hidden');
334
+ });
335
+
336
+ document.getElementById('tab-devices').addEventListener('click', function() {
337
+ document.getElementById('tab-generator').classList.remove('tab-active');
338
+ document.getElementById('tab-devices').classList.add('tab-active');
339
+ document.getElementById('tab-info').classList.remove('tab-active');
340
+ document.getElementById('generator-content').classList.add('hidden');
341
+ document.getElementById('devices-content').classList.remove('hidden');
342
+ document.getElementById('info-content').classList.add('hidden');
343
+ });
344
+
345
+ document.getElementById('tab-info').addEventListener('click', function() {
346
+ document.getElementById('tab-generator').classList.remove('tab-active');
347
+ document.getElementById('tab-devices').classList.remove('tab-active');
348
+ document.getElementById('tab-info').classList.add('tab-active');
349
+ document.getElementById('generator-content').classList.add('hidden');
350
+ document.getElementById('devices-content').classList.add('hidden');
351
+ document.getElementById('info-content').classList.remove('hidden');
352
+ });
353
+
354
+ // Generate button click handler
355
+ document.getElementById('generate-btn').addEventListener('click', function() {
356
+ const deviceGeneration = document.getElementById('device-generation').value;
357
+ const challengeType = document.querySelector('input[name="challenge-type"]:checked').value;
358
+ const challengeCode = document.getElementById('challenge-code').value.trim();
359
+
360
+ if (!deviceGeneration) {
361
+ alert('Please select a device generation');
362
+ return;
363
+ }
364
+
365
+ if (!challengeCode) {
366
+ alert('Please enter a challenge code');
367
+ return;
368
+ }
369
+
370
+ // In a real implementation, this would call a server-side API
371
+ // For demo purposes, we'll simulate a response
372
+ simulateCodeGeneration(deviceGeneration, challengeType, challengeCode);
373
+ });
374
+
375
+ // Copy button handler
376
+ document.getElementById('copy-btn').addEventListener('click', function() {
377
+ const resultCode = document.getElementById('result-code');
378
+ resultCode.select();
379
+ document.execCommand('copy');
380
+
381
+ const copySuccess = document.getElementById('copy-success');
382
+ copySuccess.classList.remove('hidden');
383
+
384
+ setTimeout(() => {
385
+ copySuccess.classList.add('hidden');
386
+ }, 2000);
387
+ });
388
+
389
+ // Simulate code generation (demo only)
390
+ function simulateCodeGeneration(deviceGeneration, challengeType, challengeCode) {
391
+ // Show loading state
392
+ const resultContainer = document.getElementById('result-container');
393
+ resultContainer.innerHTML = `
394
+ <div class="text-center">
395
+ <div class="inline-block animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-blue-500 mb-3"></div>
396
+ <p>Generating unlock code...</p>
397
+ </div>
398
+ `;
399
+
400
+ // Simulate API delay
401
+ setTimeout(() => {
402
+ // This is just a demo - in a real app, you'd call your backend
403
+ const demoResponses = {
404
+ "MDM8200": "EEDBF8BFF8DAE346",
405
+ "MDM9200": "84E7405583ED5845",
406
+ "MDM9x15": "D1E128FCA8A963ED",
407
+ "MDM9x30": "1033773720F6EE66",
408
+ "MDM9x40": "8A2B3C4D5E6F7A8B",
409
+ "MDM9x50": "9C8D7E6F5A4B3C2D"
410
+ };
411
+
412
+ const responseCode = demoResponses[deviceGeneration] || "A1B2C3D4E5F67890";
413
+
414
+ // Update UI with result
415
+ resultContainer.innerHTML = `
416
+ <div class="text-center">
417
+ <div class="inline-flex items-center justify-center h-12 w-12 rounded-full bg-green-100 mb-3">
418
+ <i class="fas fa-check text-green-600"></i>
419
+ </div>
420
+ <h3 class="text-lg font-medium text-gray-900">Unlock Code Generated</h3>
421
+ <p class="mt-1 text-gray-600">For ${deviceGeneration}</p>
422
+ </div>
423
+ `;
424
+
425
+ // Show result and copy section
426
+ document.getElementById('result-code').value = responseCode;
427
+ document.getElementById('copy-section').classList.remove('hidden');
428
+
429
+ // Show usage instruction
430
+ const commandText = document.getElementById('command-text');
431
+ const atCommand = challengeType === 'openlock' ? 'OPENLOCK' :
432
+ challengeType === 'openmep' ? 'OPENMEP' : 'OPENCND';
433
+
434
+ commandText.innerHTML = `
435
+ <p>Send this command to your device:</p>
436
+ <div class="mt-2 bg-gray-100 p-2 rounded font-mono text-sm">
437
+ AT!${atCommand}="${responseCode}"
438
+ </div>
439
+ `;
440
+ document.getElementById('usage-instruction').classList.remove('hidden');
441
+ }, 1500);
442
+ }
443
+
444
+ // Auto-focus challenge code input when device generation is selected
445
+ document.getElementById('device-generation').addEventListener('change', function() {
446
+ document.getElementById('challenge-code').focus();
447
+ });
448
+ </script>
449
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=HKM999/unlock-code" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
450
+ </html>