graph LR
User_Interface_CLI_GUI_["User Interface (CLI & GUI)"]
Device_Communication_Low_Level_Operations["Device Communication & Low-Level Operations"]
Download_Agent_DA_Management["Download Agent (DA) Management"]
Hardware_Security_Cryptography["Hardware Security & Cryptography"]
Exploitation_Tools["Exploitation & Tools"]
Partition_Storage_Management["Partition & Storage Management"]
Application_Configuration["Application Configuration"]
Core_Utilities_Error_Handling["Core Utilities & Error Handling"]
User_Interface_CLI_GUI_ -- "controls" --> Device_Communication_Low_Level_Operations
User_Interface_CLI_GUI_ -- "controls" --> Download_Agent_DA_Management
User_Interface_CLI_GUI_ -- "configures via" --> Application_Configuration
User_Interface_CLI_GUI_ -- "relies on" --> Core_Utilities_Error_Handling
Device_Communication_Low_Level_Operations -- "provides access to" --> Hardware_Security_Cryptography
Device_Communication_Low_Level_Operations -- "supported by" --> Core_Utilities_Error_Handling
Download_Agent_DA_Management -- "orchestrates" --> Device_Communication_Low_Level_Operations
Download_Agent_DA_Management -- "manages" --> Partition_Storage_Management
Download_Agent_DA_Management -- "utilizes" --> Hardware_Security_Cryptography
Download_Agent_DA_Management -- "reads from" --> Application_Configuration
Download_Agent_DA_Management -- "utilizes" --> Core_Utilities_Error_Handling
Hardware_Security_Cryptography -- "performs operations via" --> Device_Communication_Low_Level_Operations
Hardware_Security_Cryptography -- "supported by" --> Core_Utilities_Error_Handling
Exploitation_Tools -- "orchestrates" --> Device_Communication_Low_Level_Operations
Exploitation_Tools -- "targets" --> Hardware_Security_Cryptography
Exploitation_Tools -- "configures via" --> Application_Configuration
Exploitation_Tools -- "utilizes" --> Core_Utilities_Error_Handling
Partition_Storage_Management -- "provides data to" --> Download_Agent_DA_Management
Partition_Storage_Management -- "supported by" --> Core_Utilities_Error_Handling
Application_Configuration -- "provides settings to" --> User_Interface_CLI_GUI_
Application_Configuration -- "provides settings to" --> Download_Agent_DA_Management
Application_Configuration -- "provides settings to" --> Exploitation_Tools
Application_Configuration -- "utilizes" --> Core_Utilities_Error_Handling
Core_Utilities_Error_Handling -- "provides services to" --> User_Interface_CLI_GUI_
Core_Utilities_Error_Handling -- "provides services to" --> Device_Communication_Low_Level_Operations
Core_Utilities_Error_Handling -- "provides services to" --> Download_Agent_DA_Management
Core_Utilities_Error_Handling -- "provides services to" --> Hardware_Security_Cryptography
Core_Utilities_Error_Handling -- "provides services to" --> Exploitation_Tools
Core_Utilities_Error_Handling -- "provides services to" --> Partition_Storage_Management
Core_Utilities_Error_Handling -- "provides services to" --> Application_Configuration
click User_Interface_CLI_GUI_ href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/mtkclient/User Interface (CLI & GUI).md" "Details"
click Device_Communication_Low_Level_Operations href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/mtkclient/Device Communication & Low-Level Operations.md" "Details"
click Download_Agent_DA_Management href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/mtkclient/Download Agent (DA) Management.md" "Details"
click Hardware_Security_Cryptography href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/mtkclient/Hardware Security & Cryptography.md" "Details"
click Exploitation_Tools href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/mtkclient/Exploitation & Tools.md" "Details"
click Partition_Storage_Management href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/mtkclient/Partition & Storage Management.md" "Details"
click Application_Configuration href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/mtkclient/Application Configuration.md" "Details"
click Core_Utilities_Error_Handling href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/mtkclient/Core Utilities & Error Handling.md" "Details"
The mtkclient architecture is designed to interact with MediaTek devices, offering both command-line and graphical interfaces. Its core functionality revolves around a robust Device Communication & Low-Level Operations component that handles fundamental device interactions, supported by a sophisticated Download Agent (DA) Management system for flashing and advanced operations. Security features are managed by the Hardware Security & Cryptography component, while the Exploitation & Tools component provides capabilities for bypassing device security. Partition and storage layouts are handled by the Partition & Storage Management, with all operations being configurable through the Application Configuration and supported by a comprehensive Core Utilities & Error Handling module.
This component provides the primary interaction points for users, offering both a command-line interface for scripting and automated tasks, and a graphical user interface for visual control and ease of use. It handles argument parsing, orchestrates the overall application flow, and translates user actions into calls to underlying device operation components.
Related Classes/Methods:
mtkclient.mtk:main(45:1000)mtkclient.Library.mtk_main.Main(167:719)mtkclient.Library.mtk_main.ArgHandler(24:164)mtkclient.mtk_gui:main(504:554)mtkclient.mtk_gui.MainWindow(125:501)mtkclient.mtk_gui.DeviceHandler(52:67)mtkclient.gui.main_gui.Ui_MainWindow(26:849)
This component provides the foundational capabilities for interacting with MediaTek devices at a low level. It manages USB and serial connections, handles basic read/write operations, and includes functionalities for interacting with the device's preloader and performing stage2 operations for initial device access and memory manipulation.
Related Classes/Methods:
mtkclient.Library.Connection.usblib.UsbClass(97:596)mtkclient.Library.Connection.seriallib.SerialClass(28:309)mtkclient.Library.Port.Port(15:220)mtkclient.Library.Connection.devicehandler.DeviceClass(12:152)mtkclient.Library.Connection.usbscsi.Scsi(full file reference)mtkclient.stage2.Stage2(21:490)mtkclient.Tools.preloader_emu_mmc.Stage2(26:211)mtkclient.Library.mtk_preloader.Preloader(39:901)
This central component manages the various Download Agent (DA) protocols used for flashing, reading, and other advanced operations on MediaTek devices. It orchestrates the selection and utilization of specific DA protocol handlers (XML, XFlash, Legacy) based on device requirements, providing a unified interface for DA-based interactions.
Related Classes/Methods:
mtkclient.Library.DA.mtk_daloader.DAloader(24:436)mtkclient.Library.DA.mtk_da_handler.DaHandler(21:944)mtkclient.Library.DA.daconfig.DAconfig(141:286)mtkclient.Library.DA.xml.xml_lib.DAXML(full file reference)mtkclient.Library.DA.xflash.xflash_lib.DAXFlash(30:1000)mtkclient.Library.DA.legacy.dalegacy_lib.DALegacy(47:999)
This component provides an abstraction layer for interacting with various hardware cryptographic units (GCPU, DXCC, SEJ) and manages security configurations on MediaTek SoCs. It handles cryptographic operations, secure boot settings, and fuse management, abstracting the complexities of different hardware implementations.
Related Classes/Methods:
mtkclient.Library.Hardware.hwcrypto.HwCrypto(32:140)mtkclient.Library.Hardware.hwcrypto_gcpu.GCpu(195:696)mtkclient.Library.Hardware.hwcrypto_dxcc.Dxcc(full file reference)mtkclient.Library.Hardware.hwcrypto_sej.Sej(107:808)mtkclient.Library.Hardware.seccfg.SecCfgV3(146:297)mtkclient.Library.Hardware.seccfg.SecCfgV4(11:110)
This component provides a structured framework for implementing and executing various exploits designed to bypass security measures on MediaTek devices. It includes specific exploit implementations (e.g., Amonet, Kamakiri) and general tools for deeper access and control over the device.
Related Classes/Methods:
mtkclient.Library.exploit_handler.Exploitation(13:155)mtkclient.Library.Exploit.amonet.Amonet(12:137)mtkclient.Library.Exploit.kamakiri.Kamakiri(15:171)mtkclient.Library.Exploit.hashimoto.Hashimoto(11:106)mtkclient.Library.Exploit.kamakiri2.Kamakiri2(16:266)mtkclient.Library.Exploit.kamakiripl.KamakiriPl(13:99)mtkclient.Library.pltools.PLTools(17:180)
This component is responsible for parsing, reading, and potentially writing device partition tables, including GPT (GUID Partition Table), EBR (Extended Boot Record), and PMT (Partition Management Table), to understand and manipulate the device's storage layouts.
Related Classes/Methods:
mtkclient.Library.gpt.GPT(30:347)mtkclient.Library.partition.Partition(11:136)mtkclient.Library.ebr.Ebr(30:44)mtkclient.Library.pmt.PMT(11:48)
This component manages global application settings, defines paths to various payloads and loaders, and handles device-specific configuration parameters. It ensures the application operates correctly by providing centralized access to configuration data.
Related Classes/Methods:
mtkclient.config.mtk_config.MtkConfig(18:278)mtkclient.config.payloads.PathConfig(5:20)mtkclient.Library.settings.HwParam(6:51)mtkclient.config.brom_config.Chipconfig(full file reference)
This component provides a collection of common helper functions, data manipulation routines, and a centralized mechanism for reporting and handling errors across the entire application. It serves as a foundational support layer for other components.
Related Classes/Methods:
mtkclient.Library.utils(full file reference)mtkclient.Library.error.ErrorHandler(986:999)mtkclient.Library.cryptutils.CryptUtils(75:500)