frooky 0.1.3__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- frooky-0.2.1/.github/copilot-instructions.md +260 -0
- frooky-0.2.1/.github/scripts/android/install-frida-server.sh +12 -0
- frooky-0.2.1/.github/scripts/android/prep-device.sh +7 -0
- frooky-0.2.1/.github/scripts/create-job-summary.sh +44 -0
- frooky-0.2.1/.github/scripts/evaluate-results.sh +20 -0
- frooky-0.2.1/.github/scripts/prepare-artifacts.sh +33 -0
- frooky-0.2.1/.github/workflows/build.yml +37 -0
- frooky-0.2.1/.github/workflows/publish.yml +30 -0
- frooky-0.2.1/.github/workflows/test-android-runtime.yml +134 -0
- frooky-0.2.1/.github/workflows/test-build.yml +39 -0
- frooky-0.2.1/.github/workflows/test-ios-runtime.yml +131 -0
- frooky-0.2.1/.github/workflows/test.yml +33 -0
- {frooky-0.1.3 → frooky-0.2.1}/.gitignore +0 -7
- frooky-0.2.1/MANIFEST.in +6 -0
- frooky-0.2.1/PKG-INFO +142 -0
- {frooky-0.1.3 → frooky-0.2.1}/README.md +8 -6
- frooky-0.2.1/compileAgent.sh +20 -0
- frooky-0.2.1/docs/develop.md +40 -0
- frooky-0.2.1/docs/examples/android-app/MASTG-DEMO-0060.apk.zip +0 -0
- frooky-0.2.1/docs/examples/android-app/MastgTest.kt +43 -0
- frooky-0.2.1/docs/examples/android-app/auto.sh +72 -0
- frooky-0.2.1/docs/examples/android-app/build.gradle.kts.libs +1 -0
- frooky-0.2.1/docs/examples/android-app/expectations.conf +5 -0
- frooky-0.2.1/docs/examples/android-app/flow.yaml +6 -0
- frooky-0.2.1/docs/examples/android-app/frida_sanity.js +6 -0
- frooky-0.2.1/docs/examples/evaluate.sh +86 -0
- frooky-0.2.1/docs/examples/ios-app/MastgTest.swift +26 -0
- frooky-0.2.1/docs/examples/ios-app/auto.sh +61 -0
- frooky-0.2.1/docs/examples/ios-app/expectations.conf +5 -0
- frooky-0.2.1/docs/examples/ios-app/flow.yaml +6 -0
- frooky-0.2.1/docs/examples/ios-app/hooks.json +18 -0
- {frooky-0.1.3 → frooky-0.2.1}/docs/usage.md +23 -23
- {frooky-0.1.3 → frooky-0.2.1}/frooky/_version.py +3 -3
- frooky-0.2.1/frooky/agent/dist/agent-android.js +1890 -0
- frooky-0.2.1/frooky/agent/dist/agent-ios.js +207 -0
- frooky-0.2.1/frooky/agent/dist/version.json +7 -0
- {frooky-0.1.3 → frooky-0.2.1}/frooky/cli.py +25 -8
- {frooky-0.1.3 → frooky-0.2.1}/frooky/frida_runner.py +27 -126
- frooky-0.2.1/frooky.egg-info/PKG-INFO +142 -0
- frooky-0.2.1/frooky.egg-info/SOURCES.txt +52 -0
- frooky-0.2.1/frooky.egg-info/requires.txt +2 -0
- {frooky-0.1.3 → frooky-0.2.1}/pyproject.toml +8 -8
- frooky-0.1.3/.github/workflows/publish.yml +0 -35
- frooky-0.1.3/PKG-INFO +0 -815
- frooky-0.1.3/frooky/android/android_decoder.js +0 -375
- frooky-0.1.3/frooky/android/base_script.js +0 -602
- frooky-0.1.3/frooky/android/native_decoder.js +0 -161
- frooky-0.1.3/frooky/ios/base_script.js +0 -668
- frooky-0.1.3/frooky/resources.py +0 -7
- frooky-0.1.3/frooky.egg-info/PKG-INFO +0 -815
- frooky-0.1.3/frooky.egg-info/SOURCES.txt +0 -27
- frooky-0.1.3/frooky.egg-info/requires.txt +0 -2
- {frooky-0.1.3 → frooky-0.2.1}/.github/workflows/sync-labels.yml +0 -0
- {frooky-0.1.3 → frooky-0.2.1}/LICENSE +0 -0
- {frooky-0.1.3/docs/examples → frooky-0.2.1/docs/examples/android-app}/hooks.json +0 -0
- {frooky-0.1.3/docs/examples → frooky-0.2.1/docs/examples/android-app}/hooks2.json +0 -0
- {frooky-0.1.3 → frooky-0.2.1}/docs/examples/example.md +0 -0
- {frooky-0.1.3 → frooky-0.2.1}/docs/examples/output.json +0 -0
- {frooky-0.1.3 → frooky-0.2.1}/frooky/__init__.py +0 -0
- {frooky-0.1.3 → frooky-0.2.1}/frooky/__main__.py +0 -0
- {frooky-0.1.3 → frooky-0.2.1}/frooky.egg-info/dependency_links.txt +0 -0
- {frooky-0.1.3 → frooky-0.2.1}/frooky.egg-info/entry_points.txt +0 -0
- {frooky-0.1.3 → frooky-0.2.1}/frooky.egg-info/top_level.txt +0 -0
- {frooky-0.1.3 → frooky-0.2.1}/setup.cfg +0 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Copilot Instructions for Frooky
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
**Frooky** is a Frida-powered dynamic instrumentation tool for mobile app security testing on Android and iOS. It allows security testers to hook Java/Kotlin methods and native C/C++ functions using simple JSON configuration files.
|
|
6
|
+
|
|
7
|
+
### Key Technologies
|
|
8
|
+
|
|
9
|
+
- **Languages**: Python (CLI; see `requires-python` in [`pyproject.toml`](../pyproject.toml)), TypeScript/JavaScript (Frida agent)
|
|
10
|
+
- **Frameworks**: Frida (dynamic instrumentation), setuptools (Python packaging)
|
|
11
|
+
- **Build Tools**: npm/Node.js (for agent compilation), Python build module
|
|
12
|
+
- **Package Management**: pip (Python), npm (Node.js)
|
|
13
|
+
|
|
14
|
+
## Project Structure
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
frooky/
|
|
18
|
+
├── frooky/ # Main Python package
|
|
19
|
+
│ ├── __init__.py # Package initialization
|
|
20
|
+
│ ├── cli.py # Command-line interface entry point
|
|
21
|
+
│ ├── frida_runner.py # Core Frida execution logic
|
|
22
|
+
│ └── agent/ # Frida agent (TypeScript/JavaScript)
|
|
23
|
+
│ ├── package.json # Node.js dependencies
|
|
24
|
+
│ ├── tsconfig.json # TypeScript configuration
|
|
25
|
+
│ ├── build.js # Custom build script
|
|
26
|
+
│ ├── android/ # Android-specific agent code
|
|
27
|
+
│ ├── ios/ # iOS-specific agent code
|
|
28
|
+
│ └── dist/ # Compiled agent artifacts (git-ignored)
|
|
29
|
+
│ ├── agent-android.js # Built Android agent
|
|
30
|
+
│ ├── agent-ios.js # Built iOS agent
|
|
31
|
+
│ └── version.json # Version metadata
|
|
32
|
+
├── docs/ # Documentation
|
|
33
|
+
│ ├── develop.md # Development setup guide
|
|
34
|
+
│ ├── usage.md # Usage documentation
|
|
35
|
+
│ └── examples/ # Example hook configurations
|
|
36
|
+
├── .github/
|
|
37
|
+
│ └── workflows/ # CI/CD pipelines
|
|
38
|
+
│ ├── build.yml # Package build workflow (reusable)
|
|
39
|
+
│ ├── test-build.yml # PR/push verification
|
|
40
|
+
│ ├── publish.yml # PyPI publishing
|
|
41
|
+
│ └── sync-labels.yml # Label management
|
|
42
|
+
├── pyproject.toml # Python project configuration
|
|
43
|
+
├── compileAgent.sh # Agent build helper script
|
|
44
|
+
└── README.md # Main project documentation
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Build System & Workflow
|
|
48
|
+
|
|
49
|
+
### Two-Stage Build Process
|
|
50
|
+
|
|
51
|
+
Frooky uses a **two-stage build** that must be executed in order:
|
|
52
|
+
|
|
53
|
+
1. **Agent Compilation** (TypeScript → JavaScript):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
./compileAgent.sh --prod # Production build (minified)
|
|
57
|
+
./compileAgent.sh --dev # Development build (unminified)
|
|
58
|
+
```
|
|
59
|
+
- Runs inside [`frooky/agent/`](../frooky/agent/) directory
|
|
60
|
+
- Executes `npm ci` to install dependencies
|
|
61
|
+
- Compiles TypeScript sources from [`frooky/agent/android/`](../frooky/agent/android/) and [`frooky/agent/ios/`](../frooky/agent/ios/) subdirectories
|
|
62
|
+
- Outputs to [`frooky/agent/dist/`](../frooky/agent/dist/) as `agent-{android,ios}.js`
|
|
63
|
+
- **CRITICAL**: Agent artifacts MUST exist before Python package build
|
|
64
|
+
|
|
65
|
+
2. **Python Package Build**:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
python -m build
|
|
69
|
+
```
|
|
70
|
+
- Packages the Python CLI and includes pre-built agent artifacts
|
|
71
|
+
- Uses `setuptools-scm` for versioning from git tags
|
|
72
|
+
- Outputs wheel (`.whl`) and source tarball (`.tar.gz`) to `dist/`.
|
|
73
|
+
|
|
74
|
+
### Development Setup
|
|
75
|
+
|
|
76
|
+
To set up a local development environment:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# 1. Create and activate Python virtual environment
|
|
80
|
+
python3 -m venv venv
|
|
81
|
+
source venv/bin/activate
|
|
82
|
+
|
|
83
|
+
# 2. Compile Frida agents
|
|
84
|
+
./compileAgent.sh --dev
|
|
85
|
+
|
|
86
|
+
# 3. Install CLI in editable mode
|
|
87
|
+
pip install -e .
|
|
88
|
+
|
|
89
|
+
# 4. Verify installation
|
|
90
|
+
which frooky # Should point to venv/bin/frooky
|
|
91
|
+
frooky --help
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Watch Mode for Active Development
|
|
95
|
+
|
|
96
|
+
For iterative agent development, use watch mode:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd frooky/agent
|
|
100
|
+
npm run watch-android # Auto-recompile on Android agent changes
|
|
101
|
+
npm run watch-ios # Auto-recompile on iOS agent changes
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Note: Use `watch-android` and/or `watch-ios` depending on which platform you're working on.
|
|
105
|
+
|
|
106
|
+
## Testing & CI/CD
|
|
107
|
+
|
|
108
|
+
### Test Infrastructure
|
|
109
|
+
|
|
110
|
+
- **No unit tests currently exist** - the project only does CI verification at the moment, but testing of the codebase is in planning
|
|
111
|
+
- **CI Verification** ([`.github/workflows/test-build.yml`](workflows/test-build.yml)):
|
|
112
|
+
- Builds the package (agent + Python wheel)
|
|
113
|
+
- Verifies wheel can be installed
|
|
114
|
+
- Checks that `frooky --help` runs successfully
|
|
115
|
+
- Validates agent artifacts are included in wheel: `frooky/agent/dist/agent-android.js` and `frooky/agent/dist/agent-ios.js`
|
|
116
|
+
|
|
117
|
+
### Running CI Checks Locally
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Full build verification (mimics CI)
|
|
121
|
+
./compileAgent.sh --prod
|
|
122
|
+
python -m build
|
|
123
|
+
python -m pip install dist/*.whl
|
|
124
|
+
frooky --help
|
|
125
|
+
|
|
126
|
+
# Verify agent artifacts in wheel
|
|
127
|
+
unzip -l dist/*.whl | grep "frooky/agent/dist/agent-android.js"
|
|
128
|
+
unzip -l dist/*.whl | grep "frooky/agent/dist/agent-ios.js"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Important Gotchas & Considerations
|
|
132
|
+
|
|
133
|
+
### 1. **Agent Artifacts Must Be Built First**
|
|
134
|
+
|
|
135
|
+
- **ALWAYS** run `./compileAgent.sh` before `python -m build`
|
|
136
|
+
- Python packaging will fail or produce incomplete artifacts if agents are missing
|
|
137
|
+
- The [`compileAgent.sh`](../compileAgent.sh) script must be executable (`chmod +x compileAgent.sh`)
|
|
138
|
+
|
|
139
|
+
### 2. **Version Management**
|
|
140
|
+
|
|
141
|
+
- Version is determined by `setuptools-scm` from git tags and commits
|
|
142
|
+
- Requires full git history: `git clone` without depth restrictions or fetch with `fetch-depth: 0` in CI
|
|
143
|
+
- Generated version file: `frooky/_version.py` (git-ignored, auto-created during build)
|
|
144
|
+
- **Do not manually edit version numbers**
|
|
145
|
+
|
|
146
|
+
### 3. **Node.js Environment**
|
|
147
|
+
|
|
148
|
+
- Node.js version is pinned in CI (see `actions/setup-node` in [`.github/workflows/build.yml`](workflows/build.yml))
|
|
149
|
+
- Use `npm ci` (not `npm install`) for consistent dependency installation
|
|
150
|
+
- Package lock file is at [`frooky/agent/package-lock.json`](../frooky/agent/package-lock.json)
|
|
151
|
+
|
|
152
|
+
### 4. **Python Version Compatibility**
|
|
153
|
+
|
|
154
|
+
- Minimum supported Python is defined by `requires-python` in [`pyproject.toml`](../pyproject.toml)
|
|
155
|
+
- The set of versions exercised in CI is defined in [`.github/workflows/`](workflows/) (see `actions/setup-python` steps)
|
|
156
|
+
- Uses modern Python features (e.g., `from __future__ import annotations`)
|
|
157
|
+
|
|
158
|
+
### 5. **Frida Dependencies**
|
|
159
|
+
|
|
160
|
+
- Frida dependency constraints are defined in [`pyproject.toml`](../pyproject.toml) under `project.dependencies`
|
|
161
|
+
- These are system-dependent native packages that may take time to install
|
|
162
|
+
|
|
163
|
+
### 6. **Output Files**
|
|
164
|
+
|
|
165
|
+
- Default output: `output.json` (git-ignored)
|
|
166
|
+
- Output format: JSON Lines (NDJSON) - one JSON object per line
|
|
167
|
+
- Use `jq . output.json` to pretty-print
|
|
168
|
+
|
|
169
|
+
### 7. **Git Pager Issues**
|
|
170
|
+
|
|
171
|
+
- **ALWAYS** use `git --no-pager` when running git commands programmatically
|
|
172
|
+
- Example: `git --no-pager status`, `git --no-pager diff`
|
|
173
|
+
|
|
174
|
+
## Common Tasks
|
|
175
|
+
|
|
176
|
+
### Modifying the frooky
|
|
177
|
+
|
|
178
|
+
1. Edit TypeScript files in [`frooky/agent/android/`](../frooky/agent/android/) or [`frooky/agent/ios/`](../frooky/agent/ios/)
|
|
179
|
+
2. Recompile: `cd frooky/agent && npm run dev-{android|ios}`
|
|
180
|
+
3. Test locally with `pip install -e .` and run `frooky` commands
|
|
181
|
+
4. Run `frooky --help` to make sure the agent scripts are properly compiled
|
|
182
|
+
|
|
183
|
+
### Modifying Python CLI
|
|
184
|
+
|
|
185
|
+
1. Edit [`frooky/cli.py`](../frooky/cli.py) or [`frooky/frida_runner.py`](../frooky/frida_runner.py)
|
|
186
|
+
2. Changes are immediately available with `pip install -e .`
|
|
187
|
+
3. Test with `frooky --help` or relevant commands
|
|
188
|
+
|
|
189
|
+
### Adding Dependencies
|
|
190
|
+
|
|
191
|
+
- **Python**: Add to `dependencies` array in [`pyproject.toml`](../pyproject.toml)
|
|
192
|
+
- **Node.js**: Run `cd frooky/agent && npm install --save-dev <package>`
|
|
193
|
+
|
|
194
|
+
### Documentation Updates
|
|
195
|
+
|
|
196
|
+
- Main docs are in [`docs/`](../docs/) directory
|
|
197
|
+
- README.md provides quick start and examples
|
|
198
|
+
- Usage guide: [`docs/usage.md`](../docs/usage.md)
|
|
199
|
+
- Development guide: [`docs/develop.md`](../docs/develop.md)
|
|
200
|
+
|
|
201
|
+
### Adding Examples
|
|
202
|
+
|
|
203
|
+
- Main examples are in [`docs/examples`](../docs/examples/) directory
|
|
204
|
+
- Add new examples to demonstrate a new feature
|
|
205
|
+
|
|
206
|
+
### Modifying Examples
|
|
207
|
+
|
|
208
|
+
- Main examples are in [`docs/examples`](../docs/examples/) directory
|
|
209
|
+
- Modify existing examples if a feature or the public API changes
|
|
210
|
+
|
|
211
|
+
## Key Files to Understand
|
|
212
|
+
|
|
213
|
+
### Python Side
|
|
214
|
+
|
|
215
|
+
- **[`frooky/cli.py`](../frooky/cli.py)**: Argument parsing, CLI entry point
|
|
216
|
+
- **[`frooky/frida_runner.py`](../frooky/frida_runner.py)**: Core logic for loading hooks, attaching to processes, injecting agents
|
|
217
|
+
- **[`pyproject.toml`](../pyproject.toml)**: Project metadata, dependencies, build configuration
|
|
218
|
+
|
|
219
|
+
### Agent Side
|
|
220
|
+
|
|
221
|
+
- **[`frooky/agent/build.js`](../frooky/agent/build.js)**: Custom build orchestrator (handles TypeScript compilation, file watching)
|
|
222
|
+
- **[`frooky/agent/android/`](../frooky/agent/android/)**: Android-specific hook implementations
|
|
223
|
+
- **[`frooky/agent/ios/`](../frooky/agent/ios/)**: iOS-specific hook implementations
|
|
224
|
+
- **[`frooky/agent/package.json`](../frooky/agent/package.json)**: Frida bridge dependencies, build scripts
|
|
225
|
+
|
|
226
|
+
## Workflow for Code Changes
|
|
227
|
+
|
|
228
|
+
1. **Identify scope**: Python CLI, Android agent, iOS agent, docs or examples?
|
|
229
|
+
2. **Set up dev environment**: Virtual env + compile agents
|
|
230
|
+
3. **Make changes**: Edit relevant files
|
|
231
|
+
4. **Rebuild as needed**:
|
|
232
|
+
- Android agent changes: `cd frooky/agent && npm run dev-android`
|
|
233
|
+
- iOS agent changes: `cd frooky/agent && npm run dev-ios`
|
|
234
|
+
- Python changes: No rebuild needed with `pip install -e .`
|
|
235
|
+
5. **Test manually**: Run `frooky` commands against test apps/hooks
|
|
236
|
+
6. **Verify CI would pass**: Run full build + install verification locally
|
|
237
|
+
7. **Update docs** if user-facing behavior changes
|
|
238
|
+
8. **Update examples** if an example exists or it makes sense to make one for a new feature
|
|
239
|
+
9. **Update Copilot instructions** in [`.github/copilot-instructions.md`](copilot-instructions.md) if needed
|
|
240
|
+
|
|
241
|
+
## Platform-Specific Notes
|
|
242
|
+
|
|
243
|
+
### Android
|
|
244
|
+
|
|
245
|
+
- Hooks Java/Kotlin methods using Frida's Java bridge (`frida-java-bride`)
|
|
246
|
+
- Class names use Java notation: `android.security.keystore.KeyGenParameterSpec$Builder`
|
|
247
|
+
- Can hook constructors with `$init` method name
|
|
248
|
+
|
|
249
|
+
### iOS
|
|
250
|
+
|
|
251
|
+
- Hooks Objective-C and Swift methods
|
|
252
|
+
- Uses Frida's ObjC and Swift bridges (`frida-objc-bridge` and `frida-swift-bridge`)
|
|
253
|
+
- Method syntax differs from Android (see [`docs/usage.md`](../docs/usage.md))
|
|
254
|
+
|
|
255
|
+
## Debugging Tips
|
|
256
|
+
|
|
257
|
+
- **Agent not loading**: Check that `frooky/agent/dist/` contains `agent-{platform}.js` and is recent
|
|
258
|
+
- **Import errors**: Ensure you're using the venv Python (`which python`)
|
|
259
|
+
- **Frida connection issues**: Verify target device has `frida-server` running
|
|
260
|
+
- **Build failures**: Check Node.js version (needs 24+), ensure [`compileAgent.sh`](../compileAgent.sh) is executable
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Download and setup frida-server
|
|
5
|
+
FRIDA_VERSION=$(frida --version) && echo "Frida version: $FRIDA_VERSION" && wget "https://github.com/frida/frida/releases/download/${FRIDA_VERSION}/frida-server-${FRIDA_VERSION}-android-x86_64.xz" && unxz "frida-server-${FRIDA_VERSION}-android-x86_64.xz" && adb push "frida-server-${FRIDA_VERSION}-android-x86_64" /data/local/tmp/frida-server
|
|
6
|
+
adb shell "chmod 755 /data/local/tmp/frida-server"
|
|
7
|
+
|
|
8
|
+
# Start frida-server in background
|
|
9
|
+
adb shell "nohup /data/local/tmp/frida-server >/data/local/tmp/frida.log 2>&1 </dev/null &"
|
|
10
|
+
|
|
11
|
+
sleep 2
|
|
12
|
+
adb shell "ps | grep frida-server"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Usage: create-job-summary.sh <platform>
|
|
5
|
+
# Example: create-job-summary.sh android
|
|
6
|
+
|
|
7
|
+
PLATFORM="${1:-}"
|
|
8
|
+
|
|
9
|
+
if [ -z "$PLATFORM" ]; then
|
|
10
|
+
echo "Error: Platform argument required (android or ios)"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
RESULTS_DIR="${PLATFORM}-test-results"
|
|
15
|
+
PLATFORM_TITLE="$(echo "$PLATFORM" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}')"
|
|
16
|
+
|
|
17
|
+
# Add evaluation results at the top
|
|
18
|
+
if [ -f evaluation.txt ]; then
|
|
19
|
+
cat evaluation.txt
|
|
20
|
+
echo ""
|
|
21
|
+
echo "---"
|
|
22
|
+
echo ""
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
echo "# $PLATFORM_TITLE Test Results"
|
|
26
|
+
echo ""
|
|
27
|
+
|
|
28
|
+
echo "## frooky"
|
|
29
|
+
echo ""
|
|
30
|
+
echo '```sh'
|
|
31
|
+
cat "$RESULTS_DIR/frooky.log" 2>/dev/null || echo "No frooky.log found"
|
|
32
|
+
echo ""
|
|
33
|
+
echo '```'
|
|
34
|
+
echo ""
|
|
35
|
+
|
|
36
|
+
echo "## maestro"
|
|
37
|
+
echo ""
|
|
38
|
+
echo '```sh'
|
|
39
|
+
cat "$RESULTS_DIR/auto.log" 2>/dev/null || echo "No auto.log found"
|
|
40
|
+
echo '```'
|
|
41
|
+
echo ""
|
|
42
|
+
echo ""
|
|
43
|
+
|
|
44
|
+
echo "Job summary created for $PLATFORM_TITLE tests" >&2
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Usage: evaluate-results.sh <platform>
|
|
5
|
+
# Example: evaluate-results.sh android
|
|
6
|
+
|
|
7
|
+
PLATFORM="${1:-}"
|
|
8
|
+
|
|
9
|
+
if [ -z "$PLATFORM" ]; then
|
|
10
|
+
echo "Error: Platform argument required (android or ios)"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
EXAMPLE_DIR="docs/examples/${PLATFORM}-app"
|
|
15
|
+
|
|
16
|
+
cd "$EXAMPLE_DIR"
|
|
17
|
+
chmod +x ../evaluate.sh
|
|
18
|
+
../evaluate.sh | tee "$GITHUB_WORKSPACE/evaluation.txt"
|
|
19
|
+
EXIT_CODE=${PIPESTATUS[0]}
|
|
20
|
+
exit $EXIT_CODE
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Usage: prepare-artifacts.sh <platform>
|
|
5
|
+
# Example: prepare-artifacts.sh android
|
|
6
|
+
|
|
7
|
+
PLATFORM="${1:-}"
|
|
8
|
+
|
|
9
|
+
if [ -z "$PLATFORM" ]; then
|
|
10
|
+
echo "Error: Platform argument required (android or ios)"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
RESULTS_DIR="${PLATFORM}-test-results"
|
|
15
|
+
EXAMPLE_DIR="docs/examples/${PLATFORM}-app"
|
|
16
|
+
|
|
17
|
+
mkdir -p "$RESULTS_DIR"
|
|
18
|
+
|
|
19
|
+
# Copy files from example directory
|
|
20
|
+
cd "$EXAMPLE_DIR"
|
|
21
|
+
for file in auto.log frooky.log output.json before.png after.png; do
|
|
22
|
+
cp "$file" "$GITHUB_WORKSPACE/$RESULTS_DIR/" 2>/dev/null || true
|
|
23
|
+
done
|
|
24
|
+
cp -r tmp "$GITHUB_WORKSPACE/$RESULTS_DIR/" 2>/dev/null || true
|
|
25
|
+
cd "$GITHUB_WORKSPACE"
|
|
26
|
+
|
|
27
|
+
# Copy maestro log from most recent test run
|
|
28
|
+
LATEST_TEST=$(find ~/.maestro/tests -type f -name "maestro.log" 2>/dev/null | head -1)
|
|
29
|
+
if [ -n "$LATEST_TEST" ]; then
|
|
30
|
+
cp "$LATEST_TEST" "$RESULTS_DIR/maestro.log"
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
echo "Artifacts prepared in $RESULTS_DIR/"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Build Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
outputs:
|
|
6
|
+
artifact-name:
|
|
7
|
+
description: "Name of the uploaded artifact"
|
|
8
|
+
value: ${{ jobs.build.outputs.artifact-name }}
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
outputs:
|
|
16
|
+
artifact-name: ${{ steps.upload.outputs.artifact-name }}
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0 # Fetch all history and tags for setuptools-scm
|
|
21
|
+
- uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: "24"
|
|
24
|
+
cache: 'npm'
|
|
25
|
+
cache-dependency-path: './frooky/agent/package-lock.json'
|
|
26
|
+
- run: chmod +x compileAgent.sh
|
|
27
|
+
- run: ./compileAgent.sh --prod
|
|
28
|
+
- uses: actions/setup-python@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: "3.x"
|
|
31
|
+
- run: python -m pip install --upgrade build
|
|
32
|
+
- run: python -m build
|
|
33
|
+
- uses: actions/upload-artifact@v4
|
|
34
|
+
id: upload
|
|
35
|
+
with:
|
|
36
|
+
name: dist
|
|
37
|
+
path: dist/*
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
uses: ./.github/workflows/build.yml
|
|
13
|
+
|
|
14
|
+
verify-build:
|
|
15
|
+
needs: [build]
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
uses: ./.github/workflows/test-build.yml
|
|
19
|
+
|
|
20
|
+
publish:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
needs: [build, verify-build]
|
|
23
|
+
permissions:
|
|
24
|
+
id-token: write
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/download-artifact@v4
|
|
27
|
+
with:
|
|
28
|
+
name: ${{ needs.build.outputs.artifact-name }}
|
|
29
|
+
path: .
|
|
30
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
name: Test Android Runtime
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
timeout-minutes: 30
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout repository
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: actions/download-artifact@v4
|
|
19
|
+
with:
|
|
20
|
+
name: dist
|
|
21
|
+
path: dist
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: '3.12'
|
|
27
|
+
|
|
28
|
+
- name: Install frooky from wheel
|
|
29
|
+
run: pip install dist/*.whl
|
|
30
|
+
|
|
31
|
+
- name: Install Maestro
|
|
32
|
+
run: |
|
|
33
|
+
curl -Ls "https://get.maestro.mobile.dev" | bash
|
|
34
|
+
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
|
|
35
|
+
|
|
36
|
+
# - name: Set up JDK 17
|
|
37
|
+
# uses: actions/setup-java@v4
|
|
38
|
+
# with:
|
|
39
|
+
# java-version: '17'
|
|
40
|
+
# distribution: 'temurin'
|
|
41
|
+
|
|
42
|
+
# - name: Setup Gradle
|
|
43
|
+
# uses: gradle/actions/setup-gradle@v4
|
|
44
|
+
|
|
45
|
+
# - name: Clone mas-app-android repository
|
|
46
|
+
# uses: actions/checkout@v4
|
|
47
|
+
# with:
|
|
48
|
+
# repository: cpholguera/mas-app-android
|
|
49
|
+
# path: mas-app-android
|
|
50
|
+
|
|
51
|
+
# - name: Copy example files and build APK
|
|
52
|
+
# run: |
|
|
53
|
+
# EXAMPLE_DIR="docs/examples/android-app"
|
|
54
|
+
|
|
55
|
+
# # Copy MastgTest.kt if it exists
|
|
56
|
+
# if [ -f "$EXAMPLE_DIR/MastgTest.kt" ]; then
|
|
57
|
+
# cp -f "$EXAMPLE_DIR/MastgTest.kt" mas-app-android/app/src/main/java/org/owasp/mastestapp/MastgTest.kt
|
|
58
|
+
# echo "Copied MastgTest.kt"
|
|
59
|
+
# fi
|
|
60
|
+
|
|
61
|
+
# # Copy build.gradle.kts.libs if it exists
|
|
62
|
+
# if [ -f "$EXAMPLE_DIR/build.gradle.kts.libs" ]; then
|
|
63
|
+
# sed -i '/\/\/ ADD_LIBS_HERE/{
|
|
64
|
+
# r '"$EXAMPLE_DIR/build.gradle.kts.libs"'
|
|
65
|
+
# d
|
|
66
|
+
# }' mas-app-android/app/build.gradle.kts
|
|
67
|
+
# echo "Replaced libs in build.gradle.kts"
|
|
68
|
+
# fi
|
|
69
|
+
|
|
70
|
+
# # Build the APK
|
|
71
|
+
# cd mas-app-android
|
|
72
|
+
# ./gradlew assembleDebug --stacktrace
|
|
73
|
+
# echo "Build succeeded"
|
|
74
|
+
|
|
75
|
+
- name: Enable KVM
|
|
76
|
+
run: |
|
|
77
|
+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
|
78
|
+
sudo udevadm control --reload-rules
|
|
79
|
+
sudo udevadm trigger --name-match=kvm
|
|
80
|
+
|
|
81
|
+
- name: Start Android Emulator and Run Tests
|
|
82
|
+
uses: reactivecircus/android-emulator-runner@v2
|
|
83
|
+
with:
|
|
84
|
+
api-level: 34
|
|
85
|
+
target: google_apis
|
|
86
|
+
arch: x86_64
|
|
87
|
+
emulator-options: -wipe-data -no-snapshot-save -no-snapshot-load -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
|
|
88
|
+
disable-animations: true
|
|
89
|
+
script: |
|
|
90
|
+
|
|
91
|
+
chmod +x .github/scripts/android/prep-device.sh
|
|
92
|
+
.github/scripts/android/prep-device.sh
|
|
93
|
+
|
|
94
|
+
chmod +x .github/scripts/android/install-frida-server.sh
|
|
95
|
+
.github/scripts/android/install-frida-server.sh
|
|
96
|
+
|
|
97
|
+
# Install the app APK
|
|
98
|
+
cd docs/examples/android-app && unzip -o MASTG-DEMO-0060.apk.zip && adb install -r MASTG-DEMO-0060.apk
|
|
99
|
+
|
|
100
|
+
# adb install mas-app-android/app/build/outputs/apk/debug/app-debug.apk
|
|
101
|
+
|
|
102
|
+
# Run the testing script
|
|
103
|
+
cd docs/examples/android-app && chmod +x auto.sh && ./auto.sh
|
|
104
|
+
|
|
105
|
+
# - name: Upload APK
|
|
106
|
+
# uses: actions/upload-artifact@v4
|
|
107
|
+
# with:
|
|
108
|
+
# name: MASTestApp.apk
|
|
109
|
+
# path: mas-app-android/app/build/outputs/apk/debug/app-debug.apk
|
|
110
|
+
|
|
111
|
+
- name: Prepare artifacts for upload
|
|
112
|
+
if: always()
|
|
113
|
+
run: |
|
|
114
|
+
chmod +x .github/scripts/prepare-artifacts.sh
|
|
115
|
+
.github/scripts/prepare-artifacts.sh android
|
|
116
|
+
|
|
117
|
+
- name: Evaluate Test Results
|
|
118
|
+
if: always()
|
|
119
|
+
run: |
|
|
120
|
+
chmod +x .github/scripts/evaluate-results.sh
|
|
121
|
+
.github/scripts/evaluate-results.sh android
|
|
122
|
+
|
|
123
|
+
- name: Create Job Summary
|
|
124
|
+
if: always()
|
|
125
|
+
run: |
|
|
126
|
+
chmod +x .github/scripts/create-job-summary.sh
|
|
127
|
+
.github/scripts/create-job-summary.sh android >> $GITHUB_STEP_SUMMARY
|
|
128
|
+
|
|
129
|
+
- name: Upload Dynamic Test Artifacts
|
|
130
|
+
if: always()
|
|
131
|
+
uses: actions/upload-artifact@v4
|
|
132
|
+
with:
|
|
133
|
+
name: android-dynamic-test-results
|
|
134
|
+
path: android-test-results/*
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Verify Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
verify:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: '3.12'
|
|
18
|
+
|
|
19
|
+
- uses: actions/download-artifact@v4
|
|
20
|
+
with:
|
|
21
|
+
name: dist
|
|
22
|
+
path: dist
|
|
23
|
+
|
|
24
|
+
- name: Check build artifacts
|
|
25
|
+
run: |
|
|
26
|
+
ls -lh dist/
|
|
27
|
+
test -f dist/*.whl
|
|
28
|
+
test -f dist/*.tar.gz
|
|
29
|
+
|
|
30
|
+
- name: Test install from wheel
|
|
31
|
+
run: |
|
|
32
|
+
python -m pip install dist/*.whl
|
|
33
|
+
frooky --help
|
|
34
|
+
|
|
35
|
+
- name: Verify agent artifacts in wheel
|
|
36
|
+
run: |
|
|
37
|
+
unzip -l dist/*.whl | grep "frooky/agent/dist/agent-android.js"
|
|
38
|
+
unzip -l dist/*.whl | grep "frooky/agent/dist/agent-ios.js"
|
|
39
|
+
echo "All agent artifacts present in wheel"
|