在使用angrutils生成控制流图时出错,它先报FileNotFoundError: [Errno 2] No such file or directory: ‘dot’ : ‘dot’,然后再处理此错误时又引发"dot" not found in path错误,现在记录一下解决错误的过程。
1 首先贴出angr源码
import angr
import claripy
from angrutils import *
def main():
proj = angr.Project('aa',load_options={"auto_load_libs":False})
print("----------static----------")
main = proj.loader.main_object.get_symbol("main")
start_state = proj.factory.blank_state(addr=main.rebased_addr)
cfgs = proj.analyses.CFGFast()
plot_cfg(cfgs,"static",asminst=True,remove_imports=True,remove_path_terminator=True)
if __name__=="__main__":
main()
经检测发现是下面一句话导致出错。
plot_cfg(cfgs,"static",asminst=True,remove_imports=True,remove_path_terminator=True)
2 出错结果如下所示
3解决思路
不要使用pip安装graphviz,而使用yum安装,且先安装graphviz再安装pydot,命令如下所示
yum insall graphviz
pip install pydot
最后生成.png图,说明成功解决此问题。