def network_setup(firmware_id, arch):
"""Determines the network configuration of the firmware by emulating it for a certain amount of time."""
runtime = 60
print(bcolors.OKBLUE + "[-] Determining the network configuration of the firmware..." + bcolors.ENDC)
print(bcolors.OKBLUE + "[-] The firmware will now be running for {} seconds...".format(runtime) + bcolors.ENDC)
command = INFERNETWORK_COMMAND.format(FIRMADYNE_PATH, firmware_id) + " " + arch
print(bcolors.ITALIC + command + bcolors.ENDC)
setup = pexpect.spawn(command, timeout=runtime + 5)
# info should be provided as regards the interfaces available to access the emulated firmware
setup.expect('Interfaces: \[(.*)\]\n')
if setup.match.group(1) == "":
print(bcolors.WARNING + "[!] No network interface could be determined..." + bcolors.ENDC)
return False
else:
print(bcolors.OKGREEN + "[+] Your firmware will be accessible at {}!".format(setup.match.group(1)) + bcolors.ENDC)
return True
dynamic_analysis.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录