2024-03-31
Android控制注意事项

长时间不开机的机器可能会发生时间错位问题 需要用adb进行时间校准

1
2
3
adb shell date "YYYY-MM-DD HH:MM:SS"
# sometimes you have to use '-s' flag

把所有闹钟都关闭 防止关了机又打开 或者在脚本操作控制的时候出问题


建议使用云手机平台(搜索:开源云手机),虚拟手机,方便进行环境打包和重新部署。

redroid supports adb connection, and is a docker image

redroid-doc and redroid tutorial

lamda is a multi-source (simulator and real device support) android controlling, network capturing and reverse engineering platform

lamda wiki


如果adb出现连接问题,可以重启adb服务

usb硬件出问题一般是因为供电不足,或者连接线接触不良。所以可以加强供电,以及更换更好的连接线。

1
2
3
adb kill-server
adb start-server

Read More

2022-11-04
Register A New File In Android Gallery Using Beanshell Code

register new file to android gallery

code in beanshell:

1
2
3
4
5
6
import android.net.Uri;
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Uri contentUri = Uri.parse("file:///storage/emulated/0/Movies/output0_higher.mp4");
mediaScanIntent.setData(contentUri);
ctx.sendBroadcast(mediaScanIntent);

Read More

2022-11-03
Mastering Android Reverse Engineering Tools: Ida, Ghidra, Frida, Gda And Flowdroid

安卓反编译

ida ghidra frida

frida extension/helper methods

attach existing process

1
2
3
4
sudo frida-ps
sudo frida -n WeChat
sudo frida -p [pid]

gda 交互式Android反编译 支持数据流追踪

flowdroid

Read More

2022-03-05
Android Emulators

WayDroid

anbox?

Read More

2022-02-21
Android 10 Clipboard Issue For Scrcpy

com.github.kr328.clipboard.ClipboardProxy.getPrimaryClip

Magisk Module:

Riru - Clipboard Whitelist

will white list clipboard manager app.

https://github.com/Kr328/Riru-ClipboardWhitelist

https://t.me/kr328_riru_modules

script.sh:

1
2
scrcpy -K -S 2>&1 | python3 reader.py

reader.py:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
import subprocess
import re
class Response(object):
status = None
data = None
def parseResponse(resultString):
response = re.findall(r"^Broadcasting: Intent { flg=0x400000 cmp=ch.pete.adbclipboard/.ReadReceiver }\nBroadcast completed: result=-1, data=\"((.*\n?)+)\"$",resultString)[0][0]
return response
def readFromDevice():
adbProcess = subprocess.Popen(
['adb',
'shell', 'am',
'broadcast',
'-n', 'ch.pete.adbclipboard/.ReadReceiver'],
stdout=subprocess.PIPE)
resultString = adbProcess.communicate()[0]
print("read device response:\n{}"
.format(resultString))
try:
result = parseResponse(resultString.decode("utf-8"))
print("raw:\n",resultString)
print("result:\n",result)
return result
except:
traceback.print_exc()
return
def setClipboard(data):
with open("target.out","w+",encoding="utf-8") as f:
f.write(data)
fetch_clipboard = "cat target.out | xclip -selection c"
os.system(fetch_clipboard)
while True:
content = input()
print("CONTENT:",content)
if "Calling uid 0 does not own package com.android.shell" in content:
print("!!!!!!!!!!ERROR FETCHING CLIPBOARD!!!!!!!!!!")
data = readFromDevice()
if data is not None:
setClipboard(data)
# with open("target.out","wb"
# os.system(fetch_clipboard)

Read More

2021-12-20
After Termux Reinstallation

grant permission for termux:api

android.permission.WRITE_SETTINGS can only be granted in settings tab.

https://github.com/TilesOrganization/support/wiki/How-to-use-ADB-to-grant-permissions

adb shell pm grant com.rascarlo.quick.settings.tiles android.permission.WRITE_SECURE_SETTINGS

pm grant com.termux.api android.permission.WRITE_SECURE_SETTINGS

pm list packages

the brightness bug is solved by uninstalling the unintended settings app. i don’t know if this will cause more problems.

to remove termux banner/ termux welcome message:

1
2
cd .. && cd usr/etc && rm -rf motd

Read More