diff --git a/README.md b/README.md index 9e0312c..e98f3dc 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ But if you read my code and realize what it is about, ping me at yz at 9pm.me an # 0x3 Tools -## python_api/dpt-tools.py +## dpt-tools.py NOTE: Use at your own risk. I have tested this on my MacBook. You need `pip install httpsig` if you don't have it already. It only runs on Python 3. diff --git a/python_api/dpt-tools.py b/dpt-tools.py similarity index 91% rename from python_api/dpt-tools.py rename to dpt-tools.py index 5c7f6bf..c806162 100644 --- a/python_api/dpt-tools.py +++ b/dpt-tools.py @@ -5,9 +5,9 @@ import argparse # lib -from libDPT import DPT -from libDPT import update_firmware -from libDPT import obtain_diagnosis_access +from python_api.libDPT import DPT +from python_api.libDPT import update_firmware +from python_api.libDPT import obtain_diagnosis_access def print_info(): @@ -46,6 +46,8 @@ def interactive(dpt): break elif cmd == 'fw': update_firmware(dpt) + elif cmd == 'help' or cmd == 'h': + print_info() def main(): diff --git a/python_api/libDPT.py b/python_api/libDPT.py index 5751f58..1c89fe9 100644 --- a/python_api/libDPT.py +++ b/python_api/libDPT.py @@ -14,7 +14,10 @@ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) def validateRequiredFiles(dpt): - requiredFiles = ['shankerzhiwu_disableidcheck.pkg', 'shankerzhiwu_changepwd.pkg'] + requiredFiles = [ + 'python_api/shankerzhiwu_disableidcheck.pkg', + 'python_api/shankerzhiwu_changepwd.pkg' + ] dpt.dbg_print('Checking required files...') for file in requiredFiles: if not os.path.isfile(file): @@ -27,10 +30,11 @@ def disable_id_check(dpt): ''' disable the id check (thanks to shankerzhiwu and his/her friend) ''' + fp = 'python_api/shankerzhiwu_disableidcheck.pkg' try: resp = input('>>> Have you disabled the id check already? [yes/no]: ') if resp == 'no': - if not dpt.update_firmware(open('shankerzhiwu_disableidcheck.pkg', 'rb')): + if not dpt.update_firmware(open(fp, 'rb')): dpt.err_print('Failed to upload shankerzhiwu_disableidcheck pkg') return False try: @@ -55,8 +59,9 @@ def reset_root_password(dpt): ''' reset the root password (thanks to shankerzhiwu and his/her friend) ''' + fp = 'python_api/shankerzhiwu_changepwd.pkg' try: - if not dpt.update_firmware(open('shankerzhiwu_changepwd.pkg', 'rb')): + if not dpt.update_firmware(open(fp, 'rb')): dpt.err_print('Failed to upload shankerzhiwu_changepwd pkg') return False return True