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
dynamic_analysis.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录