JLang Build
JLang은 Java를 LLVM IR로 변환하는 리프팅 도구이며, APK 내 class 코드를 Java로 변환한 후 생성된 Java 파일을 JLang을 이용해 IR로 변환하여 대상 함수에 대한 IR 소스코드를 바탕으로 LibFuzzer을 이용하여 퍼징 테스트를 도와줄 수 있다.
[환경]
- 우분투 18.04
- JLang
$ git clone https://github.com/polyglot-compiler/JLang.git
- JDK 이전버전 제거
$ sudo apt-get remove openjdk*
$ sudo apt-get remove oracle*
$ sudo apt-get autoremove --purge
$ sudo apt-get autoclean
- JDK 7 설치
$ sudo mkdir -p /usr/local/java
$ sudo cp -r jdk-7u80-linux-x64.tar.gz /usr/local/java/
$ cd /usr/local/java
$ sudo tar xvzf jdk-7u80-linux-x64.tar.gz
$ sudo vim /etc/profile
==========================================
맨 밑에 추가
==========================================
JDK7=/usr/local/java/jdk1.7.0_80
JRE_HOME=/usr/local/java/jdk1.7.0_80
PATH=$PATH:$JDK7_HOME/bin:$JDK7_HOME/bin
export JDK7
export JDK7_HOME
export PATH
==========================================
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.7.0_80/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_80/bin/javac" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.7.0_80/bin/javaws" 1
$ sudo update-alternatives --set java /usr/local/java/jdk1.7.0_80/bin/java
$ sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_80/bin/javac
$ sudo update-alternatives --set javaws /usr/local/java/jdk1.7.0_80/bin/javaws
$ source /etc/profile
- JDK 8 설치
$ sudo mkdir -p /usr/local/java
$ sudo cp -r jdk-8u231-linux-x64.tar.gz /usr/local/java/
$ cd /usr/local/java
$ sudo tar xvzf jdk-8u231-linux-x64.tar.gz
$ sudo vim /etc/profile
==========================================
맨 밑에 추가
==========================================
JDK8=/usr/local/java/jdk1.8.0_231
JDK_HOME=/usr/local/java/jdk1.8.0_231
PATH=$PATH:$JDK_HOME/bin:$JDK_HOME/bin
export JDK
export JDK_HOME
export PATH
==========================================
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_231/bin/java" 2
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_231/bin/javac" 2
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_231/bin/javaws" 2
$ sudo update-alternatives --set java /usr/local/java/jdk1.8.0_231/bin/java
$ sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_231/bin/javac
$ sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_231/bin/javaws
$ source /etc/profile
- LLVM 5.0, Clang 5.0 설치 설치
버전 체크 : llc --version, clang++ --version
$ sudo apt-get install clang-5.0 llvm-5.0
$ sudo ln -s /usr/bin/clang++-5.0 /usr/bin/clang++
$ sudo ln -s /usr/bin/llc-5.0 /usr/bin/llc
- gc-7.6.4 설치
$ wget https://www.hboehm.info/gc/gc_source/gc-7.6.4.tar.gz
$ tar -xvf gc-7.6.4.tar.gz
$ cd gc-7.6.4/
$ git clone https://github.com/ivmai/libatomic_ops.git
$ brew install boehmgc
$ ./configure; make; sudo make install
- Git LFS 설치
$ sudo apt-get install curl
$ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
$ sudo apt-get install git-lfs
- ANT 설치
$ sudo apt-get install ant
- Boehm-Demers-Weiser garbase collector 설치
$ sudo apt-get install libgc-dev
- 빌드
$ make
'Android' 카테고리의 다른 글
scrcpy 명령어 (0) | 2021.01.05 |
---|---|
Samsung Molibe Platform BugBounty Review (0) | 2020.08.15 |
Android Network Capture with ADB (0) | 2020.05.25 |
Samsung Open Source Custom Build (0) | 2020.05.24 |
VMware에서 Android X86 설치 (3) | 2019.11.23 |