【学习目的】:为了更好学习Android逆向Frida板块知识,从基础学起,记录过程分享学习
【本篇记录】:搭建Frida所需的工作环境
【目标机器】:Kali2022
【安装内容】:pyenv、多版本python、frida-server、frida、frida-tools、objection、Wallbreaker、FRIDA-DEXDump、jadx、android studio、010等
一、apt update失败问题
参考连接:https://blog.csdn.net/weixin_43543330/article/details/115761645
【解决办法】:官网下载签名
1 2 3 | wget archive.kali.org / archive - key.asc
apt - key add archive - key.asc
|
在重新运行apt update即可
二、修改源
打开sources.list文件
1 | mousepad / etc / apt / sources. list
|
文件末尾添加源(注释kali自带源)
1 2 3 | deb http: / / mirrors.ustc.edu.cn / kali kali - rolling main non - free contrib
deb - src http: / / mirrors.ustc.edu.cn / kali kali - rolling main non - free contrib
|
三、修改时间和中文字体安装htop和jnettop
修改时间-设置时区即可
1 2 3 | pkg - reconfigure tzdata
Asia / Shanghai
|
设置中文字体
1 2 3 | apt install xfonts - intl - chinese
apt install ttf - wqy - microhei
|
安装htop:查看系统内存情况
安装jnettop:查看网络连接流量情况
四、科学上网proxychains
【关于此设置试验失败】:
1.不存在proxychains.conf文件,而存在proxychains4.conf文件
2.末尾添加了socks5后,关于strict_chain、random_chain、proxy_dns具体注释哪一个得问题,网上文章说法很多,尝试过多种方式,仍然失败
1 2 | nano / etc / proxychains.conf
nano / etc / proxychains4.conf
|
五、更新配置文件
1 2 3 4 | apt install - y build - essential libssl - dev zlib1g - dev libbz2 - dev libreadline - dev libsqlite3 - dev wget curl llvm libncurses5 - dev libncursesw5 - dev xz - utils tk - dev libffi - dev liblzma - dev git libxml2 - dev
/ / apt - get 无法安装 openssl - devel请执行:
sudo apt - get install openssl
sudo apt - get install libssl - dev
|
六、安装pyenv
1 | git clone https: / / github.com / pyenv / pyenv.git ~ / .pyenv
|
配置pyenv路径
1 2 3 4 | echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~ / .bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~ / .bash_profile
echo 'eval "$(pyenv init -)"' >> ~ / .bash_profile
source ~ / .bash_profile
|
此时每次打开新得窗口都需要输入source ~/.bash_profile才能使用Pyenv命令
1 2 | mousepad ~ / .zshrc
打开zshrc在末尾添加source ~ / .bash_profile即可
|
参考连接:https://blog.csdn.net/science_Lee/article/details/79214127
七、VSCODE安装
官网下载vscode后:
1 | dpkg - i code_1. 69.1 - 1657614635_arm64 .deb
|
如果安装后发现点击vscode图标没有反映打不开
1 | / usr / share / code / code - - no - sandbox - - unity - launch % F
|
7.1安装node
nodejs应该能够算vscode得智能提示功能
1 2 | curl - sL https: / / deb.nodesource.com / setup_10.x | sudo - E bas
sudo apt install - y nodejs
|
八、安装adb工具
1 2 3 | wget https: / / dl.google.com / android / repository / platform - tools - latest - linux. zip ?hl = ja
mv platform - tools - latest - linux. zip \?hl = ja platform - tools - latest - linux. zip
7z x platform - tools - latest - linux. zip
|
添加路径
1 2 | nano ~ / .bashrc(打开文件,末尾添加上一行路径)
|
如果每次打开窗口,输入adb都没有反映,可根据提示选中Y进行安装
也可以进行将路径对~/.bash_profile文件写入
1 2 | echo 'export PATH="/root/Android/Sdk/platform-tools:$PATH"' >> ~ / .bash_profile
source ~ / .bash_profile
|
也可以下载android studio 安装后,在Android/Sdk/platform-tools目录下就有adb工具
九、frida相关安装
之所以安装pyenv目的是为了可以安装多个python对应得多个不同版本得frida
所以下载多个python
1 2 | pyenv install 3.8 . 0
pyenv install 3.10 . 5
|
使用命令pyenv local 3.8.0切换置当前python为3.8.0版本,然后安装对应得frida(这步很重要)
1 2 3 4 5 6 7 8 | pyenv local 3.8 . 0
/ / python3. 8.0 对应得frida版本是 12.8 . 0 ,
/ / 对应得frida - tools是 5.3 . 0
/ / 对应得objection是 1.8 . 4
/ / 这里安装顺序步能乱,必须先frida在frida - tools
pip install frida = = 12.8 . 0
pip install frida - tools = = 5.3 . 0
pip install objection = = 1.8 . 4
|
关于frida版本还有frida server参考连接下载:https://github.com/frida/frida/tags
uname -a查看手机的系统架构 下载对应得系统frida server
下载得frida server安装到手机目录 /data/local/tmp目录下
最好重新起个名字
1 2 3 | adb push frida - server - 12.8 . 0 - androdi - arm / data / local / tmp / fs1280arm
/ / 给权限
chmod 777 fs1280arm
|
安装TypeScript 开发环境
应该也是在些hook代码时候能够有智能提示补全之类得工具
参考连接:https://bbs.pediy.com/thread-265160.htm
1 2 3 4 | $ git clone git: / / github.com / oleavr / frida - agent - example.git
$ cd frida - agent - example /
$ npm install
$ frida - U - f com.example.android - - no - pause - l _agent.js
|
测试frida是否成功(注意当前python对应frida对应手机的frida服务)
1.手机运行frida server
2.编写js脚本
1 2 3 4 5 6 | function main(){
Java.perform(function(){
console.log( "Inside Frida Java Perform!" )
})
}
setImmediate(main)
|
3.启动frida
1 | frida - U - - no - pause - f com.android.settings - l 2022 - 07 - 19 - test1.js
|
十、objection的使用
启动objection,需要对应frida和python版本,先启动手机的frida server
1 | objection - g com.android.settings explore
|
可以查看settings进程的activities/服务等
1 | android hooking list activities
|
具体使用参看连接:https://www.anquanke.com/post/id/197657#h3-6
安装objection中使用得Wallbreaker
可以查看类得所有信息(文末附带工具)
1 2 3 4 | / / 使用命令。进入objection中加载插件
plugin load / root / xxx / Wallbreaker
/ / 查看类得信息
plugin wallbreaker classdump - - fullname android.bluetooth.BlutoothDevice
|
安装FRIDA-DEXDump中使用dexdump
(文末附带工具)
1 2 | plugin load / root / xxx / FRIDA - DEXDump
plugin dexdump search
|
十一、root权限
当前测试使用的是Android 5.0系统,nexus 5 手机
刷机后需要root,就是使用su命令,我选方法是刷一个包CF-Auto-Root进去手机就可以了
刷这个包需要对照手机型号
参考连接:https://blog.csdn.net/commshare/article/details/20916833
网上也有教程,刷twrp和Magisk,但是没有找到android 5.0的twrp所以并没有尝试。
[培训]《安卓高级研修班(网课)》月薪三万计划