forked from TheQmaks/phantom-frida
-
Notifications
You must be signed in to change notification settings - Fork 3
206 lines (181 loc) · 7.52 KB
/
Copy pathscheduled-build.yml
File metadata and controls
206 lines (181 loc) · 7.52 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Weekly Stealth Build
on:
schedule:
# Every Sunday at 03:00 UTC
- cron: '0 3 * * 0'
workflow_dispatch:
inputs:
frida_version:
description: 'Frida version (empty = latest)'
required: false
default: ''
arch:
description: 'Target architecture(s)'
required: true
default: 'android-arm64'
type: choice
options:
- android-arm64
- android-arm
- android-arm64,android-arm
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-22.04
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect latest Frida version
id: version
run: |
if [ -n "${{ inputs.frida_version }}" ]; then
VERSION="${{ inputs.frida_version }}"
else
VERSION=$(curl -s https://api.github.com/repos/frida/frida/releases/latest | python3 -c "import sys,json; print(json.load(sys.stdin)['tag_name'])")
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Frida version: $VERSION"
- name: Generate random name and port
id: random
run: |
NAME=$(python3 namegen.py --weekly --quiet)
PORT=$(python3 namegen.py --weekly --port-only --quiet)
echo "name=$NAME" >> $GITHUB_OUTPUT
echo "port=$PORT" >> $GITHUB_OUTPUT
echo "Build name: $NAME, port: $PORT"
- name: System info
run: |
echo "CPUs: $(nproc)"
echo "RAM: $(free -h | grep Mem | awk '{print $2}')"
echo "Disk: $(df -h / | tail -1 | awk '{print $4}') free"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl git python3 unzip
- name: Cache NDK
uses: actions/cache@v4
id: ndk-cache
with:
path: build/android-ndk-r29
key: ndk-r29-linux
- name: Download NDK
if: steps.ndk-cache.outputs.cache-hit != 'true'
run: |
mkdir -p build
curl -L -o build/android-ndk-r29-linux.zip \
https://dl.google.com/android/repository/android-ndk-r29-linux.zip
cd build && unzip -q android-ndk-r29-linux.zip && rm android-ndk-r29-linux.zip
- name: Cache Frida source
uses: actions/cache@v4
id: frida-cache
with:
path: build/frida
key: frida-${{ steps.version.outputs.version }}-source
- name: Clone Frida
if: steps.frida-cache.outputs.cache-hit != 'true'
run: |
git clone --recurse-submodules --branch ${{ steps.version.outputs.version }} --depth 1 \
https://github.com/frida/frida.git build/frida
- name: Prepare fresh source from cache
if: steps.frida-cache.outputs.cache-hit == 'true'
run: |
cd build/frida
git checkout -- .
git submodule foreach --recursive 'git checkout -- . || true'
git clean -fdx || true
rm -rf build/
- name: Build
run: |
python3 build.py \
--version ${{ steps.version.outputs.version }} \
--name ${{ steps.random.outputs.name }} \
--arch ${{ inputs.arch || 'android-arm64' }} \
--port ${{ steps.random.outputs.port }} \
--extended \
--skip-clone \
--ndk-path build/android-ndk-r29 \
--verify
- name: Generate build info
run: |
cat > output/build-info.json <<EOF
{
"name": "${{ steps.random.outputs.name }}",
"port": ${{ steps.random.outputs.port }},
"version": "${{ steps.version.outputs.version }}",
"arch": "${{ inputs.arch || 'android-arm64' }}",
"date": "$(date -u +%Y-%m-%d)"
}
EOF
- name: List artifacts
run: |
echo "=== Build: ${{ steps.random.outputs.name }} (port ${{ steps.random.outputs.port }}) ==="
ls -lh output/
echo ""
echo "=== Binary verification ==="
for f in output/*; do
if [[ ! "$f" == *.gz ]]; then
count=$(strings "$f" | grep -c "frida" || true)
echo "$f: $count residual 'frida' strings"
fi
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: stealth-${{ steps.random.outputs.name }}-${{ steps.version.outputs.version }}
path: |
output/*.gz
output/build-info.json
retention-days: 30
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="v${{ steps.version.outputs.version }}-$(date +%Y%m%d)"
TITLE="Stealth Build — ${{ steps.random.outputs.name }} (Frida ${{ steps.version.outputs.version }})"
cat > /tmp/release.md <<RELEASE_EOF
## Stealth Frida Server
| Parameter | Value |
|-----------|-------|
| Frida version | ${{ steps.version.outputs.version }} |
| Custom name | \`${{ steps.random.outputs.name }}\` |
| Custom port | \`${{ steps.random.outputs.port }}\` |
| Architecture | \`${{ inputs.arch || 'android-arm64' }}\` |
| Extended patches | Yes (all 16 detection vectors) |
### Deploy
\`\`\`bash
# Extract
gunzip ${{ steps.random.outputs.name }}-server-*-android-arm64.gz
# Push to device
adb push ${{ steps.random.outputs.name }}-server-*-android-arm64 /data/local/tmp/${{ steps.random.outputs.name }}-server
adb shell chmod 755 /data/local/tmp/${{ steps.random.outputs.name }}-server
# Start
adb shell /data/local/tmp/${{ steps.random.outputs.name }}-server -D &
frida -H 127.0.0.1:${{ steps.random.outputs.port }} -f com.example.app
\`\`\`
### Connect
Standard \`frida-tools\` (\`pip install frida-tools\`) connects normally — use \`-H 127.0.0.1:${{ steps.random.outputs.port }}\` instead of \`-U\`.
RELEASE_EOF
gh release create "$TAG" output/*.gz output/build-info.json \
--title "$TITLE" \
--notes-file /tmp/release.md \
--latest
- name: Build summary
run: |
echo "## Weekly Stealth Build" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Parameter | Value |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Frida version | ${{ steps.version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
echo "| Custom name | ${{ steps.random.outputs.name }} |" >> $GITHUB_STEP_SUMMARY
echo "| Custom port | ${{ steps.random.outputs.port }} |" >> $GITHUB_STEP_SUMMARY
echo "| Architecture | ${{ inputs.arch || 'android-arm64' }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Deploy:" >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
echo "adb push ${{ steps.random.outputs.name }}-server /data/local/tmp/${{ steps.random.outputs.name }}-server" >> $GITHUB_STEP_SUMMARY
echo "adb shell chmod 755 /data/local/tmp/${{ steps.random.outputs.name }}-server" >> $GITHUB_STEP_SUMMARY
echo "adb shell /data/local/tmp/${{ steps.random.outputs.name }}-server &" >> $GITHUB_STEP_SUMMARY
echo "frida -H 127.0.0.1:${{ steps.random.outputs.port }} -f com.example.app" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY