Joern是一个源码分析工具,可以分析程序的源码,生成代码属性图。然后可以根据代码属性图,提取你想要的程序的信息,比如控制流图,数据流图等等。
这个工具主要是这篇论文的结果:
https://fabs.codeminers.org/papers/2014-ieeesp.pdf
老版本安装
官方链接:https://joern.readthedocs.io/en/latest/installation.html
老版本安装的话,可能会遇到的问题是neo4j的老版本比较难下载。一些博客也给出了解决方案:https://blog.csdn.net/water_likly/article/details/88415127
新版本安装
官方链接:https://joern.io/docs/installing/
按照官方文档安装,基本没出现什么问题。
下面简单介绍一下安装。
依赖库
- Java 8 :http://openjdk.java.net/install/
- python 3:https://www.python.org/downloads/
安装预先build好的二进制程序
wget https://github.com/ShiftLeftSecurity/joern/releases/latest/download/joern-cli.zip
wget https://github.com/ShiftLeftSecurity/joern/releases/latest/download/joern-server.zip
unzip joern-cli.zip
unzip joern-server.zip
安装一下cpgclientlib
这个库
pip3 install cpgclientlib
或者源码安装这个库
git clone https://github.com/ShiftLeftSecurity/codepropertygraph.git
cd codepropertygraph/cpgclientlib
sudo python3 setup.py install
依赖装好以后,build一下源码,这个过程应该会比较长
git clone https://github.com/ShiftLeftSecurity/joern.git
cd joern
sbt stage
设置一下分配的内存大小
在命令行输入下面这行代码,下面的代码表示分配4g的内存给jvm,当然你也可以分配别的大小的内存。
export _JAVA_OPTS="-Xmx4G"
测试一下安装的结果
cd joern
./joern