ohmyg0sh
Scan Android APK files for exposed API keys and secrets to prevent credential leaks.
1.2K
ohmyg0sh is an APK security scanner that decompiles packages with jadx, applies a curated library of credential and secret patterns, filters false positives, and produces text or JSON reports.
ApkError, JadxError, ConfigurationError, ScanError)scanConcurrency)dart pub global activate ohmyg0sh
# then
ohmyg0sh -f app-release.apk
dependencies:
ohmyg0sh: ^1.70.0
dart pub get
docker pull mathtechstudio/ohmyg0sh:latest
docker run -it --rm -v "$PWD":/work -w /work mathtechstudio/ohmyg0sh:latest -f /work/app-release.apk
jadx)PATH, or passed with --jadx# macOS
brew install jadx
# Linux / Windows
# Download from https://github.com/skylot/jadx/releases and add the binary to PATH
# Basic scan
ohmyg0sh -f app-release.apk
# JSON results
ohmyg0sh -f app-release.apk --json -o results.json
# Custom patterns & extra jadx flags
ohmyg0sh -f app-release.apk -p custom/regexes.json -a "--deobf --log-level INFO"
Tip
If your output file name starts with `-`, provide the path as `--output=./-results.json` to avoid option parsing issues.
import 'package:ohmyg0sh/ohmyg0sh.dart';
Future<void> main() async {
final scanner = OhMyG0sh(
apkPath: './app-release.apk',
outputJson: true,
outputFile: 'results.json',
);
await scanner.run();
}
Advanced Usage with Error Handling:
import 'package:ohmyg0sh/ohmyg0sh.dart';
Future<void> main() async {
final scanner = OhMyG0sh(
apkPath: './app-release.apk',
outputJson: true,
outputFile: 'results.json',
scanConcurrency: 32, // Adjust for performance
showProgress: true, // Display progress
continueOnJadxError: true, // Continue on partial failures
);
try {
await scanner.run();
print('✓ Scan completed successfully');
} on ApkError catch (e) {
print('❌ APK Error: ${e.message}');
} on JadxError catch (e) {
print('❌ JADX Error: ${e.message}');
} on ConfigurationError catch (e) {
print('❌ Configuration Error: ${e.message}');
} catch (e) {
print('❌ Unexpected Error: $e');
}
}
For detailed error scenarios and solutions, see ERROR_SCENARIOS.md.
regexes.json)// your-fucking-rules.json
{
"Google_API_Key": "AIza[0-9A-Za-z\\-_]{35}",
"AWS_Access_Key": "AKIA[0-9A-Z]{16}",
"Custom_Token": "myapp_[a-f0-9]{32}"
// ...
}
Use via ohmyg0sh -f app.apk -p my-patterns.json.
notkeyhacks.json){
"patterns": ["example\\.com"],
"contains": ["PLACEHOLDER"],
"Google_API_Key": ["AIzaGRAPHIC_DESIGN"]
}
Use via ohmyg0sh -f app.apk -n my-filters.json.
Bundled rules detect secrets across:
Review the full list in config/regexes.json.
** Scanning against 'com.example.app'
[Google_API_Key]
- AIzaSyD...
** Results saved into 'results_1234567890.txt'.
{
"package": "com.example.app",
"results": [
{
"name": "Google_API_Key",
"matches": ["AIzaSyD..."]
}
],
"generated_at": "2025-10-07T14:00:00Z",
"generated_by": "ohmyg0sh",
"repository": "https://github.com/mathtechstudio/ohmyg0sh",
"pub_dev": "https://pub.dev/packages/ohmyg0sh"
}
| Option | Short | Description |
|---|---|---|
--file | -f | APK file to scan (required) |
--output | -o | Output file path (auto-generated if missing) |
--json | Emit JSON instead of text | |
--pattern | -p | Custom regexes.json file |
--notkeys | -n | Custom notkeyhacks.json file |
--jadx | Explicit path to the jadx binary | |
--args | -a | Additional jadx arguments (quoted) |
--help | -h | Show usage |
jadxnotkeyhacks rulesjadx Not Foundbrew install jadx # macOS
which jadx && jadx --version
Or run with --jadx /custom/path/to/jadx.
jadx Exits with ErrorsOhMyG0sh continues when usable artifacts exist and suppresses the noisy ERROR - finished with errors line. For verbose logs use:
ohmyg0sh -f app.apk -a "--log-level DEBUG"
Search order:
--pattern path (if provided)/app/config/regexes.json (Docker image)package:ohmyg0sh/config/regexes.json (pub install)./config/regexes.jsonalias ohmyg0sh='docker run --rm -it -v "$PWD":/work -w /work mathtechstudio/ohmyg0sh:latest'
ohmyg0sh -f app-release.apk
With custom patterns:
docker run -it --rm \
-v "$PWD":/work \
-v "$PWD/patterns.json":/patterns.json \
-w /work \
mathtechstudio/ohmyg0sh:latest \
-f /work/app.apk -p /patterns.json
git clone https://github.com/mathtechstudio/ohmyg0sh.git
cd ohmyg0sh
dart pub get
dart run bin/ohmyg0sh.dart -f app-release.apk
dart test
Since this tool includes some contributions, and I'm not an asshole, I'll publically thank the following users for their helps and resources:
Released under the MIT License - see the MIT License file for details.
Star on GitHub | View on pub.dev | Docker | Report Issues
Content type
Image
Digest
sha256:046cc7153…
Size
218.5 MB
Last updated
6 months ago
docker pull mathtechstudio/ohmyg0sh