-
-
Notifications
You must be signed in to change notification settings - Fork 158
490 lines (473 loc) · 19.6 KB
/
go.yml
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
name: Go
on:
push:
branches:
- master
paths-ignore:
- "*.md"
- "www/**"
- ".github/workflows/apple-meta.yml"
- ".github/workflows/codeql.yml"
- ".github/workflows/discord.yml"
- ".github/workflows/docs.yml"
- ".github/workflows/webkit-meta.yml"
- ".github/workflows/winget.yml"
- ".goreleaser.yml"
- "config.example.yml"
pull_request:
branches:
- master
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
# download:
# runs-on: macos-13
# steps:
# - name: Cache beta IPSW
# id: cache-beta-ipsw
# uses: actions/cache@v4
# with:
# path: |
# ~/beta
# key: beta-ipsw
# - name: Download beta IPSW
# if: steps.cache-beta-ipsw.outputs.cache-hit != 'true'
# run: |
# mkdir ~/beta
# wget -O ~/beta/beta.ipsw https://archive.org/download/iPhone142_16.0_20A5283p_Restore.ipsw/iPhone142_16.0_20A5283p_Restore.ipsw
# - name: Upload beta IPSW
# uses: actions/upload-artifact@v3
# with:
# name: beta-ipsw
# path: ~/beta/beta.ipsw
build:
strategy:
matrix:
platform: [ubuntu-latest, macos-13, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "stable"
#
# CACHE
#
# - name: Cache beta IPSW
# id: cache-beta-ipsw
# if: matrix.platform == 'macos-13'
# uses: actions/cache@v4
# with:
# path: |
# ~/beta
# key: beta-ipsw
# - name: Download beta IPSW from Artifacts
# if: matrix.platform == 'macos-13' && steps.cache-beta-ipsw.outputs.cache-hit != 'true'
# uses: actions/download-artifact@v3
# with:
# name: beta-ipsw
# path: ~/beta/beta.ipsw
# - name: Cache Downloaded IPSWs
# id: cache-ipsws
# if: matrix.platform == 'macos-13'
# uses: actions/cache@v2
# with:
# path: /tmp/ipsw
# key: ${{ runner.os }}-${{ hashFiles('**/*.ipsw') }}
- name: Cache go.mod (macOS)
if: matrix.platform == 'macos-13'
uses: actions/cache@v4
with:
path: |
~/Library/Caches/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache go.mod (Linux)
if: matrix.platform == 'ubuntu-latest'
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache go.mod (Windows)
if: matrix.platform == 'windows-latest'
uses: actions/cache@v4
with:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
#
# Dependencies
#
- name: Get dependencies
run: |
go mod download
- name: Build Dependencies (Linux)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get -yq install fuse3 libfuse3-dev bzip2 libbz2-dev cmake libattr1-dev zlib1g-dev
git clone https://github.com/sgan81/apfs-fuse.git
cd apfs-fuse
git submodule init
git submodule update
mkdir build
cd build
cmake ..
sudo make install
- name: Build Dependencies (macOS)
if: matrix.platform == 'macos-13'
run: |
brew install tree
- name: Build Dependencies (Windows)
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
iwr get.scoop.sh -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
#
# BUILD
#
- name: Build (Linux)
if: matrix.platform == 'ubuntu-latest'
run: |
CGO_ENABLED=1 go build -o /usr/local/bin/ipsw -ldflags "-s -w -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppVersion="v1.0.0" -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppBuildCommit=${{ github.event.pull_request.head.sha || github.sha }}" ./cmd/ipsw
- name: Build (macOS)
if: matrix.platform == 'macos-13'
run: |
env | grep PATH
sudo CGO_ENABLED=1 go build -o /usr/local/sbin/ipsw -ldflags "-s -w -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppVersion="v1.0.0" -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppBuildCommit=${{ github.event.pull_request.head.sha || github.sha }}" ./cmd/ipsw
- name: Build (Windows)
if: matrix.platform == 'windows-latest'
env:
CGO_LDFLAGS: -LD:\a\ipsw\ipsw\lzfse\build\Debug
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
run: |
go build -o build/dist/ipsw.exe -ldflags "-linkmode external -extldflags -static" ./cmd/ipsw
dir build/dist
dir
#
# (SETUP)
#
- name: Get Latest Version
id: get-latest
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-13'
run: |
echo "latest_ios_version=$(ipsw download ipsw --show-latest-version --insecure)" >> $GITHUB_ENV
echo "latest_ios_build=$(ipsw download ipsw --show-latest-build --device iPhone16,2 --insecure)" >> $GITHUB_ENV
echo "beta_ios_version=$(ipsw download ota --platform ios --beta --show-latest-version --device iPhone16,2 --insecure)" >> $GITHUB_ENV
echo "beta_ios_build=$(ipsw download ota --platform ios --beta --show-latest-build --device iPhone16,2 --insecure)" >> $GITHUB_ENV
echo "latest_macos_version=$(ipsw download ipsw --show-latest-version --macos --insecure)" >> $GITHUB_ENV
echo "latest_macos_build=$(ipsw download ipsw --show-latest-build --macos --device Mac14,7 --insecure)" >> $GITHUB_ENV
echo "beta_macos_version=$(ipsw download ota --platform macos --beta --show-latest-version --device Mac14,7 --insecure)" >> $GITHUB_ENV
echo "beta_macos_build=$(ipsw download ota --platform macos --beta --show-latest-build --device Mac14,7 --insecure)" >> $GITHUB_ENV
echo "macos_runner_version=$(sw_vers -productVersion)" >> $GITHUB_ENV
echo "macos_runner_build=$(sw_vers -buildVersion)" >> $GITHUB_ENV
- name: Make cache folders
if: matrix.platform == 'macos-13'
run: |
mkdir -p /tmp/ipsw
mkdir -p /tmp/ipsw-beta
ls -lah /tmp
#
# DEVICE LIST
#
- name: Run Device List
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-13'
run: ipsw device-list
- name: Run Device List (Windows)
if: matrix.platform == 'windows-latest'
run: D:\a\ipsw\ipsw\build\dist\ipsw.exe device-list
#
# DOWNLOAD CMD (macOS)
#
- name: Run download latest (IPSW)
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-13') && steps.cache-ipsws.outputs.cache-hit != 'true'
run: |
ipsw -V download ipsw --confirm --device iPhone16,1 --latest --output /tmp/ipsw && ls -lah && ls -lah /tmp && ls -lah /tmp/ipsw
- name: Run download latest (kernelcache)
if: matrix.platform == 'macos-13'
run: |
ipsw download ipsw --confirm --device iPhone16,1 --latest --kernel
ipsw -V macho info ./*__iPhone16,1/kernelcache*
- name: Run download latest (kernelcache) [Windows]
if: matrix.platform == 'windows-latest'
run: |
D:\a\ipsw\ipsw\build\dist\ipsw.exe -V download ipsw --confirm --device iPhone16,1 --latest --kernel
dir
- name: Run download latest (PATTERN/iBoot)
if: matrix.platform == 'macos-13' && steps.cache-ipsws.outputs.cache-hit != 'true'
working-directory: /tmp/ipsw
run: ipsw download ipsw --confirm --device iPhone16,1 --latest --pattern iBoot
- name: Run download tss
if: matrix.platform == 'macos-13' && steps.cache-ipsws.outputs.cache-hit != 'true'
working-directory: /tmp/ipsw
run: ipsw download tss --signed "${{ env.latest_ios_version }}"
- name: Run download rss
if: matrix.platform == 'macos-13' && steps.cache-ipsws.outputs.cache-hit != 'true'
working-directory: /tmp/ipsw
run: ipsw download rss
- name: Run download iOS beta OTA (kernelcache and DSC)
if: matrix.platform == 'macos-13' && steps.cache-ipsws.outputs.cache-hit != 'true'
working-directory: /tmp/ipsw-beta
run: ipsw download ota --platform ios --device iPhone16,2 --beta --kernel --dyld
- name: Run download macOS beta OTA (kernelcache and DSC)
if: matrix.platform == 'macos-13' && steps.cache-ipsws.outputs.cache-hit != 'true'
working-directory: /tmp/ipsw-beta
run: ipsw download ota --platform macos --device Mac14,7 --beta --kernel --dyld --dyld-arch arm64e --version 14.5
#
# INFO CMD (macOS)
#
- name: Run info
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw info *.ipsw
#
# EXTRACT CMD (macOS)
#
- name: Run extract - (kernel, dsc and dtree)
if: matrix.platform == 'macos-13'
# if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-13'
run: |
ipsw extract --kernel --dyld --dtree --iboot --sep /tmp/ipsw/*.ipsw --output /tmp/ipsw
ipsw extract --pattern 'apsd$' --files /tmp/ipsw/*.ipsw --output /tmp/ipsw
#
# MDEVs CMD (macOS)
#
- name: Run mdevs
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw mdevs *.ipsw
#
# Mount CMD (macOS)
#
- name: Run mount
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw mount fs -V *.ipsw & # mount in background
#
# KERNEL CMD (macOS)
#
- name: Run kernel version
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw kernel version ./*__iPhone16,1/kernelcache.release.* --json | jq .
- name: Run kernel symbolsets
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw kernel symbolsets ./*__iPhone16,1/kernelcache.release.*
- name: Run kernel syscall
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw kernel syscall ./*__iPhone16,1/kernelcache.release.*
- name: Run kernel kexts
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw kernel kexts ./*__iPhone16,1/kernelcache.release.*
# - name: Run kernel sbopts
# if: matrix.platform == 'macos-13'
# working-directory: /tmp/ipsw
# run: ipsw kernel sbopts ./*__iPhone16,1/kernelcache.release.*
- name: Run kernel extract (KEXTs)
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ipsw kernel extract ./*__iPhone16,1/kernelcache.release.* --all --output /tmp/KEXTS
cd /tmp/KEXTS && ls -1 | xargs codesign -s - -f
#
# DYLD CMD (macOS)
#
- name: Run dyld info
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld info ./*__iPhone16,1/dyld_shared_cache_arm64e --dylibs --sig -V
- name: Run dyld symaddr (img)
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld symaddr ./*__iPhone16,1/dyld_shared_cache_arm64e --image libsystem_c.dylib
- name: Run dyld symaddr (sym)
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld symaddr ./*__iPhone16,1/dyld_shared_cache_arm64e _memcpy
- name: Run dyld symaddr (img+sym)
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld symaddr ./*__iPhone16,1/dyld_shared_cache_arm64e --image libsystem_c.dylib _memcpy
- name: Run dyld symaddr (JSON)
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
echo '[{"pattern":".*zero.*", "image":"libsystem_c.dylib"}]' > dyld_symaddr.json
ipsw dyld symaddr ./*__iPhone16,1/dyld_shared_cache_arm64e --in dyld_symaddr.json
# - name: Run dyld symaddr (ALL)
# if: matrix.platform == 'macos-13'
# run: |
# ipsw dyld symaddr ./*__iPhone16,1/dyld_shared_cache_arm64e | grep _memcpy
- name: Run dyld macho
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld macho ./*__iPhone16,1/dyld_shared_cache_arm64e JavaScriptCore --loads --objc --objc-refs --strings --symbols --starts --stubs -V
- name: Run dyld macho (extract)
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld macho ./*__iPhone16,1/dyld_shared_cache_arm64e JavaScriptCore --extract
- name: Run dyld webkit
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld webkit ./*__iPhone16,1/dyld_shared_cache_arm64e
- name: Run dyld slide
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld slide ./*__iPhone16,1/dyld_shared_cache_arm64e --auth
- name: Run dyld patches
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld patches ./*__iPhone16,1/dyld_shared_cache_arm64e
- name: Run dyld imports
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld imports ./*__iPhone16,1/dyld_shared_cache_arm64e JavaScriptCore
- name: Run dyld disass
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld disass ./*__iPhone16,1/dyld_shared_cache_arm64e --demangle --symbol _NSLog
- name: Run dyld objc sel --image
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld objc sel ./*__iPhone16,1/dyld_shared_cache_arm64e --image JavaScriptCore
- name: Run dyld objc --class
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld objc --class ./*__iPhone16,1/dyld_shared_cache_arm64e
- name: Run dyld objc --proto
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld objc --proto ./*__iPhone16,1/dyld_shared_cache_arm64e
# - name: Run dyld objc --imp-cache
# if: matrix.platform == 'macos-13'
# run: |
# ipsw dyld objc --imp-cache ./*__iPhone16,1/dyld_shared_cache_arm64e
- name: Run dyld split (Xcode)
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ipsw dyld split --xcode /Applications/Xcode_14.1.app ./*__iPhone16,1/dyld_shared_cache_arm64e --output /tmp/ipsw
tree /tmp/ipsw
- name: Run dyld swfit
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw dyld swift ./*__iPhone16,1/dyld_shared_cache_arm64e --types --demangle
- name: Run dyld str
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ipsw dyld str ./*__iPhone16,1/dyld_shared_cache_arm64e --pattern "LDMGlobalEnabled"
# ipsw dyld str "${{ env.beta_ios_build }}__iPhone16,2"/dyld_shared_cache_arm64e --pattern "LDMGlobalEnabled"
- name: Run dyld image
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ipsw dyld image ./*__iPhone16,1/dyld_shared_cache_arm64e
# ipsw dyld image "${{ env.beta_ios_build }}__iPhone16,2"/dyld_shared_cache_arm64e
#
# MACHO CMD (macOS)
#
- name: Run macho info
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw macho info ./System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore --ent --header --loads --starts --strings --symbols
- name: Run macho info (ObjC)
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ls /tmp/*.mount
ipsw macho info ./*__iPhone16,1/System/Library/PrivateFrameworks/ApplePushService.framework/apsd --objc --objc-refs --fixups
- name: Run macho info (Dump Cert)
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ipsw macho info /bin/ls --arch x86_64 --dump-cert --output /tmp
openssl crl2pkcs7 -nocrl -certfile /tmp/ls.pem | openssl pkcs7 -print_certs -text
- name: Run macho disass
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw macho disass ./System/Library/Frameworks/Foundation.framework/Foundation --symbol _NSLog --force
- name: Run macho disass (MTE)
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: ipsw macho disass ./*__iPhone16,1/kernelcache.release.* --all-fileset-entries --quiet --section __TEXT_EXEC.__text | grep 'addg\|cmpp\|gmi\|irg\|ldg\|ldgv\|st2g\|stg\|stgp\|stgv\|stz2g\|stzg\|subg\|subp\|subps'
- name: Run macho lipo
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ipsw macho lipo /bin/ls --output /tmp --arch x86_64
ipsw macho lipo /bin/ls --output /tmp --arch arm64e
- name: Run macho bbl
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ipsw macho bbl --output /tmp/ls.bbl /tmp/ls.x86_64 /tmp/ls.arm64e
diff /bin/ls /tmp/ls.bbl
- name: Run macho patch
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ipsw macho patch mod /tmp/ls.arm64e LC_BUILD_VERSION iOS 16.3 16.3 ld 820.1
ipsw macho patch add /tmp/ls.arm64e LC_RPATH @executable_path/Frameworks --overwrite
- name: Run macho sign
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ipsw macho sign -V --ad-hoc --overwrite /tmp/ls.arm64e
#
# ENT CMD (macOS)
#
# - name: Run ents
# if: matrix.platform == 'macos-13'
# working-directory: /tmp/ipsw
# run: ipsw ent *.ipsw --ent platform-application
#
# UPDATE CMD (macOS)
#
- name: Run ipsw update
if: matrix.platform == 'macos-13'
working-directory: /tmp/ipsw
run: |
ipsw update --platform windows_x86_64 -V --api ${{ secrets.GITHUB_TOKEN }}
ipsw update --detect --api ${{ secrets.GITHUB_TOKEN }}
#
# Package Installers
#
# - name: Package Installers (Windows) FIXME: https://github.com/goreleaser/goreleaser/issues/3941
# if: matrix.platform == 'windows-latest'
# run: |
# scoop bucket add blacktop https://github.com/blacktop/scoop-bucket.git
# scoop install blacktop/ipsw
# ipsw --help
- name: Package Installers (Linux)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo snap install ipsw
ipsw --help
- name: Package Installers (macOS)
if: matrix.platform == 'macos-13'
run: |
brew install blacktop/tap/ipsw
ipsw --help
# - uses: actions/upload-artifact@v3
# with:
# name: Releases
# path: build/dist/