mac使用frida
mac使用frida
安装
https://github.com/frida/frida/releases
根据手机的cpu的版本,选择相应的文件,一般通过手机信息可以看到
我这里是frida-server-12.6.7-android-arm64.xz
解压frida-server-12.6.7-android-arm64.xz,然后把解压后的文件重命名frida-server
后来我使用genymotion,查看系统为x86。

所以下载了frida-server-12.7.5-android-x86.xz文件,然后解压并重命名为frida-server。
执行命令frida-server。
依次执行下面命令
$ adb push frida-server /data/local/tmp/
$ adb shell "chmod 755 /data/local/tmp/frida-server"
$ adb shell "/data/local/tmp/frida-server &"

然后在电脑上测试手机是否连通
$ adb devices -l

Frida大致原理是手机端安装一个server程序,然后把手机端的端口转到PC端,PC端写python脚本进行通信,而python脚本中需要hook的代码采用javascript语言。所以这么看来我们首先需要安装开始安装frida了,直接运行命令:
/Applications/Python\ 3.6/Install\ Certificates.command
python3.6 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn frida frida-tools
我这大概要等很长时间才下载完。
然后执行命令
frida-ps -U
看到类似的结果

PID Name
----- -----------------------------------------------------------------
2681 .dataservices
835 ATFWD-daemon
12174 adbd
844 adsprpcd
845 adsprpcd
745 android.hardware.audio@2.
即可。
插曲okttp3
okhttp3没混淆的hook
try {
var CertificatePinner = Java.use('okhttp3.CertificatePinner');
quiet_send('OkHTTP 3.x Found');
CertificatePinner.check.overload('java.lang.String', 'java.util.List').implementation = function () {
quiet_send('OkHTTP 3.x check() called. Not throwing an exception.');
}
}
okhttp3混淆的话
改为混淆的名字我这里是d.k.a,
Java.use表示使用d包的k类,然后后面CertificatePinner.a.overload
表示hook a方法
/*** okhttp3.x unpinning ***/
// Wrap the logic in a try/catch as not all applications will have
// okhttp as part of the app.
try {
var CertificatePinner = Java.use('d.k');
quiet_send('OkHTTP 3.x Found');
CertificatePinner.a.overload('java.lang.String', 'java.util.List').implementation = function () {
quiet_send('OkHTTP 3.x check() called. Not throwing an exception.');
}
} catch (err) {
// If we dont have a ClassNotFoundException exception, raise the
// problem encountered.
if (err.message.indexOf('ClassNotFoundException') === 0) {
throw new Error(err);
}
}
application脚本
# -*- coding: utf-8 -*-
import frida, sys, re, sys, os
from subprocess import Popen, PIPE, STDOUT
import codecs, time
if (len(sys.argv) > 1):
APP_NAME = str(sys.argv[1])
else:
APP_NAME = "com.loco.example.OkHttp3SSLPinning"
def sbyte2ubyte(byte):
return (byte % 256)
def print_result(message):
print ("[!] Received: [%s]" %(message))
def on_message(message, data):
if 'payload' in message:
data = message['payload']
if type(data) is str:
print_result(data)
elif type(data) is list:
a = data[0]
if type(a) is int:
hexstr = "".join([("%02X" % (sbyte2ubyte(a))) for a in data])
print_result(hexstr)
print_result(hexstr.decode('hex'))
else:
print_result(data)
print_result(hexstr.decode('hex'))
else:
print_result(data)
else:
if message['type'] == 'error':
print (message['stack'])
else:
print_result(message)
def kill_process():
cmd = "adb shell pm clear {} 1> /dev/null".format(APP_NAME)
os.system(cmd)
#kill_process()
try:
with codecs.open("hooks.js", 'r', encoding='utf8') as f:
jscode = f.read()
device = frida.get_usb_device(timeout=5)
#pid = device.spawn([APP_NAME])
session = device.attach("com.loco.example.OkHttp3SSLPinning")
script = session.create_script(jscode)
#device.resume(APP_NAME)
script.on('message', on_message)
print ("[*] Intercepting on {} ...".format(APP_NAME))
script.load()
sys.stdin.read()
except KeyboardInterrupt:
print ("[!] Killing app...")
kill_process()
time.sleep(1)
kill_process()
mac使用frida的更多相关文章
- 最新iOS砸壳方式Frida (Mac OSX)
1. 安装Frida 首先需要安装Python3,我下载的是 macOS 64-bit installer 安装,因Macbook本机自带python为2.7.x,故需要配置~/.bash_profi ...
- iOS安全攻防之使用 Frida 绕过越狱设备检测
Frida 是 一款有趣的手机应用安全分析工具. 文章参考:Bypass Jailbreak Detection with Frida in iOS applications 在 Mac Termin ...
- 推荐几个Mac插件帮你提升工作效率
下面这篇文章是小编看到的很好的文章,分享给大家,小编前几天也整理了很多mac专题文章.更多专题,可关注[磨人的小妖精],查看我的文章,也可上[风云社区 SCOEE],查找和下载相关软件资源. (一)综 ...
- Android组合Windows环境下Frida的安装步骤
Frida是什么 我觉得官网已经说得很清楚了.简单的说就是一款动态代码检测工具,可用于各种系统,这里的主要用途是动态检测Android代码,配合Windows系统环境使用. Frida ...
- MacOS微信逆向分析-Frida
MacOS微信逆向分析-Frida 0.前言 PC下的微信二次开发相信大家都会了,那么本篇文章将带领大家使用Frida框架对Mac下微信来进行二次开发! PS:还有一种静态注入的方式也不错,但是考虑到 ...
- 总结:Mac前端开发环境的搭建(配置)
新年新气象,在2016年的第一天,我入手了人生中第一台自己的电脑(大一时好友赠送的电脑在一次无意中烧坏了主板,此后便不断借用别人的或者网站的).macbook air,身上已无分文...接下来半年的房 ...
- JAVA for mac 的学习之路
要学习一门新技术,首先得下载相关的工具. 一 . 下载相关工具 1. 下载 jdk formac 下载地址为:http://www.oracle.com/technetwork/java/javase ...
- docker for mac 学习记录
docker基本命令 docker run -d -p 80:80 --name webserver nginx 运行容器并起别名 docker ps 展示目前启动的容器 docker ps -a 展 ...
- Xamarin+Prism开发详解四:简单Mac OS 虚拟机安装方法与Visual Studio for Mac 初体验
Mac OS 虚拟机安装方法 最近把自己的电脑升级了一下SSD固态硬盘,总算是有容量安装Mac 虚拟机了!经过心碎的安装探索,尝试了国内外的各种安装方法,最后在youtube上找到了一个好方法. 简单 ...
随机推荐
- javascript中用&&跟||来简化if{}else{}的写法
原文:javascript中用&&跟||来简化if{}else{}的写法 目录 javascript中用&&跟||来简化if{}else{}的写法 1. if else ...
- Springboot 使用pageHelper实现分页查询
本文链接:https://blog.csdn.net/qq_35387940/article/details/91530234
- python实现蓝牙通信
安装和示例 linux下安装 -dev sudo pip install bluepy 官方示例 import btle class MyDelegate(btle.DefaultDelegate): ...
- CHD-5.3.6集群上Flume安装
Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and ...
- php的小数位数最长多少位
在php中, echo 0.1234567890123456;exit; // 结果为:0.12345678901235, 整数部分为0时,最多到14位小数,如果后面还有,就自动四舍五入 echo 7 ...
- Google C++单元测试框架GoogleTest---AdvancedGuide(译文)
上篇在这里: 下篇在这里.
- Delphi 编写线程的清除代码
- Matlab---绘图及其位置摆放
Matlab---绘图及其位置摆放 [@WP@20180509] 一.绘图函数 (1)绘制二维图形 (1.1) plot( ) 函数的应用格式. 1,plot(x). 当x 为一向量时,以x 元素的值 ...
- 小白学习MongoDB笔记(一)·下载及安装MongoDB
下载地址:http://dl.mongodb.org/downloads.我选的64位的 windows64-bit 2008 R2.当时版本为3.0.7 文件格式为.msi 借用“一线码农”的话: ...
- Linux文件系统之目录清单
挂载点:挂载:将设备关联到当前文件系统目录 文件系统:rootfs:根文件系统/boot:系统启动相关文件,如内核.initrd.以及grub(bootleader:引导加载器)/dev:设备文件, ...