Skills von pixel: security/spycheck software-development/android-debugging-from-termux
This commit is contained in:
@@ -1,19 +1,50 @@
|
||||
---
|
||||
name: spycheck
|
||||
description: Use when checking phones for spyware via Termux/MVT.
|
||||
version: 1
|
||||
version: 2
|
||||
author: Hermes Agent
|
||||
license: MIT
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [security, spyware, stalkerware, mvt, androidqf, ios, sysdiagnose, termux]
|
||||
related_skills: [android-debugging-from-termux]
|
||||
---
|
||||
|
||||
# Spycheck (Termux on Pixel)
|
||||
# Spycheck: quick check for spy/stalkerware from Termux (Pixel)
|
||||
|
||||
Installed at ~/spycheck (README.txt). Widgets: ~/.shortcuts/Spycheck-Android, Spycheck-iPhone. Reports: /sdcard/Download/Spycheck/.
|
||||
## When to Use
|
||||
The user wants to check their own or someone else's phone (with consent) for spyware, stalkerware or mercenary spyware, or wants to run, fix or extend the Spycheck widgets.
|
||||
|
||||
## Rules
|
||||
- Always `unset LD_LIBRARY_PATH` before Termux python/mvt/go: Hermes injects its own libpython -> dlopen `_PyType_AllocNoTrack` errors.
|
||||
- MVT venv: ~/mvt-venv (`--system-site-packages --without-pip`, then `python -m pip`). Do NOT use pip's cryptography wheel (PyModule_Type dlopen error); use Termux pkg python-cryptography (uninstall from venv).
|
||||
- pydantic-core builds via Rust (~5 min): run pip in background, foreground tool timeouts kill it.
|
||||
- `mvt-android check-adb` is REMOVED; use androidqf -> `mvt-android check-androidqf`.
|
||||
- androidqf has promptui prompts + final Enter pause; local patched build bin/androidqf-auto honors ANDROIDQF_AUTO=1 (backup none, no APK download, skip intrusion logs, no pause) and ANDROIDQF_SKIP=bugreport,backup. Rebuild: `cd ~/spycheck/src; CGO_ENABLED=0 make -C android-collector build; cp android-collector/build/collector_* assets/; CGO_ENABLED=0 go build -o ../bin/androidqf-auto .`
|
||||
- androidqf finds `adb` via PATH: ~/spycheck/wrap/adb -> termux-adb (nohajc repo, USB via termux-usb without root). Kill android-tools adb server first (port 5037).
|
||||
- `mvt-ios check-sysdiagnose` only records device info; real checks are in lib/ios_analyze.py (shutdown.log iShutdown method, ps.txt via COMMAND column offset, .ips names, domain IOCs via pyahocorasick).
|
||||
- Test with synthetic data: real IOC examples com.apspy.app (TheTruthSpy), Pegasus process ABSCarryLog.
|
||||
## User preferences (always)
|
||||
- Plain German text, no Markdown. Short verdict first, then findings, then limits ("no guarantee: only KNOWN traces").
|
||||
- One-tap widgets on the phone, not a CLI recipe. Ask for consent first; at the end offer to delete raw data and archives (they hold the other person's private data).
|
||||
- iOS: no long full backup. Use sysdiagnose plus the iCloud/account checklist instead.
|
||||
- Calm, realistic framing: mercenary spyware is targeted and rare; stalkerware and account access are the common threat.
|
||||
|
||||
## Layout
|
||||
~/spycheck: android-check.sh, ios-check.sh, lib/common.sh (dialogs, IOC update, progress), lib/android_report.py, lib/ios_analyze.py, bin/androidqf-auto, wrap/adb, src/ (androidqf git checkout plus patch), README.txt. Widgets: ~/.shortcuts/Spycheck-Android, Spycheck-iPhone. Reports: /sdcard/Download/Spycheck/. Raw data: ~/spycheck/cases/.
|
||||
|
||||
## Procedure: Android
|
||||
1. Connection: the target phone joins via USB-OTG (termux-adb) or wireless debugging. For a foreign phone, prefer this phone's hotspot. For the OWN phone, use wireless debugging to 127.0.0.1; pairing and port discovery are in android-debugging-from-termux section 4.
|
||||
2. Run `ANDROIDQF_AUTO=1 ANDROIDQF_SKIP=bugreport,backup bin/androidqf-auto -c <ip:port> -s <serial> -o <case>/aqf` with `</dev/null`, in the background.
|
||||
- androidqf runs `adb kill-server` at startup, so a network device needs `-c`, or the connection is lost.
|
||||
- After startup its progress goes to `<case>/aqf/command.log`, not stdout. Watch it with `progress_watch` from common.sh, which maps `[INFO] Collecting ...` lines to steps n/15 and also posts a notification.
|
||||
- Expect about 8-10 minutes over WLAN; hashing the packages and the file list are the slow steps.
|
||||
3. Run `mvt-android check-androidqf -o <case>/mvt <case>/aqf`. Alerts land in mvt/alerts.json (fields: level, module, message).
|
||||
4. Write the German report with `lib/android_report.py <case>`. Line 3 is the verdict (it goes into the notification).
|
||||
- The heuristic flags sideloaded apps that combine accessibility, notification-listener and device-admin rights.
|
||||
- A MEDIUM "installed via browser/adb" alert alone is normal for F-Droid/Termux users. Never treat it as a finding.
|
||||
|
||||
## Procedure: iPhone
|
||||
The owner restarts the iPhone, triggers sysdiagnose, waits about 10 minutes, then shares the archive to /sdcard/Download (Quick Share works from iPhone). ios-check.sh runs `mvt-ios check-sysdiagnose` (device info only, no detection), then `lib/ios_analyze.py <tar.gz> ~/.local/share/mvt/indicators <mvt.log>`. That script checks shutdown.log (iShutdown method), ps.txt, .ips names and log domains against the IOCs. For account and iCloud-based spying, walk through `references/ios-account-checklist.md`.
|
||||
|
||||
## Environment rules
|
||||
- Always `unset LD_LIBRARY_PATH` before Termux python/mvt/go; Hermes's value loads a mismatched libpython.
|
||||
- MVT venv: ~/mvt-venv. Install and the cryptography-wheel fix are in android-debugging-from-termux references/mvt-spyware-check.md.
|
||||
- `mvt-android check-adb` was removed from MVT. Use androidqf, then check-androidqf.
|
||||
- androidqf finds `adb` via PATH, and wrap/adb points to termux-adb (nohajc apt repo; USB via termux-usb without root). Kill the android-tools adb server first: both use port 5037, and the version mismatch kills the server.
|
||||
- Patched androidqf (env ANDROIDQF_AUTO / ANDROIDQF_SKIP; the upstream build has promptui prompts and an Enter pause at the end). Rebuild: `cd ~/spycheck/src; CGO_ENABLED=0 make -C android-collector build; cp android-collector/build/collector_* assets/; CGO_ENABLED=0 go build -o ../bin/androidqf-auto .`
|
||||
- Long runs go through `terminal(background=true, notify=true)`. Foreground timeouts kill pip/androidqf.
|
||||
|
||||
## Testing
|
||||
Use synthetic fixtures before claiming detection works. Real IOC examples: app com.apspy.app (TheTruthSpy, stalkerware STIX), Pegasus process ABSCarryLog, plus a Pegasus domain from the STIX file. Build a fake aqf dir (getprop.txt, packages.json, settings_secure.txt, dumpsys.txt) or a fake sysdiagnose tar, then confirm that a clean input gives UNAUFFAELLIG and a planted one gives AUFFAELLIG.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# iPhone: account/iCloud-based spying checklist (German menu names)
|
||||
|
||||
Apple stalkerware usually runs through the Apple account or through sharing, not through an app, and it shows up in Settings. Give the owner this list (about 10 minutes):
|
||||
|
||||
1. Einstellungen > Datenschutz & Sicherheit > Sicherheitscheck > "Freigaben und Zugriff verwalten": shows the people and apps with access, plus the signed-in devices.
|
||||
2. Einstellungen > [Name] > device list at the bottom: remove every unknown iPad/Mac/Windows PC. A foreign device in the account receives iMessages, photos and location.
|
||||
3. Anmeldung & Sicherheit: change the password, turn on 2FA, check "Vertrauenswürdige Telefonnummern". A foreign number there can receive the 2FA codes.
|
||||
4. Wo ist? > Personen: location sharing. Familienfreigabe: who is the organizer (sees location and screen time).
|
||||
5. Allgemein > VPN & Geräteverwaltung: a private iPhone should have no profile or MDM here. An unknown one is a real surveillance tool.
|
||||
6. Nachrichten/FaceTime > "Senden & Empfangen": only the owner's own addresses. SMS-Weiterleitung: only the owner's own devices.
|
||||
7. Face ID: no foreign "Alternatives Erscheinungsbild". Change the passcode if someone knows it.
|
||||
8. Kurzbefehle > Automation: delete unknown automations that forward messages or location.
|
||||
9. Wo ist? > Objekte identifizieren: unknown AirTags travelling along.
|
||||
10. icloud.com > Mail: no foreign forwarding address.
|
||||
|
||||
Not covered by this list: zero-click mercenary spyware. For that, use the sysdiagnose check or iVerify, or in a serious case a full backup analysis via the Amnesty Security Lab. The best protection is Blockierungsmodus.
|
||||
@@ -31,7 +31,7 @@ Key context that is easy to get wrong:
|
||||
- pip installs that compile Rust wheels (pydantic-core, cryptography) take 5–10 min on-device: start them with `terminal(background=true, notify=true)` and log to a file, because a foreground timeout kills pip mid-build.
|
||||
|
||||
## Security / spyware check (MVT)
|
||||
Install MVT into its own venv, check app IDs against the IOCs right away (works without ADB), then do the full `check-adb` once wireless debugging is paired (§4). Recipe and the IOC matcher are in `references/mvt-spyware-check.md`. Report to the user in German plain text: IOC hits, unknown-installer apps worth a look, and what was NOT covered yet.
|
||||
Install MVT into its own venv and check app IDs against the IOCs right away (works without ADB): `references/mvt-spyware-check.md`. The full check (androidqf over ADB, then `mvt-android check-androidqf`; `check-adb` no longer exists) is the `spycheck` skill. Report to the user in German plain text: IOC hits, unknown-installer apps worth a look, and what was NOT covered yet.
|
||||
|
||||
## Tailscale / tailnet connectivity
|
||||
- Non-root Termux tailscaled usually runs `--tun=userspace-networking` → proxy-only (SOCKS5/HTTP on localhost); stock Android browsers don't use local proxies, so browser access to tailnet names needs the official Tailscale app (real VpnService) or a TUN-capable proxy client.
|
||||
@@ -135,6 +135,12 @@ confirmed the dup is recoverable from Nextcloud.
|
||||
(codes are one-shot, ~1 min TTL) or server-side rate limiting after failed attempts.
|
||||
**Get a FRESH code+port from the phone GUI, re-pair within ~30 s, then connect.
|
||||
A fresh code has not been verified as working in the originating session.**
|
||||
- Verified working flow for the SAME phone (self-debugging): user opens split screen (Settings on top, Termux below), taps "pair with code" and sends HOST:PORT + code in chat; run `adb pair HOST:PORT CODE` immediately (the Wi-Fi/tailnet IP the GUI shows works). Then connect via `127.0.0.1:<session port>`.
|
||||
- Find the session port yourself instead of asking: scan 127.0.0.1 ports 30000-50000 with a threaded Python socket probe, then `adb connect 127.0.0.1:<p>` and keep the one whose `adb devices` state is `device`.
|
||||
- "Paired" in the GUI only means the key is stored. If no port is open, the wireless-debugging service itself is off: Android switches it off when Wi-Fi changes, so ask the user to toggle the switch. Re-pairing is not needed.
|
||||
- On public Wi-Fi with client isolation the GUI may show the tailnet IP (100.x). For a FOREIGN target phone, have it join this phone's hotspot so both are on one network.
|
||||
- Anything that runs `adb kill-server` (e.g. androidqf on start) drops every network-ADB connection. Reconnect afterwards, or use the tool's own connect option.
|
||||
- Never `pkill -f <pattern>` from the terminal tool: the pattern matches the tool's own shell command line and kills it. Use `pkill -x <name>`.
|
||||
- Sanity checks before suspecting the client:
|
||||
- `nc -z -w2 HOST PAIRPORT` — closed = code was consumed (good sign), open = GUI still showing (expected)
|
||||
- `nc -z -w2 HOST SESSIONPORT` — must stay open
|
||||
|
||||
+6
-6
@@ -1,5 +1,7 @@
|
||||
# MVT (mvt-project) on the phone itself, from Termux
|
||||
|
||||
Full workflow (widgets, androidqf, iOS sysdiagnose, report): see the `spycheck` skill. This file only covers install and the no-ADB quick check.
|
||||
|
||||
## Install (verified)
|
||||
```bash
|
||||
unset LD_LIBRARY_PATH
|
||||
@@ -7,10 +9,12 @@ pkg install -y python-pip python-cryptography rust # rust is needed for the py
|
||||
/data/data/com.termux/files/usr/bin/python -m venv --system-site-packages --without-pip ~/mvt-venv
|
||||
# run in the background, it takes several minutes:
|
||||
env -u LD_LIBRARY_PATH ~/mvt-venv/bin/python -m pip install mvt > ~/mvt-install.log 2>&1
|
||||
env -u LD_LIBRARY_PATH ~/mvt-venv/bin/python -m pip uninstall -y cryptography # use Termux's python-cryptography; the pip wheel fails with dlopen PyModule_Type
|
||||
env -u LD_LIBRARY_PATH ~/mvt-venv/bin/mvt-android download-iocs # -> ~/.local/share/mvt/indicators/*.stix2
|
||||
```
|
||||
- `--without-pip`: venv's ensurepip fails here. The system pip is reused through `--system-site-packages`.
|
||||
- If even plain Termux python fails to `import array`, run `pkg upgrade python` (a partial upgrade leaves lib-dynload out of sync).
|
||||
- If even plain Termux python fails to `import array`, first check that LD_LIBRARY_PATH is unset; only then try `pkg upgrade python`.
|
||||
- `pip check` complains about the cryptography version pin afterwards; MVT runs fine anyway.
|
||||
|
||||
## Quick check without ADB (app IDs vs IOCs)
|
||||
```bash
|
||||
@@ -18,8 +22,4 @@ env -u LD_LIBRARY_PATH ~/mvt-venv/bin/mvt-android download-iocs # -> ~/.local/
|
||||
```
|
||||
Line format: `package:<apk path>=<pkg> installer=<x> uid:<n>`. Parse the package with `\.apk=(\S+)\s+installer`. Pull the IOC app IDs from the STIX `pattern` fields with the regex `app:id\s*=\s*'([^']+)'`, then intersect the two sets.
|
||||
Also list the `/data/app` packages with `installer=null`. These are sideloaded via adb or restored from a backup, so mention them as "worth a look", not as a finding.
|
||||
Limits: this check covers app IDs only. Processes, logs, SMS/URLs, files and settings need `mvt-android check-adb` (or androidqf) over a paired ADB session.
|
||||
|
||||
## Full scan
|
||||
Pair via wireless debugging (SKILL.md §4), then:
|
||||
`env -u LD_LIBRARY_PATH ~/mvt-venv/bin/mvt-android check-adb --output ~/mvt-out`
|
||||
Limits: app IDs only. For processes, logs, settings and hashes use androidqf + `mvt-android check-androidqf` (`check-adb` was removed from MVT).
|
||||
|
||||
Reference in New Issue
Block a user