kali逆向环境搭建+frida

1.切换为中文时区

dpkg-reconfigure tzdata 然后选择Asia→Shanghai,然后重启即可。
2.安装中文字体
apt update
apt install xfonts-intl-chinese
apt install ttf-wqy-microhei
3.其他小工具
进程占用查看
apt install htop
流量查看
apt install jnettop
4.pyenv python多版本环境安装
  a.安装依赖
  https://github.com/pyenv/pyenv/wiki/Common-build-problems
sudo apt-get 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 python-openssl git
  b.安装
https://github.com/pyenv/pyenv-installer
curl https://pyenv.run | bash
默认安装的位置是在~/.pyenv/bin下
或者
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
exec $SHELL
更新
pyenv update
设置环境变量
 
 
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
source ~/.bashrc
下载指定版本的python
pyenv install 3.
会列出所有的3.版本
本次安装3.8.0
pyenv install 3.8.0
一般会比较慢,除非用代理或者使用国内的镜像
v=3.5.2|wget http://mirrors.sohu.com/python/$v/Python-$v.tar.xz -P ~/.pyenv/cache/;pyenv install $v
v=3.5.2|wget http://mirrors.sohu.com/python/$v/Python-$v.tar.xz -P ~/.pyenv/cache/;pyenv install $v
http://npm.taobao.org/mirrors/python/
http://npm.taobao.org/mirrors/python/3.8.0/Python-3.8.0.tar.xz
v=3.8.0|wget http://npm.taobao.org/mirrors/python/$v/Python-$v.tar.xz -P ~/.pyenv/cache/;pyenv install $v
wget http://npm.taobao.org/mirrors/python/3.8.0/Python-3.8.0.tar.xz -P ~/.pyenv/cache/
 

参考方法:
https://blog.csdn.net/ksws0292756/article/details/79995731
或者用迅雷下载后,然后将文件放到缓存里面~/.pyenv/cache
如果报错提示gcc,g++等可能是没有安装g++或者gcc,zlib,biz2等
切换的时候直接pyenv local 3.8.5
卸载pyenv
Uninstall:
pyenv is installed within $PYENV_ROOT (default: ~/.pyenv). To uninstall, just remove it:
$ rm -fr ~/.pyenv
then remove these three lines from .bashrc:
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
and finally, restart your shell:
$ exec $SHELL
5.搭建代理
proxychains
在kali下用的是proxychains3,只需要设置socket5即可
记得注释dns
6.下载vscode
https://code.visualstudio.com/Download
https://code.visualstudio.com/docs/?dv=linux64_deb
下载deb的即可,和ubuntu debain一样
dpkg -i code_1.49.0-1599744551_amd64.deb
7.刷机,用谷歌的官方手机刷机,并安装magisk获取到su权限
8.安装adb等工具命令,在百度搜索google platform tools 即可。
 在环境变量内部添加adb的命令目录
9.kali安装shh,默认是不允许链接的
10.nodejs安装
https://www.cnblogs.com/taony/p/10176981.html
https://github.com/nodesource/distributions/blob/master/README.md
11.frida开发环境
https://www.jianshu.com/p/c349471bdef7
https://github.com/r0ysue/AndroidSecurityStudy
https://wx.zsxq.com/dweb2/index/search/frida%E7%8E%AF%E5%A2%83/alltopics
frida脚本开发环境正确操作: 之前建议的这种方法frida-gum.d.ts已经被大胡子删掉了,他现在不赞成使用这种方式。
目前最新正确的Frida环境搭建方法:
1. git clone https://github.com/oleavr/frida-agent-example.git
2. cd frida-agent-example/
3. npm install
4. 使用VSCode等IDE打开此工程,在agent下编写typescript,会有智能提示。
5. npm run watch会监控代码修改自动编译生成js文件
也可以https://bbs.pediy.com/thread-258513.htm
npm install @types/frida-gum 这样可以在任意的位置
6. frida -U -f com.example.android --no-pause -l _agent.js
 安装frida特定版本
想要使用基于特定frida版本的objection,只需先安装好特定版本的frida和frida-tools,
再去objection的release里找那个日期之后一点点的版本。
https://github.com/frida/frida/releases?after=12.8.10
https://github.com/frida/frida/releases/download/12.8.0/frida-server-12.8.0-android-arm64.xz
此时的python环境为3.8.0,pyenv local 3.8.0
比如以frida 12.8.0版本举例:
pip install frida==12.8.0
pip install frida-tools==5.3.0
pip install objection==1.8.4
更新pip使用国内镜像
 python -m pip install --upgrade pip  -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

pip install frida-tools --proxy='http://127.0.0.1:10808'

设置全局pip镜像
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

pip install  -i https://pypi.tuna.tsinghua.edu.cn/simple frida==12.8.0

pip install  -i https://pypi.tuna.tsinghua.edu.cn/simple frida-tools==5.3.0
pip install  -i https://pypi.tuna.tsinghua.edu.cn/simple objection==1.8.4
 
按照这个顺序,在装objection的时候,
就会直接Requirement already satisfied,不会再去下载新的frida来安装了。
或者
2021-03-23
pyenv install 3.8.8
pyenv local 3.8.8
pip install frida==14.2.13
pip install frida-tools==9.2.1
pip install objection==1.10.1
 
//
pip install  -i https://pypi.tuna.tsinghua.edu.cn/simple  frida==14.2.13
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  frida-tools==9.2.1
pip install  -i https://pypi.tuna.tsinghua.edu.cn/simple objection==1.10.1
 
https://www.python.org/ftp/python/3.8.8/Python-3.8.8.tar.xz
pip下载时使用国内镜像
临时方法

# cmd
# 正常用法
pip3 install requests

# 加-i用法
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
 
 android服务端frida非标准端口连接:
./fridaserver -l 0.0.0.0:9999
frida-ps -H 192.168.x.x:9999
frida -H 192.168.x.x:9999 -f com.android.settings -l xx.js
objection -N -h 192.168.31.191 -p 9999 -g com.android.settings explore
 如果是usb连接,直接-U即可,服务端也不需要加端口
  wifi adb 可以无线调试+qtsrccpy投屏
  https://bbs.pediy.com/thread-257380.htm
  https://github.com/barry-ran/QtScrcpy
pyenv install python非常慢
使用pyenv可以安装不同的Python版本,具体使用方法参考知乎的这篇文章:https://zhuanlan.zhihu.com/p/27294128
 
然后在pyenv install -v 3.6.0时候,下载安装非常慢。。
 
解决方法:
 
先去官网下载对应版本的源码:https://www.python.org/downloads/source/
 
然后创建~/.pyenv/cache目录: mkdir ~/.pyenv/cache (如果已经有该目录直接进入: cd ~/.pyenv/cache)
 
然后pyenv install 3.6.0
 
posted @ 2020-09-14 23:39  _**  阅读(1952)  评论(0编辑  收藏  举报