dynamic_analysis.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:dynamic-firmware-analysis 作者: secjey 项目源码 文件源码
def get_architecture(firmware_id):
    """Gets the architecture of the given firmware image.""" 
    print(bcolors.OKBLUE + "[-] Getting the firmware architecture..." + bcolors.ENDC)
    command = GETARCH_COMMAND.format(FIRMADYNE_PATH, OUTPUT_DIR, firmware_id)
    print(bcolors.ITALIC + command + bcolors.ENDC)
    output = pexpect.run(command, events={'Password for user {}:'.format(USER):PASSWORD + '\n'})
    # extract the architecture info from the output
    arch = ""
    try:
        arch = output.split('\n')[0].split(':')[1]
    except:
        print(bcolors.FAIL + "[!] The firmware architecture couldn't be determined..." + bcolors.ENDC)
        print(bcolors.ITALIC + "[!] Please try manually with the file command and provide the correct architecture type with the --arch parameter..." + bcolors.ENDC)
    else:
        print(bcolors.OKGREEN + "[+] The architecture of your firmware image is:" + arch + bcolors.ENDC)
    return arch
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号