banner
Silas

REAO

Be a better man
github

手動編譯Hluda Frida Server

看雪同步: https://bbs.pediy.com/thread-269889.htm
本文基於 ubuntu 21.04 操作

frida 將默認分支從 master 切換到 main,如果編譯出現

make[1]: *** No rule to make target '.git/refs/heads/master', needed by 'build/frida-version.h'.  Stop.

參考此 commit:https://github.com/frida/frida/commit/e4c6a1e646666284ea77c36d61f20558504847b5


1. 搭建編譯環境#

1.1 安裝依賴項#

sudo apt update
sudo apt-get install build-essential tree ninja-build gcc-multilib g++-multilib lib32stdc++-9-dev flex bison xz-utils ruby ruby-dev python3-requests python3-setuptools python3-dev python3-pip libc6-dev libc6-dev-i386 -y

sudo gem install fpm -v 1.11.0 --no-document
python3 -m pip install lief

1.2 設置 ndk#

ndk 版本與你想要編譯的版本相關,在其/releng/setup-env.sh註明了需要的 NDK 版本

image

這裡以最新版的 frida ndk 依賴 22 進行

ndk 下載網址:https://developer.android.com/ndk/downloads?hl=zh-cn

wget https://dl.google.com/android/repository/android-ndk-r22b-linux-x86_64.zip
unzip android-ndk-r22b-linux-x86_64.zip
sudo mv android-ndk-r22b /opt/

#add env variables
export ANDROID_NDK_ROOT='/opt/android-ndk-r22b'

1.3 設置 nodejs#

Github Repo not found

The embedded github repo could not be found…

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# install node 10
nvm install 10

2. 編譯 frida#

2.1 最新版#

當前最新版本是:15.1.5

git clone --recurse-submodules https://github.com/frida/frida

Apply hluda patch

git clone https://github.com/AAAA-Project/Patchs.git

cd frida/frida-core/

git am ../../Patchs/strongR-frida/frida-core/*.patch

# 回到frida 根目錄
cd ..

編譯:

編譯時會自動下載 對應的 toolchain 和 sdk。

make core-android-arm
make core-android-arm64
make core-android-x86
make core-android-x86_64

when compile completed, into build/frida-android-arm/bin ,you will see:

image

2.2 老版本#

看了看Patchs的 commit message、時間,基本就能知道 commit 對應的 patch,對應哪些版本:

image

看看編譯 14.2.12 怎麼弄

git clone --recurse-submodules https://github.com/frida/frida.git
cd frida 
git checkout 14.2.12

這裡有個坑,當 checkout 的時候,僅 frida 這個倉庫回滾到 14.2.12,其中的 submodule 依然是最新的,要讓所有 submodule 也是 14.2.12 時的版本才行:

git submodule update --recursive

檢查一下需要的 ndk 版本,依然是 22:
!
image

checkout Patchs 到 14.2.12:

image

git checkout 8e1308b

Apply hluda patch:

cd frida/frida-core
git am ../../Patchs/strongR-frida/frida-core/*.patch

check 一下,沒報錯就行。

接下來和之前的編譯步驟一樣

cd frida
 
make core-android-arm
make core-android-arm64
make core-android-x86
make core-android-x86_64

image


Git History - https://githistory.xyz/ 在某些情況下確實有用:

image


參考:

  1. hluwa - actions build.xml
載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。