Add gui unlocking

This commit is contained in:
Bjoern Kerler 2022-01-01 19:25:59 +01:00
parent 7c80529657
commit f5132337f8
16 changed files with 232 additions and 505 deletions

55
mtk_gui
View file

@ -23,7 +23,7 @@ from mtkclient.Library.mtk_main import Main, Mtk_Config
from mtkclient.gui.readFlashPartitions import ReadFlashWindow
from mtkclient.gui.writeFlashPartitions import WriteFlashWindow
from mtkclient.gui.eraseFlashPartitions import EraseFlashWindow
from mtkclient.gui.toolsMenu import generateKeysMenu
from mtkclient.gui.toolsMenu import generateKeysMenu, UnlockMenu
from mtkclient.gui.toolkit import asyncThread, trap_exc_during_debug, convert_size, CheckBox, FDialog, TimeEstim
from mtkclient.config.payloads import pathconfig
from mtkclient.gui.main_gui import Ui_MainWindow
@ -142,22 +142,25 @@ class MainWindow(QMainWindow):
"currentPartition"]):
doneBytes = doneBytes + self.Status["allPartitions"][partition]['size']
else:
totalBytes = self.Status["currentPartitionSize"]
doneBytes = doneBytes + self.Status["currentPartitionSizeDone"]
percentageDone = (self.Status["currentPartitionSizeDone"] / self.Status["currentPartitionSize"]) * 100
fullPercentageDone = (doneBytes / totalBytes) * 100
self.ui.partProgress.setValue(percentageDone)
timeinfo = self.timeEst.update(doneBytes, totalBytes)
txt="Current partition: " + self.Status["currentPartition"] + " (" + \
convert_size(self.Status["currentPartitionSizeDone"]) + " / " + \
convert_size(self.Status["currentPartitionSize"])+") "+ \
timeinfo+QCoreApplication.translate("main"," left")
self.ui.partProgressText.setText(txt)
if "currentPartitionSize" in self.Status:
totalBytes = self.Status["currentPartitionSize"]
self.ui.fullProgress.setValue(fullPercentageDone)
timeinfototal = self.timeEstTotal.update(fullPercentageDone, 100)
self.ui.fullProgressText.setText("Total: (" + convert_size(doneBytes) + " / " + convert_size(totalBytes)+") "+
timeinfototal + QCoreApplication.translate("main"," left"))
if "currentPartitionSize" in self.Status:
doneBytes = doneBytes + self.Status["currentPartitionSizeDone"]
percentageDone = (self.Status["currentPartitionSizeDone"] / self.Status["currentPartitionSize"]) * 100
fullPercentageDone = (doneBytes / totalBytes) * 100
self.ui.partProgress.setValue(percentageDone)
timeinfo = self.timeEst.update(doneBytes, totalBytes)
txt="Current partition: " + self.Status["currentPartition"] + " (" + \
convert_size(self.Status["currentPartitionSizeDone"]) + " / " + \
convert_size(self.Status["currentPartitionSize"])+") "+ \
timeinfo+QCoreApplication.translate("main"," left")
self.ui.partProgressText.setText(txt)
self.ui.fullProgress.setValue(fullPercentageDone)
timeinfototal = self.timeEstTotal.update(fullPercentageDone, 100)
self.ui.fullProgressText.setText("Total: (" + convert_size(doneBytes) + " / " + convert_size(totalBytes)+") "+
timeinfototal + QCoreApplication.translate("main"," left"))
def updateStateAsync(self, toolkit, parameters):
while not self.Status["done"]:
@ -203,6 +206,11 @@ class MainWindow(QMainWindow):
self.genkeys = generateKeysMenu(self.ui, self, self.devhandler, self.devhandler.da_handler, self.sendToLog)
self.ui.generatekeybtn.clicked.connect(self.on_generatekeys)
def initunlock(self):
self.unlock = UnlockMenu(self.ui, self, self.devhandler, self.devhandler.da_handler, self.sendToLog)
self.ui.unlockbutton.clicked.connect(self.on_unlock)
self.ui.lockbutton.clicked.connect(self.on_lock)
def initerase(self):
self.eraseflash = EraseFlashWindow(self.ui, self, self.devhandler, self.devhandler.da_handler, self.sendToLog)
self.ui.eraseselectallpartitionscheckbox.clicked.connect(self.eraseflash.selectAll)
@ -237,6 +245,10 @@ class MainWindow(QMainWindow):
self.ui.erasepreloaderbtn.setEnabled(False)
self.ui.eraserpmbbtn.setEnabled(False)
self.ui.generatekeybtn.setEnabled(False)
self.ui.unlockbutton.setEnabled(False)
self.ui.lockbutton.setEnabled(False)
def enablebuttons(self):
self.ui.readpreloaderbtn.setEnabled(True)
self.ui.readpartitionsbtn.setEnabled(True)
@ -254,6 +266,10 @@ class MainWindow(QMainWindow):
self.ui.erasepreloaderbtn.setEnabled(True)
self.ui.eraserpmbbtn.setEnabled(True)
self.ui.generatekeybtn.setEnabled(True)
self.ui.unlockbutton.setEnabled(True)
self.ui.lockbutton.setEnabled(True)
def getpartitions(self):
data, guid_gpt = self.devhandler.mtkClass.daloader.get_gpt()
if guid_gpt is None:
@ -375,6 +391,12 @@ class MainWindow(QMainWindow):
self.genkeys.generateKeys()
return
def on_unlock(self):
self.unlock.unlock("unlock")
def on_lock(self):
self.unlock.unlock("lock")
def on_readpreloader(self):
self.readflash.dumpFlash("boot1")
return
@ -415,6 +437,7 @@ class MainWindow(QMainWindow):
self.ui.spinner_pic.setHidden(True)
self.initread()
self.initkeys()
self.initunlock()
self.initerase()
self.initwrite()
self.getpartitions()

View file

@ -121,8 +121,7 @@ class legacyext(metaclass=LogBase):
def seccfg(self, lockflag):
if lockflag not in ["unlock", "lock"]:
print("Valid flags are: unlock, lock")
return False
return False, "Valid flags are: unlock, lock"
hwc = self.cryptosetup()
sc_org = seccfg(hwc)
data, guid_gpt = self.legacy.partition.get_gpt(self.mtk.config.gpt_settings, "user")
@ -137,14 +136,12 @@ class legacyext(metaclass=LogBase):
filename="", parttype="user", display=False)
break
if seccfg_data is None:
self.error("Couldn't detect existing seccfg partition. Aborting unlock.")
return False
return False, "Couldn't detect existing seccfg partition. Aborting unlock."
if seccfg_data[:4] != pack("<I", 0x4D4D4D4D):
self.error("Unknown seccfg partition header. Aborting unlock.")
return False
return False, "Unknown seccfg partition header. Aborting unlock."
if not sc_org.parse(seccfg_data):
return False
return False, "Error on parsing seccfg."
sc_new = seccfg(hwc)
self.setotp(hwc)
hwtype = "hw"
@ -157,16 +154,13 @@ class legacyext(metaclass=LogBase):
hwtype = "sw"
sc_new.create(sc_org=sc_org, hwtype=hwtype)
if sc_org.hash != sc_new.hash:
self.error("Device has is either already unlocked or algo is unknown. Aborting.")
return False
return False, "Device has is either already unlocked or algo is unknown. Aborting."
writedata = sc_new.create(sc_org=None, hwtype=hwtype, lockflag=lockflag, V3=V3)
if self.legacy.writeflash(addr=partition.sector * self.mtk.daloader.daconfig.pagesize,
length=len(writedata),
filename=None, wdata=writedata, parttype="user", display=True):
self.info("Successfully wrote seccfg.")
return True
self.error("Error on writing seccfg config to flash.")
return False
return True, "Successfully wrote seccfg."
return False, "Error on writing seccfg config to flash."
def generate_keys(self):
hwc = self.cryptosetup()

View file

@ -649,7 +649,11 @@ class DA_handler(metaclass=LogBase):
elif subcmd == "generatekeys":
mtk.daloader.keys()
elif subcmd == "seccfg":
mtk.daloader.seccfg(args.flag)
v=mtk.daloader.seccfg(args.flag)
if v[0]:
self.info(v[1])
else:
self.error(v[1])
elif subcmd == "rpmb":
rpmb_subcmd = args.rpmb_subcmd
if rpmb_subcmd is None:

View file

@ -473,16 +473,14 @@ class xflashext(metaclass=LogBase):
def seccfg(self, lockflag):
if lockflag not in ["unlock", "lock"]:
print("Valid flags are: unlock, lock")
return False
return False, "Valid flags are: unlock, lock"
hwc = self.cryptosetup()
sc_org = seccfg(hwc)
data, guid_gpt = self.xflash.partition.get_gpt(self.mtk.config.gpt_settings, "user")
seccfg_data = None
partition = None
if guid_gpt is None:
self.error("Error getting the partition table.")
return False
return False, "Error getting the partition table."
for rpartition in guid_gpt.partentries:
if rpartition.name == "seccfg":
partition = rpartition
@ -492,14 +490,12 @@ class xflashext(metaclass=LogBase):
filename="", parttype="user", display=False)
break
if seccfg_data is None:
self.error("Couldn't detect existing seccfg partition. Aborting unlock.")
return False
return False, "Couldn't detect existing seccfg partition. Aborting unlock."
if seccfg_data[:4] != pack("<I", 0x4D4D4D4D):
self.error("Unknown seccfg partition header. Aborting unlock.")
return False
return False, "Unknown seccfg partition header. Aborting unlock."
if not sc_org.parse(seccfg_data):
return False
return False, "Error on parsing seccfg"
sc_new = seccfg(hwc)
self.setotp(hwc)
hwtype = "hw"
@ -512,16 +508,13 @@ class xflashext(metaclass=LogBase):
hwtype = "sw"
sc_new.create(sc_org=sc_org, hwtype=hwtype)
if sc_org.hash != sc_new.hash:
self.error("Device has is either already unlocked or algo is unknown. Aborting.")
return False
return False, "Device has is either already unlocked or algo is unknown. Aborting."
writedata = sc_new.create(sc_org=None, hwtype=hwtype, lockflag=lockflag, V3=V3)
if self.xflash.writeflash(addr=partition.sector * self.mtk.daloader.daconfig.pagesize,
length=len(writedata),
filename=None, wdata=writedata, parttype="user", display=True):
self.info("Successfully wrote seccfg.")
return True
self.error("Error on writing seccfg config to flash.")
return False
return True, "Successfully wrote seccfg."
return False, "Error on writing seccfg config to flash."
def generate_keys(self):
hwc = self.cryptosetup()

Binary file not shown.

View file

@ -306,6 +306,19 @@
<translation type="vanished">Partitionen zum Lesen auswählen</translation>
</message>
</context>
<context>
<name>UnlockMenu</name>
<message>
<location filename="../toolsMenu.py" line="22"/>
<source>Generating...</source>
<translation>Generiere ...</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="31"/>
<source>Bootloader: </source>
<translation>Bootloader: </translation>
</message>
</context>
<context>
<name>UnlockWindow</name>
<message>
@ -348,22 +361,22 @@
<context>
<name>generateKeysMenu</name>
<message>
<location filename="../toolsMenu.py" line="30"/>
<location filename="../toolsMenu.py" line="64"/>
<source>Keys generated!</source>
<translation>Schlüssel wurden generiert!</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="34"/>
<location filename="../toolsMenu.py" line="68"/>
<source>Generating...</source>
<translation>Generiere ...</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="35"/>
<location filename="../toolsMenu.py" line="69"/>
<source>Select output directory</source>
<translation>Speicherort für Dateien auswählen</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="50"/>
<location filename="../toolsMenu.py" line="84"/>
<source>Generating keys</source>
<translation>Generiere Schlüssel</translation>
</message>
@ -371,47 +384,47 @@
<context>
<name>main</name>
<message>
<location filename="../../../mtk_gui" line="154"/>
<location filename="../../../mtk_gui" line="160"/>
<location filename="../../../mtk_gui" line="157"/>
<location filename="../../../mtk_gui" line="163"/>
<source> left</source>
<translation> übrig</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="261"/>
<location filename="../../../mtk_gui" line="277"/>
<source>Error reading gpt</source>
<translation>Fehler beim Lesen der GPT</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="263"/>
<location filename="../../../mtk_gui" line="279"/>
<source>Select partitions to dump</source>
<translation>Partitionen zum Lesen auswählen</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="302"/>
<location filename="../../../mtk_gui" line="318"/>
<source>Set</source>
<translation>Auswählen</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="404"/>
<location filename="../../../mtk_gui" line="426"/>
<source>Phone detected:
Reading model info...</source>
<translation>Gerät erkannt
Lese Geräteinformation...</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="408"/>
<location filename="../../../mtk_gui" line="430"/>
<source>Device detected, please wait.
This can take a while...</source>
<translation>Gerät erkannt, bitte warten.
Dies kann eine Weile dauern...</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="410"/>
<location filename="../../../mtk_gui" line="432"/>
<source>Device connected :)</source>
<translation>Gerät verbunden :)</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="424"/>
<location filename="../../../mtk_gui" line="447"/>
<source>Error initialising. Did you install the drivers?</source>
<translation>Fehler beim Initialisieren. Sind alle Treiber installiert?</translation>
</message>

View file

@ -270,6 +270,19 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UnlockMenu</name>
<message>
<location filename="../toolsMenu.py" line="22"/>
<source>Generating...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../toolsMenu.py" line="31"/>
<source>Bootloader: </source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UnlockWindow</name>
<message>
@ -304,22 +317,22 @@
<context>
<name>generateKeysMenu</name>
<message>
<location filename="../toolsMenu.py" line="30"/>
<location filename="../toolsMenu.py" line="64"/>
<source>Keys generated!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../toolsMenu.py" line="34"/>
<location filename="../toolsMenu.py" line="68"/>
<source>Generating...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../toolsMenu.py" line="35"/>
<location filename="../toolsMenu.py" line="69"/>
<source>Select output directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../toolsMenu.py" line="50"/>
<location filename="../toolsMenu.py" line="84"/>
<source>Generating keys</source>
<translation type="unfinished"></translation>
</message>
@ -327,45 +340,45 @@
<context>
<name>main</name>
<message>
<location filename="../../../mtk_gui" line="154"/>
<location filename="../../../mtk_gui" line="160"/>
<location filename="../../../mtk_gui" line="157"/>
<location filename="../../../mtk_gui" line="163"/>
<source> left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="261"/>
<location filename="../../../mtk_gui" line="277"/>
<source>Error reading gpt</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="263"/>
<location filename="../../../mtk_gui" line="279"/>
<source>Select partitions to dump</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="302"/>
<location filename="../../../mtk_gui" line="318"/>
<source>Set</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="404"/>
<location filename="../../../mtk_gui" line="426"/>
<source>Phone detected:
Reading model info...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="408"/>
<location filename="../../../mtk_gui" line="430"/>
<source>Device detected, please wait.
This can take a while...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="410"/>
<location filename="../../../mtk_gui" line="432"/>
<source>Device connected :)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="424"/>
<location filename="../../../mtk_gui" line="447"/>
<source>Error initialising. Did you install the drivers?</source>
<translation type="unfinished"></translation>
</message>

Binary file not shown.

View file

@ -302,6 +302,19 @@
<translation type="vanished">Seleccioneu les particions per llegir</translation>
</message>
</context>
<context>
<name>UnlockMenu</name>
<message>
<location filename="../toolsMenu.py" line="22"/>
<source>Generating...</source>
<translation>Generar ...</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="31"/>
<source>Bootloader: </source>
<translation>Bootloader: </translation>
</message>
</context>
<context>
<name>UnlockWindow</name>
<message>
@ -344,22 +357,22 @@
<context>
<name>generateKeysMenu</name>
<message>
<location filename="../toolsMenu.py" line="30"/>
<location filename="../toolsMenu.py" line="64"/>
<source>Keys generated!</source>
<translation>Las claves fueron generadas!</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="34"/>
<location filename="../toolsMenu.py" line="68"/>
<source>Generating...</source>
<translation>Generar ...</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="35"/>
<location filename="../toolsMenu.py" line="69"/>
<source>Select output directory</source>
<translation>Seleccionar ubicació d&apos;emmagatzematge per als fitxers de sortida</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="50"/>
<location filename="../toolsMenu.py" line="84"/>
<source>Generating keys</source>
<translation>Generar les claus</translation>
</message>
@ -367,47 +380,47 @@
<context>
<name>main</name>
<message>
<location filename="../../../mtk_gui" line="154"/>
<location filename="../../../mtk_gui" line="160"/>
<location filename="../../../mtk_gui" line="157"/>
<location filename="../../../mtk_gui" line="163"/>
<source> left</source>
<translation> restant</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="261"/>
<location filename="../../../mtk_gui" line="277"/>
<source>Error reading gpt</source>
<translation>Error al llegir GPT</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="263"/>
<location filename="../../../mtk_gui" line="279"/>
<source>Select partitions to dump</source>
<translation>Seleccioneu les particions per llegir</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="302"/>
<location filename="../../../mtk_gui" line="318"/>
<source>Set</source>
<translation>Escollir</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="404"/>
<location filename="../../../mtk_gui" line="426"/>
<source>Phone detected:
Reading model info...</source>
<translation>Teléfono detectado:
Leyendo información del modelo ...</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="408"/>
<location filename="../../../mtk_gui" line="430"/>
<source>Device detected, please wait.
This can take a while...</source>
<translation>Dispositivo detectado, espere.
Esto puede tomar un tiempo...</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="410"/>
<location filename="../../../mtk_gui" line="432"/>
<source>Device connected :)</source>
<translation>Dispositivo conectado :)</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="424"/>
<location filename="../../../mtk_gui" line="447"/>
<source>Error initialising. Did you install the drivers?</source>
<translation>Error al inicializar. Instalaste los controladores?</translation>
</message>

Binary file not shown.

View file

@ -302,6 +302,19 @@
<translation type="vanished">Seleccione las particiones para leer</translation>
</message>
</context>
<context>
<name>UnlockMenu</name>
<message>
<location filename="../toolsMenu.py" line="22"/>
<source>Generating...</source>
<translation>Generar ...</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="31"/>
<source>Bootloader: </source>
<translation>Bootloader: </translation>
</message>
</context>
<context>
<name>UnlockWindow</name>
<message>
@ -344,22 +357,22 @@
<context>
<name>generateKeysMenu</name>
<message>
<location filename="../toolsMenu.py" line="30"/>
<location filename="../toolsMenu.py" line="64"/>
<source>Keys generated!</source>
<translation>Las claves fueron generadas!</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="34"/>
<location filename="../toolsMenu.py" line="68"/>
<source>Generating...</source>
<translation>Generar ...</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="35"/>
<location filename="../toolsMenu.py" line="69"/>
<source>Select output directory</source>
<translation>Seleccionar el directorio para los archivos de salida</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="50"/>
<location filename="../toolsMenu.py" line="84"/>
<source>Generating keys</source>
<translation>Generar las claves</translation>
</message>
@ -367,47 +380,47 @@
<context>
<name>main</name>
<message>
<location filename="../../../mtk_gui" line="154"/>
<location filename="../../../mtk_gui" line="160"/>
<location filename="../../../mtk_gui" line="157"/>
<location filename="../../../mtk_gui" line="163"/>
<source> left</source>
<translation> restante</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="261"/>
<location filename="../../../mtk_gui" line="277"/>
<source>Error reading gpt</source>
<translation>Error al leer GPT</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="263"/>
<location filename="../../../mtk_gui" line="279"/>
<source>Select partitions to dump</source>
<translation>Seleccione las particiones para leer</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="302"/>
<location filename="../../../mtk_gui" line="318"/>
<source>Set</source>
<translation>Escoger</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="404"/>
<location filename="../../../mtk_gui" line="426"/>
<source>Phone detected:
Reading model info...</source>
<translation>Teléfono detectado:
Leyendo información del modelo ...</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="408"/>
<location filename="../../../mtk_gui" line="430"/>
<source>Device detected, please wait.
This can take a while...</source>
<translation>Dispositivo detectado, espere.
Esto puede tomar un tiempo...</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="410"/>
<location filename="../../../mtk_gui" line="432"/>
<source>Device connected :)</source>
<translation>Dispositivo conectado :)</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="424"/>
<location filename="../../../mtk_gui" line="447"/>
<source>Error initialising. Did you install the drivers?</source>
<translation>Error al inicializar. Instalaste los controladores?</translation>
</message>

Binary file not shown.

View file

@ -302,6 +302,19 @@
<translation type="vanished">Sélectionnez les partitions à lire</translation>
</message>
</context>
<context>
<name>UnlockMenu</name>
<message>
<location filename="../toolsMenu.py" line="22"/>
<source>Generating...</source>
<translation>Générer ...</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="31"/>
<source>Bootloader: </source>
<translation></translation>
</message>
</context>
<context>
<name>UnlockWindow</name>
<message>
@ -344,22 +357,22 @@
<context>
<name>generateKeysMenu</name>
<message>
<location filename="../toolsMenu.py" line="30"/>
<location filename="../toolsMenu.py" line="64"/>
<source>Keys generated!</source>
<translation>Les clés ont é générées!</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="34"/>
<location filename="../toolsMenu.py" line="68"/>
<source>Generating...</source>
<translation>Générer ...</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="35"/>
<location filename="../toolsMenu.py" line="69"/>
<source>Select output directory</source>
<translation>Sélectionnez l&apos;emplacement de stockage pour les fichiers</translation>
</message>
<message>
<location filename="../toolsMenu.py" line="50"/>
<location filename="../toolsMenu.py" line="84"/>
<source>Generating keys</source>
<translation>Générer des clés</translation>
</message>
@ -367,47 +380,47 @@
<context>
<name>main</name>
<message>
<location filename="../../../mtk_gui" line="154"/>
<location filename="../../../mtk_gui" line="160"/>
<location filename="../../../mtk_gui" line="157"/>
<location filename="../../../mtk_gui" line="163"/>
<source> left</source>
<translation> restant</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="261"/>
<location filename="../../../mtk_gui" line="277"/>
<source>Error reading gpt</source>
<translation>Erreur de lecture GPT</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="263"/>
<location filename="../../../mtk_gui" line="279"/>
<source>Select partitions to dump</source>
<translation>Sélectionnez les partitions à lire</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="302"/>
<location filename="../../../mtk_gui" line="318"/>
<source>Set</source>
<translation>Choisir</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="404"/>
<location filename="../../../mtk_gui" line="426"/>
<source>Phone detected:
Reading model info...</source>
<translation>Téléphone détecté :
Lecture des informations sur le modèle...</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="408"/>
<location filename="../../../mtk_gui" line="430"/>
<source>Device detected, please wait.
This can take a while...</source>
<translation>Appareil détecté, veuillez patienter.
Cela peut prendre du temps...</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="410"/>
<location filename="../../../mtk_gui" line="432"/>
<source>Device connected :)</source>
<translation>Appareil connecté :)</translation>
</message>
<message>
<location filename="../../../mtk_gui" line="424"/>
<location filename="../../../mtk_gui" line="447"/>
<source>Error initialising. Did you install the drivers?</source>
<translation>Erreur d&apos;initialisation. As-tu installé les pilotes ?</translation>
</message>

Binary file not shown.

View file

@ -1,386 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="nl_NL">
<context>
<name>MainWindow</name>
<message>
<location filename="../main_gui.ui" line="32"/>
<location filename="../main_gui.ui" line="126"/>
<source>MTKClient v2.0</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="203"/>
<source>No phone detected.</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="190"/>
<source>&lt;b&gt;Made by:&lt;/b&gt; Bjoern Kerler&lt;br/&gt;&lt;b&gt;Gui by:&lt;/b&gt; Geert-Jan Kreileman&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Credits:&lt;/b&gt;&lt;br/&gt;kamakiri [xyzz]&lt;br/&gt;linecode exploit [chimera]&lt;br/&gt;Chaosmaster&lt;br/&gt;and all contributers&lt;/p&gt;</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="54"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Please connect a Mediatek phone to continue.&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Hint:&lt;/span&gt; Power off the phone before connecting.&lt;br/&gt;&lt;span style=&quot; font-style:italic; color:#393939;&quot;&gt;For brom mode:&lt;/span&gt;&lt;span style=&quot; color:#393939;&quot;&gt;&lt;br/&gt;Press and hold vol up, vol dwn, or all hw buttons and connect usb.&lt;br/&gt;&lt;/span&gt;&lt;span style=&quot; font-style:italic; color:#393939;&quot;&gt;For preloader mode:&lt;/span&gt;&lt;span style=&quot; color:#393939;&quot;&gt;&lt;br/&gt;Don&apos;t press any hw button and connect usb.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="344"/>
<location filename="../main_gui.ui" line="424"/>
<source>Read partition(s)</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="909"/>
<source>Read full flash</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="914"/>
<source>Read at offset</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="432"/>
<location filename="../main_gui.ui" line="498"/>
<location filename="../main_gui.ui" line="919"/>
<source>Write partition(s)</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="73"/>
<source>Ready to start...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="350"/>
<source>Dump GPT</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="357"/>
<location filename="../main_gui.ui" line="579"/>
<source>Select all partitions</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="414"/>
<source>Select partitions to read</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="450"/>
<source>Select partitions to write</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="505"/>
<source>Select from directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="531"/>
<source>Select partitions to erase</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="513"/>
<location filename="../main_gui.ui" line="586"/>
<source>Erase partition(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="594"/>
<source>Flash Tools</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="602"/>
<source>Read flash</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="647"/>
<source>Write flash</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="692"/>
<source>Erase preloader</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="699"/>
<source>Erase boot2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="706"/>
<source>Erase RPMB</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="730"/>
<source>Lock bootloader</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="737"/>
<source>Unlock bootloader</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="747"/>
<source>Keys</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="753"/>
<source>Generate Keys</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="785"/>
<location filename="../main_gui.ui" line="790"/>
<location filename="../main_gui.ui" line="795"/>
<location filename="../main_gui.ui" line="800"/>
<location filename="../main_gui.ui" line="805"/>
<location filename="../main_gui.ui" line="810"/>
<location filename="../main_gui.ui" line="815"/>
<source>Neue Zeile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="820"/>
<source>Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="825"/>
<source>Value</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="833"/>
<source>Ready.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="841"/>
<source>Debug Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="896"/>
<source>&amp;File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="904"/>
<source>Quit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="924"/>
<source>Write full flash</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="929"/>
<source>Write at offset</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="934"/>
<source>Erase partitions(s)</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="939"/>
<source>Erase at offset</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="979"/>
<source>Unlock / Lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="984"/>
<source>Lock device</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="989"/>
<source>&amp;Quit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="623"/>
<location filename="../main_gui.ui" line="944"/>
<source>Read RPMB</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="668"/>
<location filename="../main_gui.ui" line="949"/>
<source>Write RPMB</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="609"/>
<location filename="../main_gui.ui" line="954"/>
<source>Read preloader</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="959"/>
<source>Generate RPMB keys</source>
<translation></translation>
</message>
<message>
<location filename="../main_gui.ui" line="616"/>
<location filename="../main_gui.ui" line="964"/>
<source>Read boot2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="654"/>
<location filename="../main_gui.ui" line="969"/>
<source>Write preloader</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../main_gui.ui" line="661"/>
<location filename="../main_gui.ui" line="974"/>
<source>Write boot2</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ReadFlashWindow</name>
<message>
<location filename="../readFlashPartitions.py" line="38"/>
<source>Select output directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../readFlashPartitions.py" line="106"/>
<source>Ready to dump </source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UnlockWindow</name>
<message>
<location filename="../unlock_gui.ui" line="14"/>
<source>Lock / Unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../unlock_gui.ui" line="26"/>
<source>Unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../unlock_gui.ui" line="39"/>
<source>Lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../unlock_gui.ui" line="52"/>
<source>Close</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WriteFlashWindow</name>
<message>
<location filename="../writeFlashPartitions.py" line="24"/>
<source>Select input directory</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>generateKeysMenu</name>
<message>
<location filename="../toolsMenu.py" line="30"/>
<source>Keys generated!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../toolsMenu.py" line="34"/>
<source>Generating...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../toolsMenu.py" line="35"/>
<source>Select output directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../toolsMenu.py" line="50"/>
<source>Generating keys</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../../../mtk_gui" line="154"/>
<location filename="../../../mtk_gui" line="160"/>
<source> left</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="261"/>
<source>Error reading gpt</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="263"/>
<source>Select partitions to dump</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="302"/>
<source>Set</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="404"/>
<source>Phone detected:
Reading model info...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="408"/>
<source>Device detected, please wait.
This can take a while...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="410"/>
<source>Device connected :)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../mtk_gui" line="424"/>
<source>Error initialising. Did you install the drivers?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>self.parent</name>
<message>
<location filename="../toolkit.py" line="128"/>
<source>Select output file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../toolkit.py" line="144"/>
<source>Select input file</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -7,6 +7,41 @@ import sys
sys.excepthook = trap_exc_during_debug
class UnlockMenu(QObject):
# Partition
@Slot()
def updateLock(self):
self.parent.enablebuttons()
result = self.parent.Status['result'][1]
self.ui.partProgressText.setText(result)
self.sendToLogSignal.emit(self.tr(result))
def unlock(self, unlockflag):
self.parent.disablebuttons()
self.ui.partProgressText.setText(self.tr("Generating..."))
thread = asyncThread(self.parent, 0, self.UnlockAsync, [unlockflag])
thread.sendToLogSignal.connect(self.sendToLog)
thread.sendUpdateSignal.connect(self.updateLock)
thread.start()
def UnlockAsync(self, toolkit, parameters):
self.sendToLogSignal = toolkit.sendToLogSignal
self.sendUpdateSignal = toolkit.sendUpdateSignal
toolkit.sendToLogSignal.emit(self.tr("Bootloader: ")+parameters[0])
self.parent.Status["result"] = self.mtkClass.daloader.seccfg(parameters[0])
self.parent.Status["done"] = True
self.sendUpdateSignal.emit()
def __init__(self, ui, parent, devhandler, da_handler: DA_handler, sendToLog): # def __init__(self, *args, **kwargs):
super(UnlockMenu, self).__init__(parent)
self.parent = parent
self.ui = ui
self.fdialog = FDialog(parent)
self.mtkClass = devhandler.mtkClass
self.sendToLog = sendToLog
self.da_handler = da_handler
class generateKeysMenu(QObject):
# Partition
@ -14,14 +49,14 @@ class generateKeysMenu(QObject):
def updateKeys(self):
path = os.path.join(self.hwparamFolder, "hwparam.json")
self.ui.keystatuslabel.setText(self.tr(f"Keys saved to {path}."))
self.ui.generatekeybtn.setEnabled(True)
keycount = len(self.keysStatus['result'])
self.parent.enablebuttons()
keycount = len(self.parent.Status['result'])
self.ui.keytable.setRowCount(keycount)
self.ui.keytable.setColumnCount(2)
column = 0
for key in self.keysStatus['result']:
skey = self.keysStatus['result'][key]
for key in self.parent.Status['result']:
skey = self.parent.Status['result'][key]
if skey is not None:
self.ui.keytable.setItem(column, 0, QTableWidgetItem(key))
self.ui.keytable.setItem(column, 1, QTableWidgetItem(skey))
@ -29,11 +64,11 @@ class generateKeysMenu(QObject):
self.sendToLogSignal.emit(self.tr("Keys generated!"))
def generateKeys(self):
self.ui.generatekeybtn.setEnabled(False)
self.parent.disablebuttons()
self.ui.keystatuslabel.setText(self.tr("Generating..."))
hwparamFolder = self.fdialog.opendir(self.tr("Select output directory"))
if hwparamFolder == "":
self.ui.generatekeybtn.setEnabled(True)
self.parent.enablebuttons()
return
else:
self.mtkClass.config.set_hwparam_path(hwparamFolder)
@ -47,9 +82,9 @@ class generateKeysMenu(QObject):
self.sendToLogSignal = toolkit.sendToLogSignal
self.sendUpdateSignal = toolkit.sendUpdateSignal
toolkit.sendToLogSignal.emit(self.tr("Generating keys"))
self.keysStatus["result"] = self.mtkClass.daloader.keys()
self.parent.Status["result"] = self.mtkClass.daloader.keys()
# MtkTool.cmd_stage(mtkClass, None, None, None, False)
self.keysStatus["done"] = True
self.parent.Status["done"] = True
self.sendUpdateSignal.emit()
def __init__(self, ui, parent, devhandler, da_handler: DA_handler, sendToLog): # def __init__(self, *args, **kwargs):
@ -59,5 +94,4 @@ class generateKeysMenu(QObject):
self.fdialog = FDialog(parent)
self.mtkClass = devhandler.mtkClass
self.sendToLog = sendToLog
self.keysStatus = {}
self.da_handler = da_handler