穷举法解华为bl锁
- python3代码
- 测试截图
灵感来自于:https://blog.csdn.net/qq_40169767/article/details/90481748
但是我不懂shell脚本,那个脚本又运行不了,所以我用python写了一个,
穷举要0.05s*9999999999999999/60*60*24*365=15,854,895年
不推荐使用,如果你时间多运气好的话可以试试,
python3代码
使用 adb reboot bootloader 命令 让手机进入fastboot模式后运行此代码即可
import subprocess
import random
import io
import logging# 日志配置
logging.basicConfig(filename='fuckBl.log',level=logging.DEBUG , format=' %(asctime)s - %(levelname)s - %(message)s')# 执行命令并返回结果
def execCommond(cmd):logging.info(cmd)proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)proc.wait()stream_stdout = io.TextIOWrapper(proc.stdout, encoding='utf-8')stream_stderr = io.TextIOWrapper(proc.stderr, encoding='utf-8')str_stdout = str(stream_stdout.read())str_stderr = str(stream_stderr.read())logging.info(str_stdout)logging.warning(str_stderr)result=str_stdout+str_stderrreturn result# 测试一个码是否成功
def testAKey(key):result=execCommond('fastboot oem unlock %s'%(str(key)))if 'OKAY' in result:return Truereturn False# 检测当前设备解锁状态
def checkDeviceStatus():result=execCommond('fastboot oem get-bootinfo')if 'locked' in result:return Falsereturn True# 获取设备列表(fastboot)
def getDevices():result=execCommond('fastboot devices')results=result.split('\n')return resultscurrentNum=0# 获取一个码 可选是否随机
def getCode(random=True):global currentNumnum=0if random:num=random.randint(0,9999999999999999)else:num=currentNumcurrentNum=currentNum+1return str(num).zfill(16)# 测试循环
def main():deviceStatus=checkDeviceStatus()while True:code=getCode(random=False) # 可修改为True使用随机变量if testAKey(code) and checkDeviceStatus():print('尝试 {%s} : √'%(code))breakprint('尝试 {%s} : ×'%(code))print('解锁成功:{%s}'%(code),)if __name__ == '__main__':main()