Android渗透测试备忘单

ADB 备忘单

下载adb http://adbdriver.com/downloads/或者您可以从Android Studio中使用adb作为默认设置。

ADB 命令

# [检查Android架构]
adb shell getprop | grep abi
# [尝试使用此命令获取简单输出]
adb shell getprop ro.product.cpu.abi

#[列出所有已安装的应用程序]
adb shell pm list packages -f | grep -i 'testing'

# [在android上跟踪日志]
adb logcat | grep com.app.testing

# [将应用程序安装到设备]
adb install app.testing.apk

# [获取应用程序的完整路径]
adb shell pm path com.example.someapp

# [下载apk到开发机器]
adb pull /data/app/com.example.someapp-2.apk

# [在应用程序上下载活动]
adb shell dumpsys activity top | grep ACTIVITY

# [在adb shell中创建新文件]
cat > filename.xml
# [可以使用以下方法向文本文件添加行:]
cat >> filename.xml
# [两个命令都可以使用ctrl-D终止]

# [下载内存]
adb shell dumpsys meminfo com.package.name

Frida 备忘单

在Android上安装Frida Server,
下载frida服务器:https://github.com/frida/frida/releases

$ adb root # 必须为root权限
$ adb push frida-server /data/local/tmp/
$ adb shell "chmod 755 /data/local/tmp/frida-server"
$ adb shell "/data/local/tmp/frida-server &"

Frida 命令

# [通过USB将Frida连接到iPad并列出正在运行的进程]
$ frida-ps -U

# [列出正在运行的应用程序]
$ frida-ps -Ua

# [列出已安装的应用程序]
$ frida-ps -Uai

# [将Frida连接到特定设备]
$ frida-ps -D 0216027d1d6d3a03

# Trace recv* and send* APIs in Safari
$ frida-trace -i "recv*" -i "send*" Safari

# [Safari中的Trace ObjC方法调用]
$ frida-trace -m "-[NSView drawRect:]" Safari

# [在iPhone上启动SnapChat并跟踪加密API调用]
$ frida-trace -U -f com.app.testing -I "libcommonCrypto*"

#[Frida在程序启动时跟踪每个打开的函数]
$ frida-trace -U -i open com.app.testing

Frida追踪

下载:https://github.com/Piasy/FridaAndroidTracer 用法:

java -jar FridaAndroidTracer.jar
-a,--expand-array     #expand array values  [展开数组值]
-c,--classes <arg>    #classes to be hooked [要hook的classes]
-j,--jars <arg>       #jar files to be included [要包含的jar文件]
-o,--output <arg>     #output script path  [输出脚本路径]
-p,--include-private  #include private methods [包括隐匿方法]
-s,--skip <arg>       #methods to be skipped [要跳过的方法]

Frida Trick

绕过root检测:绕过anti-root检测在android应用程序中尝试使用不同的数据类型来攻击逻辑缺陷。

Objection

 安装Objection

https://github.com/sensepost/objection

pip3 install objection

用法:

# 默认运行对象
objection --gadget "com.application.id" explore

# 使用命令
objection --gadget "com.application.id" explore --startup-command "ios jailbreak disable"

# 运行对象和脚本运行对象
objection --gadget "com.application.id" explore --startup-script antiroot.js

AndBug-枚举应用程序中的类和方法

下载 https://github.com/swdunlop/AndBug

用法:

#Enumerate classes on application [枚举应用程序上的类]
$ andbug classes -p [PID application / com.app.testing] > class.txt

#Enumerate methods on classes [枚举类上的方法]
$ andbug methods -p [PID application / com.app.testing] [class name]

Android日志追踪

使用PIDCAT:https://github.com/JakeWharton/pidcat

用法:

$ ./pidcat.py [com.app.testing]

反编译APK文件

APKX反编译APK

下载https://github.com/b-mueller/apkx

用法:

$ apkx -c enjarify -d procyon app.testing.apk

字节码查看器-GUI

下载https://github.com/Konloch/bytecode-viewer/releases
以读取dex或jar文件的源代码。
如何运行:只需双击jar文件

APK逆向工具

下载https://github.com/1N3/ReverseAPK
安装:

git clone https://github.com/1N3/ReverseAPK.git
cd ReverseAPK 
./install
APK逆向工具
APK逆向工具

用法:

reverse-apk app.testing.apk

在Android上安装Burp证书

将burp证书从DER转换为PEM。如果您懒惰,则可以在此存储库上下载PEM文件。

openssl x509 -inform DER -in cacert.der -out cacert.pem
# Get subject_hash_old (or subject_hash if OpenSSL < 1.0)
openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1
mv cacert.pem 9a5ba575.0

将PEM文件安装到设备上的“系统受信任的凭据”中。

adb root
adb remount  
adb push 9a5ba575.0 /system/etc/security/cacerts/  
adb shell "chmod 644 /system/etc/security/cacerts/9a5ba575.0"
adb shell "reboot" 

如果/ system无法安装,则必须先安装。

adb root
adb shell
Check mounting list
cat /proc/mounts
#/dev/block/bootdevice/by-name/system /system ext4 ro,seclabel,relatime,discard,data=ordered 0 0
mount -o rw,remount -t rfs /dev/block/bootdevice/by-name/system /system
adb push 9a5ba575.0 /system/etc/security/cacerts/  
adb shell "chmod 644 /system/etc/security/cacerts/9a5ba575.0"
adb shell "reboot" 

在Android模拟器上安装Open Gapps

下载:https://opengapps.org/
使用:

unzip open_gapps-x86_64******.zip 'Core/*'
rm Core/setup*
lzip -d Core/*.lz
for f in $(ls Core/*.tar); do
  tar -x --strip-components 2 -f $f
done

安装到模拟器:

adb root
adb remount
adb push etc /system
adb push framework /system
adb push app /system
adb push priv-app /system
adb shell stop
adb shell start

仿真器

Android Studio模拟器

此命令用于从android studio运行模拟器,使您之前已经安装android studio。
如果您想root android模拟器,请使用不带(Google API)或(Google Play)的系统

# [列出所有模拟器]
$ emulator.exe -list-avds 
# [运行模拟器]
$ emulator.exe -avd [EmulatorName]

Genymotion

下载https://www.genymotion.com/

QARK-快速Android审查工具包

下载https://github.com/linkedin/qark
,以便通过扫描apk或java文件并创建漏洞证明概念快速分析android上的应用程序。

安装QARK:

git clone https://github.com/linkedin/qark
cd qark
pip install -r requirements.txt
pip install . --user  # --user is only needed if not using a virtualenv
qark --help

扫描APK的用法:

qark --apk path/to/my.apk

扫描Java源代码文件的用法:

qark --java path/to/parent/java/folder
qark --java path/to/specific/java/file.java

将ANDROID设备屏幕镜像到笔记本或计算机

我相信您想将android屏幕镜像到笔记本电脑或计算机,可以购买软件来做到这一点,也可以免费使用此工具SCRCPY:D

安装SCRCPY

苹果电脑 : brew install scrcpy

有用的命令

使用无边界窗口运行: 

scrcpy -t –window-title ‘My Research’ –always-on-top

对于懒人:v

  1. 自动检查根目录-> https://github.com/laconicwolf/Android-App-Testing/blob/master/check_for_root_detection.py
  2. 在Android上自动安装Burp CA-> https://github.com/laconicwolf/Android-App-Testing/blob/master/install_burp_cert.py
  3. 自动重新打包Apk-> https://github.com/laconicwolf/Android-App-Testing/blob/master/repackage_apk_for_burp.py

from

Leave a Reply

您的电子邮箱地址不会被公开。 必填项已用 * 标注