minor tweaks

This commit is contained in:
HappyZ 2018-11-16 00:52:50 -06:00
parent 17338afb74
commit ef37294dfc
3 changed files with 14 additions and 7 deletions

View File

@ -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.

View File

@ -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():

View File

@ -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