mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-23 18:49:48 +02:00
Compare commits
39
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
388ae6f296 | ||
|
|
24a09bc44d | ||
|
|
5ea3237772 | ||
|
|
9c094fc19f | ||
|
|
2912dfd8c0 | ||
|
|
a3fa59eaa8 | ||
|
|
290bcb143e | ||
|
|
bb9fdde26e | ||
|
|
a9e72b579e | ||
|
|
fe565b97ad | ||
|
|
1422d45a9f | ||
|
|
869f0fc070 | ||
|
|
cc1a865a86 | ||
|
|
5ce2196268 | ||
|
|
fe50b7c966 | ||
|
|
e02d977c5d | ||
|
|
d82965f140 | ||
|
|
2623569d67 | ||
|
|
2637758372 | ||
|
|
87a2f6b60b | ||
|
|
5e1291d7c4 | ||
|
|
1214aed3a7 | ||
|
|
e96cd19295 | ||
|
|
f37643b93e | ||
|
|
2a9f65c870 | ||
|
|
11b594bec6 | ||
|
|
047b334752 | ||
|
|
c2bb49287a | ||
|
|
2d932dd26b | ||
|
|
03e6739bc9 | ||
|
|
b360e8dd02 | ||
|
|
d72e95fccc | ||
|
|
60f241e0db | ||
|
|
9a7d6151ae | ||
|
|
ac34d4d2be | ||
|
|
8cae820cb8 | ||
|
|
b89fd2b915 | ||
|
|
4070ed9da9 | ||
|
|
6c7f666bb3 |
No files matched your search
@@ -11,6 +11,14 @@ on:
|
|||||||
- 'CMakeLists.txt'
|
- 'CMakeLists.txt'
|
||||||
- '.github/workflows/build.yml'
|
- '.github/workflows/build.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- 'docs/**'
|
||||||
|
- 'patches/**'
|
||||||
|
- 'include/**'
|
||||||
|
- 'Makefile'
|
||||||
|
- 'CMakeLists.txt'
|
||||||
|
- '.github/workflows/build.yml'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -120,7 +128,7 @@ jobs:
|
|||||||
echo "CC=$(xcrun --find cc)" >> $GITHUB_ENV
|
echo "CC=$(xcrun --find cc)" >> $GITHUB_ENV
|
||||||
echo "CXX=$(xcrun --find c++)" >> $GITHUB_ENV
|
echo "CXX=$(xcrun --find c++)" >> $GITHUB_ENV
|
||||||
echo "CPP=$(xcrun --find cc) -E" >> $GITHUB_ENV
|
echo "CPP=$(xcrun --find cc) -E" >> $GITHUB_ENV
|
||||||
echo "CFLAGS=-g -Os -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isysroot ${{ env.SDK }} -isystem $(pwd)/sysroot/usr/local/include -Os" >> $GITHUB_ENV
|
echo "CFLAGS=-g -Os -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isysroot ${{ env.SDK }} -isystem $(pwd)/sysroot/usr/local/include -Os -g -flto=full -Wl,-object_path_lto,lto.o" >> $GITHUB_ENV
|
||||||
echo "CPPFLAGS=-g -Os -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isysroot ${{ env.SDK }} -isystem $(pwd)/sysroot/usr/local/include -Wno-error-implicit-function-declaration -Os" >> $GITHUB_ENV
|
echo "CPPFLAGS=-g -Os -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isysroot ${{ env.SDK }} -isystem $(pwd)/sysroot/usr/local/include -Wno-error-implicit-function-declaration -Os" >> $GITHUB_ENV
|
||||||
echo "CXXFLAGS=-stdlib=libc++ -g -Os -isysroot ${{ env.SDK }} -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isystem $(pwd)/sysroot/usr/local/include -Os" >> $GITHUB_ENV
|
echo "CXXFLAGS=-stdlib=libc++ -g -Os -isysroot ${{ env.SDK }} -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isystem $(pwd)/sysroot/usr/local/include -Os" >> $GITHUB_ENV
|
||||||
echo "LDFLAGS=-g -Wl,-dead_strip -arch ${{ matrix.arch }} -isysroot ${{ env.SDK }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -L$(pwd)/sysroot/usr/local/lib" >> $GITHUB_ENV
|
echo "LDFLAGS=-g -Wl,-dead_strip -arch ${{ matrix.arch }} -isysroot ${{ env.SDK }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -L$(pwd)/sysroot/usr/local/lib" >> $GITHUB_ENV
|
||||||
@@ -384,7 +392,7 @@ jobs:
|
|||||||
- name: Build debs
|
- name: Build debs
|
||||||
run: |
|
run: |
|
||||||
make -j$(sysctl -n hw.ncpu) docs
|
make -j$(sysctl -n hw.ncpu) docs
|
||||||
version=$(git describe --dirty --tags --abbrev=7 | sed 's|^v||')
|
version=$(git describe --dirty --tags --abbrev=7 | sed 's|^v||' | sed 's|-beta|~beta|')
|
||||||
|
|
||||||
# Darwin x86_64
|
# Darwin x86_64
|
||||||
mkdir -p stage/DEBIAN
|
mkdir -p stage/DEBIAN
|
||||||
@@ -399,7 +407,7 @@ jobs:
|
|||||||
ginstall -Dm644 docs/palera1n.1 stage/opt/procursus/usr/share/man/man1/palera1n.1
|
ginstall -Dm644 docs/palera1n.1 stage/opt/procursus/usr/share/man/man1/palera1n.1
|
||||||
chmod +x stage/opt/procursus/bin/palera1n
|
chmod +x stage/opt/procursus/bin/palera1n
|
||||||
|
|
||||||
dpkg-deb -b stage palera1n_darwin-amd64.deb
|
dpkg-deb -Zzstd -b stage palera1n_darwin-amd64.deb
|
||||||
mv palera1n*.deb ready/
|
mv palera1n*.deb ready/
|
||||||
rm -rf stage
|
rm -rf stage
|
||||||
|
|
||||||
@@ -416,7 +424,7 @@ jobs:
|
|||||||
ginstall -Dm644 docs/palera1n.1 stage/opt/procursus/usr/share/man/man1/palera1n.1
|
ginstall -Dm644 docs/palera1n.1 stage/opt/procursus/usr/share/man/man1/palera1n.1
|
||||||
chmod +x stage/opt/procursus/bin/palera1n
|
chmod +x stage/opt/procursus/bin/palera1n
|
||||||
|
|
||||||
dpkg-deb -b stage palera1n_darwin-arm64.deb
|
dpkg-deb -Zzstd -b stage palera1n_darwin-arm64.deb
|
||||||
mv palera1n*.deb ready/
|
mv palera1n*.deb ready/
|
||||||
rm -rf stage
|
rm -rf stage
|
||||||
|
|
||||||
@@ -429,11 +437,11 @@ jobs:
|
|||||||
gsed 's|@DEB_ARCH@|iphoneos-arm|g' -i stage/DEBIAN/control
|
gsed 's|@DEB_ARCH@|iphoneos-arm|g' -i stage/DEBIAN/control
|
||||||
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||||
|
|
||||||
ginstall -Dm644 ready/palera1n-macos-arm64 stage/usr/bin/palera1n
|
ginstall -Dm644 ready/palera1n-ios stage/usr/bin/palera1n
|
||||||
ginstall -Dm644 docs/palera1n.1 stage/usr/share/man/man1/palera1n.1
|
ginstall -Dm644 docs/palera1n.1 stage/usr/share/man/man1/palera1n.1
|
||||||
chmod +x stage/usr/bin/palera1n
|
chmod +x stage/usr/bin/palera1n
|
||||||
|
|
||||||
dpkg-deb -b stage palera1n_iphoneos-arm.deb
|
dpkg-deb -Zzstd -b stage palera1n_iphoneos-arm.deb
|
||||||
mv palera1n*.deb ready/
|
mv palera1n*.deb ready/
|
||||||
rm -rf stage
|
rm -rf stage
|
||||||
|
|
||||||
@@ -446,11 +454,11 @@ jobs:
|
|||||||
gsed 's|@DEB_ARCH@|iphoneos-arm64|g' -i stage/DEBIAN/control
|
gsed 's|@DEB_ARCH@|iphoneos-arm64|g' -i stage/DEBIAN/control
|
||||||
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||||
|
|
||||||
ginstall -Dm644 ready/palera1n-macos-arm64 stage/var/jb/usr/bin/palera1n
|
ginstall -Dm644 ready/palera1n-ios stage/var/jb/usr/bin/palera1n
|
||||||
ginstall -Dm644 docs/palera1n.1 stage/var/jb/usr/share/man/man1/palera1n.1
|
ginstall -Dm644 docs/palera1n.1 stage/var/jb/usr/share/man/man1/palera1n.1
|
||||||
chmod +x stage/var/jb/usr/bin/palera1n
|
chmod +x stage/var/jb/usr/bin/palera1n
|
||||||
|
|
||||||
dpkg-deb -b stage palera1n_iphoneos-arm64.deb
|
dpkg-deb -Zzstd -b stage palera1n_iphoneos-arm64.deb
|
||||||
mv palera1n*.deb ready/
|
mv palera1n*.deb ready/
|
||||||
rm -rf stage
|
rm -rf stage
|
||||||
|
|
||||||
@@ -744,7 +752,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build debs
|
- name: Build debs
|
||||||
run: |
|
run: |
|
||||||
version=$(git describe --dirty --tags --abbrev=7 | sed 's|^v||')
|
version=$(git describe --dirty --tags --abbrev=7 | sed 's|^v||' | sed 's|-beta|~beta|')
|
||||||
|
|
||||||
make -j$(nproc) docs
|
make -j$(nproc) docs
|
||||||
mkdir -p stage/DEBIAN
|
mkdir -p stage/DEBIAN
|
||||||
|
|||||||
@@ -22,3 +22,4 @@ src/*.dmg.c
|
|||||||
.idea
|
.idea
|
||||||
src/stage2/
|
src/stage2/
|
||||||
src/libcheckra1nhelper.dylib*
|
src/libcheckra1nhelper.dylib*
|
||||||
|
src/Pongo.bin
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
NAME = Tumbleweed
|
NAME = bakepale
|
||||||
|
|
||||||
SRC = $(shell pwd)
|
SRC = $(shell pwd)
|
||||||
DEP = $(SRC)/dep_root
|
DEP = $(SRC)/dep_root
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
CC ?= cc
|
CC ?= cc
|
||||||
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC)
|
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC)
|
||||||
CFLAGS += -Wall -Wextra -DPALERAIN_VERSION=\"2.0.0\" -Wall -Wextra -Wno-unused-parameter
|
CFLAGS += -Wall -Wextra -Wno-unused-parameter -DPALERAIN_VERSION=\"2.0.0\"
|
||||||
CFLAGS += -Wno-unused-variable -I$(SRC)/src -std=c99 -pedantic-errors -D_C99_SOURCE -D_POSIX_C_SOURCE=200112L -D_DARWIN_C_SOURCE
|
CFLAGS += -Wno-unused-variable -I$(SRC)/src -std=c99 -pedantic-errors -D_C99_SOURCE -D_POSIX_C_SOURCE=200112L
|
||||||
LIBS += $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a
|
LIBS += $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a
|
||||||
LIBS += $(DEP)/lib/libimobiledevice-glue-1.0.a $(DEP)/lib/libplist-2.0.a -pthread
|
LIBS += $(DEP)/lib/libimobiledevice-glue-1.0.a $(DEP)/lib/libplist-2.0.a -pthread
|
||||||
ifeq ($(TARGET_OS),)
|
ifeq ($(TARGET_OS),)
|
||||||
@@ -25,11 +25,13 @@ LDFLAGS += -static -no-pie -Wl,--gc-sections
|
|||||||
endif
|
endif
|
||||||
LIBS += $(DEP)/lib/libmbedtls.a $(DEP)/lib/libmbedcrypto.a $(DEP)/lib/libmbedx509.a $(DEP)/lib/libreadline.a
|
LIBS += $(DEP)/lib/libmbedtls.a $(DEP)/lib/libmbedcrypto.a $(DEP)/lib/libmbedx509.a $(DEP)/lib/libreadline.a
|
||||||
|
|
||||||
ifeq ($(DEV_BUILD),1)
|
ifeq ($(TUI),1)
|
||||||
LIBS += $(DEP)/lib/libnewt.a $(DEP)/lib/libpopt.a $(DEP)/lib/libslang.a
|
LIBS += $(DEP)/lib/libnewt.a $(DEP)/lib/libpopt.a $(DEP)/lib/libslang.a
|
||||||
ifeq ($(TARGET_OS),Linux)
|
ifeq ($(TARGET_OS),Linux)
|
||||||
LIBS += $(DEP)/lib/libgpm.a
|
LIBS += $(DEP)/lib/libgpm.a
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(DEV_BUILD),1)
|
||||||
CFLAGS += -O0 -g -DDEV_BUILD -fno-omit-frame-pointer
|
CFLAGS += -O0 -g -DDEV_BUILD -fno-omit-frame-pointer
|
||||||
ifeq ($(ASAN),1)
|
ifeq ($(ASAN),1)
|
||||||
BUILD_STYLE=ASAN
|
BUILD_STYLE=ASAN
|
||||||
@@ -74,13 +76,13 @@ clean:
|
|||||||
$(MAKE) -C docs clean
|
$(MAKE) -C docs clean
|
||||||
|
|
||||||
download-deps:
|
download-deps:
|
||||||
$(MAKE) -C src checkra1n-macos checkra1n-linux-arm64 checkra1n-linux-armel checkra1n-linux-x86 checkra1n-linux-x86_64 checkra1n-kpf-pongo ramdisk.dmg binpack.dmg
|
$(MAKE) -C src checkra1n-macos checkra1n-linux-arm64 checkra1n-linux-armel checkra1n-linux-x86 checkra1n-linux-x86_64 checkra1n-kpf-pongo ramdisk.dmg binpack.dmg Pongo.bin
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
$(MAKE) -C docs
|
$(MAKE) -C docs
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -rf palera1n-* palera1n*.dSYM src/checkra1n-* src/checkra1n-kpf-pongo src/ramdisk.dmg src/binpack.dmg
|
rm -rf palera1n-* palera1n*.dSYM src/checkra1n-* src/checkra1n-kpf-pongo src/ramdisk.dmg src/binpack.dmg src/Pongo.bin
|
||||||
|
|
||||||
.PHONY: all palera1n clean docs distclean
|
.PHONY: all palera1n clean docs distclean
|
||||||
|
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
<img align="left" height="120" src="https://cdn.discordapp.com/attachments/1017854329887129611/1073858292159352862/thing.png" alt="palera1n logo" style="float: left;"/>
|
<picture>
|
||||||
<h3 align="right">An iOS 15.0-16.3.1 work-in-progress, <br>semi-tethered checkm8 jailbreak</h3>
|
<source media="(prefers-color-scheme: light)" srcset="https://cdn.discordapp.com/attachments/1028398976640229380/1088049124441604136/IMG_0033.png">
|
||||||
|
<img align="left" height="120" src="https://cdn.discordapp.com/attachments/1017854329887129611/1073858292159352862/thing.png" alt="palera1n logo" style="float: left;"/>
|
||||||
|
</picture>
|
||||||
|
<h3 align="right">An iOS 15.0-16.4.1 work-in-progress, <br>semi-tethered checkm8 jailbreak</h3>
|
||||||
|
|
||||||
<p align="right" >
|
<p align="right" >
|
||||||
<strong><a href="https://cdn.nickchan.lol/palera1n/c-rewrite/releases/v2.0.0-beta.4/palera1n.1.html">Usage</a></strong>
|
<strong><a href="https://cdn.nickchan.lol/palera1n/c-rewrite/releases/v2.0.0-beta.4/palera1n.1.html">Usage</a></strong>
|
||||||
@@ -12,6 +15,8 @@
|
|||||||
</p>
|
</p>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
||||||
|
## If you want a jailbreak, you should read the [guide](https://palera.in).
|
||||||
|
|
||||||
### You can obtain v2.0.0 beta [here](https://github.com/palera1n/palera1n/releases).
|
### You can obtain v2.0.0 beta [here](https://github.com/palera1n/palera1n/releases).
|
||||||
If you need an older v2.0.0 beta, please get it [here](https://github.com/palera1n/palera1n-c/releases/tag/v2.0.0-beta.4).
|
If you need an older v2.0.0 beta, please get it [here](https://github.com/palera1n/palera1n-c/releases/tag/v2.0.0-beta.4).
|
||||||
|
|
||||||
@@ -36,6 +41,10 @@ If you need an older v2.0.0 beta, please get it [here](https://github.com/palera
|
|||||||
- A Linux or macOS computer
|
- A Linux or macOS computer
|
||||||
- AMD CPUs (not AMD Mobile) have an issue [with (likely) their USB controllers] that causes them to have a very low success rate with checkm8. It is not recommended that you use them with palera1n.
|
- AMD CPUs (not AMD Mobile) have an issue [with (likely) their USB controllers] that causes them to have a very low success rate with checkm8. It is not recommended that you use them with palera1n.
|
||||||
- If your device does not successfully jailbreak, try a computer with an Intel or other CPU
|
- If your device does not successfully jailbreak, try a computer with an Intel or other CPU
|
||||||
|
|
||||||
|
- Apple Silicon Macs with USB-C
|
||||||
|
- USB-C port on Apple Silicon Macs may require manual unplugging and replugging of the lightning cable after checkm8 exploit.
|
||||||
|
- This problem may be solved by connecting via USBHub.
|
||||||
|
|
||||||
# Need help?
|
# Need help?
|
||||||
|
|
||||||
@@ -47,7 +56,7 @@ Make sure you provide full details on your device, such as:
|
|||||||
|
|
||||||
Using `-V` and `-v` would help with debugging.
|
Using `-V` and `-v` would help with debugging.
|
||||||
|
|
||||||
Join the [Support Discord](https://dsc.gg/palera1n), and find the palera1n-c thread under #jailbreak [here](https://discord.com/channels/1028398973452570725/1074251283143344180).
|
Join the [Support Discord](https://dsc.gg/palera1n), and create a thread in [#support](https://discord.com/channels/1028398973452570725/1028730487700738130) or ask in [#general](https://discord.com/channels/1028398973452570725/1028398976640229380).
|
||||||
|
|
||||||
# Credits
|
# Credits
|
||||||
<details><summary>palera1n-c Contributors and Credits</summary>
|
<details><summary>palera1n-c Contributors and Credits</summary>
|
||||||
@@ -81,5 +90,6 @@ Thank you so much to our Patreons that make the future development possible! You
|
|||||||
<a href="https://github.com/beast9265"><img width=64 style="border-radius: 25%;" src="https://avatars.githubusercontent.com/u/79794946?v=4"></img></a>
|
<a href="https://github.com/beast9265"><img width=64 style="border-radius: 25%;" src="https://avatars.githubusercontent.com/u/79794946?v=4"></img></a>
|
||||||
<a href="https://twitter.com/0x7FF7"><img width=64 style="border-radius: 25%;" src="https://pbs.twimg.com/profile_images/1630818481191919618/8MWaJ1F7_400x400.jpg"></img></a>
|
<a href="https://twitter.com/0x7FF7"><img width=64 style="border-radius: 25%;" src="https://pbs.twimg.com/profile_images/1630818481191919618/8MWaJ1F7_400x400.jpg"></img></a>
|
||||||
<a href="https://sideloadly.io/"><img width=64 style="border-radius: 25%;" src="https://sideloadly.io/icon.png"></img></a>
|
<a href="https://sideloadly.io/"><img width=64 style="border-radius: 25%;" src="https://sideloadly.io/icon.png"></img></a>
|
||||||
<a href="https://blog.stevesec.com/"><img width=64 style="border-radius: 25%;" src="https://blog.stevesec.com/img/avatar.jpg"></img></a>
|
<a href="https://blog.stevesec.com/"><img width=64 style="border-radius: 25%;" src="https://blog.stevesec.com/img/avatar.jpg"></img>
|
||||||
|
<a href="https://github.com/0xilis/"><img width=64 style="border-radius: 25%;" src="https://github.com/0xilis.png"></img></a>
|
||||||
</p>
|
</p>
|
||||||
+7
-6
@@ -6,7 +6,7 @@
|
|||||||
.Dt palera1n 1
|
.Dt palera1n 1
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm palera1n
|
.Nm palera1n
|
||||||
.Nd iOS 15.0-16.3.1 arm64 iOS/iPadOS jailbreaking tool
|
.Nd iOS 15.0-16.4.1 arm64 iOS/iPadOS jailbreaking tool
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl cCdDEfhIlLnpRsSvV
|
.Op Fl cCdDEfhIlLnpRsSvV
|
||||||
@@ -16,9 +16,11 @@
|
|||||||
.Op Fl r Ar ramdisk file
|
.Op Fl r Ar ramdisk file
|
||||||
.Op Fl K Ar KPF file
|
.Op Fl K Ar KPF file
|
||||||
.Op Fl i Ar checkra1n file
|
.Op Fl i Ar checkra1n file
|
||||||
|
.Op Fl -version
|
||||||
|
.Op Fl -force-revert
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
jailbreaks any iOS/iPadOS device with an arm64 (arm64e excluded) on iOS 15.0-16.3.1,
|
jailbreaks any iOS/iPadOS device with an arm64 (arm64e excluded) on iOS 15.0-16.4.1,
|
||||||
utilizing the
|
utilizing the
|
||||||
.Em checkm8
|
.Em checkm8
|
||||||
bootROM exploit.
|
bootROM exploit.
|
||||||
@@ -50,7 +52,7 @@ In the remainder of this document, the term "iOS" and "iPadOS" will be used inte
|
|||||||
as the difference is negligible as far as the jailbreak is concerened.
|
as the difference is negligible as far as the jailbreak is concerened.
|
||||||
.Pp
|
.Pp
|
||||||
.Sh SUPPORTED DEVICES
|
.Sh SUPPORTED DEVICES
|
||||||
As described above, arm64 iOS 15.0-16.3.1 devices are supported, here is an explicit
|
As described above, arm64 iOS 15.0-16.4.1 devices are supported, here is an explicit
|
||||||
list of supported devicecs:
|
list of supported devicecs:
|
||||||
|
|
||||||
.Bl -tag -compact
|
.Bl -tag -compact
|
||||||
@@ -141,7 +143,7 @@ Override the kernel patchfinder PongoOS module. The module is required to suppor
|
|||||||
root filesystem in paleinfo with
|
root filesystem in paleinfo with
|
||||||
.Em rootfs
|
.Em rootfs
|
||||||
command. If in doubt, use
|
command. If in doubt, use
|
||||||
.Sy https://github.com/guacaplushy/PongoOS
|
.Sy https://github.com/palera1n/PongoOS
|
||||||
iOS15 branch or your own fork of it.
|
iOS15 branch or your own fork of it.
|
||||||
.It Fl l , -rootless
|
.It Fl l , -rootless
|
||||||
Proceed in rootless mode, this is the default when neither
|
Proceed in rootless mode, this is the default when neither
|
||||||
@@ -309,8 +311,7 @@ may crash if the machine it is running on:
|
|||||||
.Pp
|
.Pp
|
||||||
The exploit may also work less reliably on some hosts, like AMD desktops, or some MediaTek devices.
|
The exploit may also work less reliably on some hosts, like AMD desktops, or some MediaTek devices.
|
||||||
.Pp
|
.Pp
|
||||||
.Fl B , -setup-fakefs-partial
|
The device may randomly crash and reboot due to launchd exiting with code 7.
|
||||||
does not work on iOS 16.
|
|
||||||
.Sh NOTES
|
.Sh NOTES
|
||||||
.Nm
|
.Nm
|
||||||
injects a dylib into launchd to allow the
|
injects a dylib into launchd to allow the
|
||||||
|
|||||||
+3
-12
@@ -60,6 +60,7 @@
|
|||||||
#define palerain_option_setup_rootful_forced (1 << 3) /* create fakefs over an existing one */
|
#define palerain_option_setup_rootful_forced (1 << 3) /* create fakefs over an existing one */
|
||||||
#define palerain_option_setup_partial_root (1 << 4) /* fakefs creating should be partial */
|
#define palerain_option_setup_partial_root (1 << 4) /* fakefs creating should be partial */
|
||||||
#define palerain_option_checkrain_is_clone (1 << 5) /* supplied checkra1n is checkra1n clone */
|
#define palerain_option_checkrain_is_clone (1 << 5) /* supplied checkra1n is checkra1n clone */
|
||||||
|
#define palerain_option_rootless_livefs (1 << 6) /* mount root livefs on rootless */
|
||||||
|
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
#define palerain_option_test1 (1 << 29)
|
#define palerain_option_test1 (1 << 29)
|
||||||
@@ -69,7 +70,7 @@
|
|||||||
// palerain host options
|
// palerain host options
|
||||||
#define host_option_dfuhelper_only (1 << 0) /* dfuhelper only */
|
#define host_option_dfuhelper_only (1 << 0) /* dfuhelper only */
|
||||||
#define host_option_pongo_exit (1 << 1) /* boot to clean pongo shell */
|
#define host_option_pongo_exit (1 << 1) /* boot to clean pongo shell */
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
#define host_option_tui (1 << 2) /* use terminal user interface */
|
#define host_option_tui (1 << 2) /* use terminal user interface */
|
||||||
#else
|
#else
|
||||||
#define host_option_res1 (1 << 2) /* reserved */
|
#define host_option_res1 (1 << 2) /* reserved */
|
||||||
@@ -121,18 +122,8 @@ struct kpfinfo {
|
|||||||
options = (checkrain_option_t)(options & ~option); \
|
options = (checkrain_option_t)(options & ~option); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
static inline bool checkrain_option_enabled(checkrain_option_t flags, checkrain_option_t opt)
|
static inline bool checkrain_options_enabled(checkrain_option_t flags, checkrain_option_t opt)
|
||||||
{
|
{
|
||||||
if(flags == checkrain_option_failure)
|
|
||||||
{
|
|
||||||
switch(opt)
|
|
||||||
{
|
|
||||||
case checkrain_option_safemode:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (flags & opt) != 0;
|
return (flags & opt) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -2,7 +2,7 @@
|
|||||||
#define PALERAIN_H
|
#define PALERAIN_H
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#define _DARWIN_C_SOURCE 1
|
#define NSIG __DARWIN_NSIG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "xxd-embedded.h"
|
#include "xxd-embedded.h"
|
||||||
@@ -100,6 +100,8 @@ struct mach_header_64
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef void *(*pthread_start_t)(void *);
|
||||||
|
|
||||||
// Keep in sync with Pongo
|
// Keep in sync with Pongo
|
||||||
#define PONGO_USB_VENDOR 0x05ac
|
#define PONGO_USB_VENDOR 0x05ac
|
||||||
#define PONGO_USB_PRODUCT 0x4141
|
#define PONGO_USB_PRODUCT 0x4141
|
||||||
@@ -149,7 +151,7 @@ typedef unsigned char niarelap_file_t[];
|
|||||||
extern unsigned int verbose;
|
extern unsigned int verbose;
|
||||||
|
|
||||||
extern char* pongo_path;
|
extern char* pongo_path;
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
extern bool tui_started;
|
extern bool tui_started;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -203,7 +205,7 @@ boyermoore_horspool_memmem(const unsigned char* haystack, size_t hlen,
|
|||||||
const unsigned char* needle, size_t nlen);
|
const unsigned char* needle, size_t nlen);
|
||||||
|
|
||||||
|
|
||||||
extern void* pongo_usb_callback(void* arg);
|
extern void* pongo_usb_callback(stuff_t* arg);
|
||||||
usb_ret_t USBControlTransfer(usb_device_handle_t handle, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint32_t wLength, void *data, uint32_t *wLenDone);
|
usb_ret_t USBControlTransfer(usb_device_handle_t handle, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint32_t wLength, void *data, uint32_t *wLenDone);
|
||||||
const char *usb_strerror(usb_ret_t err);
|
const char *usb_strerror(usb_ret_t err);
|
||||||
int wait_for_pongo(void);
|
int wait_for_pongo(void);
|
||||||
@@ -226,7 +228,7 @@ void io_stop(stuff_t *stuff);
|
|||||||
|
|
||||||
void print_credits(void);
|
void print_credits(void);
|
||||||
|
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
#include <newt.h>
|
#include <newt.h>
|
||||||
newtComponent get_tui_log();
|
newtComponent get_tui_log();
|
||||||
newtComponent set_tui_log(newtComponent co);
|
newtComponent set_tui_log(newtComponent co);
|
||||||
|
|||||||
+2
-1
@@ -11,6 +11,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <newt.h>
|
#include <newt.h>
|
||||||
|
#include <kerninfo.h>
|
||||||
|
|
||||||
#define WIDTH 76
|
#define WIDTH 76
|
||||||
#define HEIGHT 19
|
#define HEIGHT 19
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
#define PI_STEP_CURRENT NEWT_COLORSET_CUSTOM(1)
|
#define PI_STEP_CURRENT NEWT_COLORSET_CUSTOM(1)
|
||||||
#define PI_STEP_OTHER NEWT_COLORSET_CUSTOM(2)
|
#define PI_STEP_OTHER NEWT_COLORSET_CUSTOM(2)
|
||||||
|
|
||||||
#define CHECKBOX_STATE(flags, opt) checkrain_option_enabled(flags, opt) ? '*' : ' '
|
#define CHECKBOX_STATE(flags, opt) checkrain_options_enabled(flags, opt) ? '*' : ' '
|
||||||
|
|
||||||
typedef enum tui_screens {
|
typedef enum tui_screens {
|
||||||
ERROR_SCREEN = -1,
|
ERROR_SCREEN = -1,
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ extern unsigned int ramdisk_dmg_len;
|
|||||||
extern unsigned char binpack_dmg[];
|
extern unsigned char binpack_dmg[];
|
||||||
extern unsigned int binpack_dmg_len;
|
extern unsigned int binpack_dmg_len;
|
||||||
|
|
||||||
|
extern unsigned char Pongo_bin[];
|
||||||
|
extern unsigned int Pongo_bin_len;
|
||||||
|
|
||||||
#if defined(__APPLE__) && (TARGET_OS_IPHONE || defined(DEV_BUILD))
|
#if defined(__APPLE__) && (TARGET_OS_IPHONE || defined(DEV_BUILD))
|
||||||
extern unsigned char libcheckra1nhelper_dylib[];
|
extern unsigned char libcheckra1nhelper_dylib[];
|
||||||
extern unsigned int libcheckra1nhelper_dylib_len;
|
extern unsigned int libcheckra1nhelper_dylib_len;
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ Depends: usbmuxd
|
|||||||
Section: Utilities
|
Section: Utilities
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Homepage: https://palera.in
|
Homepage: https://palera.in
|
||||||
Description: iOS 15.0-16.3.1 semi-tethered checkm8 jailbreak
|
Description: iOS 15.0-16.4.1 semi-tethered checkm8 jailbreak
|
||||||
palera1n is an iOS/iPadOS 15.0-15.3.1 semi tethered jailbreak
|
palera1n is an iOS/iPadOS 15.0-15.3.1 semi tethered jailbreak
|
||||||
based on the checkm8 exploit.
|
based on the checkm8 exploit.
|
||||||
.
|
.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Author: palera1n team
|
|||||||
Section: Utilities
|
Section: Utilities
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Homepage: https://palera.in
|
Homepage: https://palera.in
|
||||||
Description: iOS 15.0-16.3.1 semi-tethered checkm8 jailbreak
|
Description: iOS 15.0-16.4.1 semi-tethered checkm8 jailbreak
|
||||||
palera1n is an iOS/iPadOS 15.0-15.3.1 semi tethered jailbreak
|
palera1n is an iOS/iPadOS 15.0-15.3.1 semi tethered jailbreak
|
||||||
based on the checkm8 exploit.
|
based on the checkm8 exploit.
|
||||||
.
|
.
|
||||||
|
|||||||
+35
-3
@@ -14,32 +14,46 @@ endif
|
|||||||
ifeq ($(FORCE_HELPER),1)
|
ifeq ($(FORCE_HELPER),1)
|
||||||
OBJECTS += xxd-libcheckra1nhelper.dylib.o
|
OBJECTS += xxd-libcheckra1nhelper.dylib.o
|
||||||
CFLAGS += -DFORCE_HELPER
|
CFLAGS += -DFORCE_HELPER
|
||||||
|
BUILD_OPTIONS += FORCE_HELPER
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(NO_RAMDISK),1)
|
ifneq ($(NO_RAMDISK),1)
|
||||||
OBJECTS += xxd-ramdisk.dmg.o
|
OBJECTS += xxd-ramdisk.dmg.o
|
||||||
else
|
else
|
||||||
CFLAGS += -DNO_RAMDISK
|
CFLAGS += -DNO_RAMDISK
|
||||||
|
BUILD_OPTIONS += NO_RAMDISK
|
||||||
endif
|
endif
|
||||||
ifneq ($(NO_KPF),1)
|
ifneq ($(NO_KPF),1)
|
||||||
OBJECTS += xxd-checkra1n-kpf-pongo.o
|
OBJECTS += xxd-checkra1n-kpf-pongo.o
|
||||||
else
|
else
|
||||||
CFLAGS += -DNO_KPF
|
CFLAGS += -DNO_KPF
|
||||||
|
BUILD_OPTIONS += NO_KPF
|
||||||
endif
|
endif
|
||||||
ifneq ($(NO_BINPACK),1)
|
ifneq ($(NO_OVERLAY),1)
|
||||||
OBJECTS += xxd-binpack.dmg.o
|
OBJECTS += xxd-binpack.dmg.o
|
||||||
else
|
else
|
||||||
CFLAGS += -DNO_BINPACK
|
CFLAGS += -DNO_OVERLAY
|
||||||
|
BUILD_OPTIONS += NO_OVERLAY
|
||||||
endif
|
endif
|
||||||
ifneq ($(NO_CHECKRAIN),1)
|
ifneq ($(NO_CHECKRAIN),1)
|
||||||
OBJECTS += xxd-checkra1n.o
|
OBJECTS += xxd-checkra1n.o
|
||||||
else
|
else
|
||||||
CFLAGS += -DNO_CHECKRAIN
|
CFLAGS += -DNO_CHECKRAIN
|
||||||
|
BUILD_OPTIONS += NO_CHECKRAIN
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(DEV_BUILD),1)
|
ifneq ($(NO_CUSTOM_PONGO),1)
|
||||||
|
OBJECTS += xxd-Pongo.bin.o
|
||||||
|
else
|
||||||
|
CFLAGS += -DNO_CUSTOM_PONGO
|
||||||
|
BUILD_OPTIONS += NO_CUSTOM_PONGO
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TUI),1)
|
||||||
OBJECTS += tui_screen_enter_recovery.o tui_screen_enter_dfu.o tui_main.o
|
OBJECTS += tui_screen_enter_recovery.o tui_screen_enter_dfu.o tui_main.o
|
||||||
OBJECTS += tui_screen_jailbreak.o tui_screen_main.o tui_screen_options.o
|
OBJECTS += tui_screen_jailbreak.o tui_screen_main.o tui_screen_options.o
|
||||||
|
BUILD_OPTIONS += TUI
|
||||||
|
CFLAGS += -DTUI
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CHECKRA1N_VERSION ?= 0.1337.1
|
CHECKRA1N_VERSION ?= 0.1337.1
|
||||||
@@ -51,7 +65,11 @@ ifneq ($(USE_LIBUSB),1)
|
|||||||
OBJECTS += usb_iokit.o
|
OBJECTS += usb_iokit.o
|
||||||
else
|
else
|
||||||
LIBS += -framework SystemConfiguration -framework Security
|
LIBS += -framework SystemConfiguration -framework Security
|
||||||
|
BUILD_OPTIONS += USE_LIBUSB
|
||||||
endif
|
endif
|
||||||
|
# add lto and debug symbols for lto
|
||||||
|
CFLAGS += -flto=full -g
|
||||||
|
LDFLAGS += -Wl,-object_path_lto,lto.o
|
||||||
else
|
else
|
||||||
USE_LIBUSB = 1
|
USE_LIBUSB = 1
|
||||||
endif
|
endif
|
||||||
@@ -62,6 +80,17 @@ CFLAGS += -DUSE_LIBUSB=1
|
|||||||
LIBS += $(DEP)/lib/libusb-1.0.a
|
LIBS += $(DEP)/lib/libusb-1.0.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(ROOTFUL),0)
|
||||||
|
CFLAGS += -DROOTFUL=1
|
||||||
|
BUILD_OPTIONS += ROOTFUL
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BUILD_OPTIONS),)
|
||||||
|
BUILD_OPTIONS = (none)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CFLAGS += -DBUILD_OPTIONS=\""$(BUILD_OPTIONS)"\"
|
||||||
|
|
||||||
checkra1n-%:
|
checkra1n-%:
|
||||||
curl -LO https://assets.checkra.in/downloads/preview/$(CHECKRA1N_VERSION)/$@
|
curl -LO https://assets.checkra.in/downloads/preview/$(CHECKRA1N_VERSION)/$@
|
||||||
chmod 755 $@
|
chmod 755 $@
|
||||||
@@ -116,6 +145,9 @@ ramdisk.dmg:
|
|||||||
binpack.dmg:
|
binpack.dmg:
|
||||||
curl -LO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg
|
curl -LO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg
|
||||||
|
|
||||||
|
Pongo.bin:
|
||||||
|
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/Pongo.bin
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o palera1n checkra1n checkra1n.c palera1n.dSYM libcheckra1nhelper.dylib
|
rm -rf *.o palera1n checkra1n checkra1n.c palera1n.dSYM libcheckra1nhelper.dylib
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef BAKERAIN_DEVELOPE_R
|
#ifndef BAKERAIN_DEVELOPE_R
|
||||||
#define BAKERAIN_DEVELOPE_R "dora2ios"
|
#define BAKERAIN_DEVELOPE_R "kok3shidoll"
|
||||||
#endif
|
#endif
|
||||||
#define THE_PLUSH "Ploosh"
|
#define THE_PLUSH "Ploosh"
|
||||||
|
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
#define B stderr
|
#define B stderr
|
||||||
#define L ,
|
#define L ,
|
||||||
#define E "# == palera1n-c == \n#\n"
|
#define E "# == palera1n-c == \n#\n"
|
||||||
#define M "# Made by: Nick Chan, " THE_PLUSH ", Mineek, Nebula, llsc12\n#\n"
|
#define M "# Made by: Nick Chan, " THE_PLUSH ", Samara, Nebula, staturnz, " BAKERAIN_DEVELOPE_R " \n#\n"
|
||||||
#define A "# Thanks to: " BAKERAIN_DEVELOPE_R ", pythonplayer, tihmstar, nikias\n"
|
#define A "# Thanks to: pythonplayer123, llsc12, Mineek, tihmstar, nikias\n"
|
||||||
#define K "# (libimobiledevice), checkra1n team (Siguza, axi0mx, littlelailo\n"
|
#define K "# (libimobiledevice), checkra1n team (Siguza, axi0mx, littlelailo\n"
|
||||||
#define I "# et al.), Procursus Team (Hayden Seay, Cameron Katri, Keto et.al)\n\n"
|
#define I "# et al.), Procursus Team (Hayden Seay, Cameron Katri, Keto et.al)\n\n"
|
||||||
#define N )
|
#define N )
|
||||||
|
|||||||
+78
-75
@@ -76,27 +76,27 @@ bool cpid_is_arm64(unsigned int cpid) {
|
|||||||
* ========== 0x8960 ===========
|
* ========== 0x8960 ===========
|
||||||
* (ARM64) A7
|
* (ARM64) A7
|
||||||
*/
|
*/
|
||||||
if (
|
return (
|
||||||
cpid == 0x8960 || cpid == 0x7000 || cpid == 0x7001
|
cpid == 0x8960 || cpid == 0x7000 || cpid == 0x7001 ||
|
||||||
|| cpid == 0x8000 || cpid == 0x8001 || cpid == 0x8003
|
cpid == 0x8000 || cpid == 0x8001 || cpid == 0x8003 ||
|
||||||
|| cpid == 0x8010 || cpid == 0x8011 || cpid == 0x8012
|
cpid == 0x8010 || cpid == 0x8011 || cpid == 0x8012 ||
|
||||||
|| cpid == 0x8015
|
cpid == 0x8015
|
||||||
|
);
|
||||||
) return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int subscribe_cmd(usbmuxd_event_cb_t device_event_cb, irecv_device_event_cb_t irecv_event_cb)
|
int subscribe_cmd(usbmuxd_event_cb_t device_event_cb, irecv_device_event_cb_t irecv_event_cb)
|
||||||
{
|
{
|
||||||
usbmuxd_events_subscribe(&usbmuxdctx, device_event_cb, NULL);
|
int ret;
|
||||||
irecv_device_event_subscribe(&irecvctx, irecv_event_cb, NULL);
|
if ((ret = usbmuxd_events_subscribe(&usbmuxdctx, device_event_cb, NULL))) return ret;
|
||||||
|
if ((ret = irecv_device_event_subscribe(&irecvctx, irecv_event_cb, NULL))) return ret;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unsubscribe_cmd(void)
|
int unsubscribe_cmd(void)
|
||||||
{
|
{
|
||||||
usbmuxd_events_unsubscribe(usbmuxdctx);
|
int ret;
|
||||||
irecv_device_event_unsubscribe(irecvctx);
|
if ((ret = usbmuxd_events_unsubscribe(usbmuxdctx))) return ret;
|
||||||
|
if ((ret = irecv_device_event_unsubscribe(irecvctx))) return ret;
|
||||||
irecvctx = NULL;
|
irecvctx = NULL;
|
||||||
usbmuxdctx = NULL;
|
usbmuxdctx = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -119,15 +119,15 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
|
|||||||
}
|
}
|
||||||
if (lockdownd_client_new(device, &lockdown, "palera1n") != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_client_new(device, &lockdown, "palera1n") != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Device is not in normal mode.");
|
LOG(LOG_ERROR, "Device is not in normal mode.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
plist_t node = NULL;
|
plist_t node = NULL;
|
||||||
if (lockdownd_get_value(lockdown, NULL, "UniqueChipID", &node) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_get_value(lockdown, NULL, "UniqueChipID", &node) != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Error getting ECID");
|
LOG(LOG_ERROR, "Error getting ECID");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -137,8 +137,8 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
|
|||||||
node = NULL;
|
node = NULL;
|
||||||
if (lockdownd_get_value(lockdown, NULL, "ProductType", &node) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_get_value(lockdown, NULL, "ProductType", &node) != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Error getting product type");
|
LOG(LOG_ERROR, "Error getting product type");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -148,8 +148,8 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
|
|||||||
node = NULL;
|
node = NULL;
|
||||||
if (lockdownd_get_value(lockdown, NULL, "CPUArchitecture", &node) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_get_value(lockdown, NULL, "CPUArchitecture", &node) != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Error getting CPU type");
|
LOG(LOG_ERROR, "Error getting CPU type");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -159,8 +159,8 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
|
|||||||
node = NULL;
|
node = NULL;
|
||||||
if (lockdownd_get_value(lockdown, NULL, "ProductVersion", &node) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_get_value(lockdown, NULL, "ProductVersion", &node) != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Error getting product version");
|
LOG(LOG_ERROR, "Error getting product version");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -170,21 +170,21 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
|
|||||||
node = NULL;
|
node = NULL;
|
||||||
if (lockdownd_get_value(lockdown, NULL, "BuildVersion", &node) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_get_value(lockdown, NULL, "BuildVersion", &node) != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Error getting build version");
|
LOG(LOG_ERROR, "Error getting build version");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
plist_get_string_val(node, &buildVersion);
|
plist_get_string_val(node, &buildVersion);
|
||||||
plist_free(node);
|
plist_free(node);
|
||||||
lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
idevice_free(device);
|
(void)idevice_free(device);
|
||||||
|
|
||||||
irecv_device_t rcvydev;
|
irecv_device_t rcvydev;
|
||||||
if (irecv_devices_get_device_by_product_type(productType, &rcvydev) == IRECV_E_SUCCESS)
|
if (irecv_devices_get_device_by_product_type(productType, &rcvydev) == IRECV_E_SUCCESS)
|
||||||
{
|
{
|
||||||
displayName = rcvydev->display_name;
|
displayName = rcvydev->display_name;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
{
|
{
|
||||||
displayName = productType;
|
displayName = productType;
|
||||||
}
|
}
|
||||||
@@ -209,23 +209,22 @@ int enter_recovery_cmd(const char* udid) {
|
|||||||
LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
|
LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
do {
|
ldret = lockdownd_enter_recovery(lockdown);
|
||||||
ldret = lockdownd_enter_recovery(lockdown);
|
if (ldret == LOCKDOWN_E_SESSION_INACTIVE) {
|
||||||
if (ldret == LOCKDOWN_E_SESSION_INACTIVE) {
|
lockdownd_client_free(lockdown);
|
||||||
lockdownd_client_free(lockdown);
|
lockdown = NULL;
|
||||||
lockdown = NULL;
|
ldret = lockdownd_client_new_with_handshake(device, &lockdown, "palera1n");
|
||||||
if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lockdown, "palera1n"))) {
|
|
||||||
LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
ldret = lockdownd_enter_recovery(lockdown);
|
|
||||||
}
|
|
||||||
if (ldret != LOCKDOWN_E_SUCCESS) {
|
if (ldret != LOCKDOWN_E_SUCCESS) {
|
||||||
LOG(LOG_ERROR, "Could not trigger entering recovery mode: %s", lockdownd_strerror(ldret));
|
LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
lockdownd_client_free(lockdown);
|
ldret = lockdownd_enter_recovery(lockdown);
|
||||||
} while (0);
|
}
|
||||||
|
if (ldret != LOCKDOWN_E_SUCCESS) {
|
||||||
|
LOG(LOG_ERROR, "Could not trigger entering recovery mode: %s", lockdownd_strerror(ldret));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
lockdownd_client_free(lockdown);
|
||||||
idevice_free(device);
|
idevice_free(device);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -242,8 +241,8 @@ int reboot_cmd(const char* udid) {
|
|||||||
if (diagnostics_relay_restart(diag, DIAGNOSTICS_RELAY_ACTION_FLAG_WAIT_FOR_DISCONNECT) != DIAGNOSTICS_RELAY_E_SUCCESS) {
|
if (diagnostics_relay_restart(diag, DIAGNOSTICS_RELAY_ACTION_FLAG_WAIT_FOR_DISCONNECT) != DIAGNOSTICS_RELAY_E_SUCCESS) {
|
||||||
LOG(LOG_ERROR, "Could not reboot device.");
|
LOG(LOG_ERROR, "Could not reboot device.");
|
||||||
}
|
}
|
||||||
diagnostics_relay_goodbye(diag);
|
(void)diagnostics_relay_goodbye(diag);
|
||||||
diagnostics_relay_client_free(diag);
|
(void)diagnostics_relay_client_free(diag);
|
||||||
} else {
|
} else {
|
||||||
LOG(LOG_ERROR, "Could not connect to device.");
|
LOG(LOG_ERROR, "Could not connect to device.");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -302,9 +301,9 @@ int passstat_cmd(unsigned char* status, const char* udid) {
|
|||||||
derr = diagnostics_relay_query_mobilegestalt(diagnostics_client, keys, &node);
|
derr = diagnostics_relay_query_mobilegestalt(diagnostics_client, keys, &node);
|
||||||
|
|
||||||
plist_free(keys);
|
plist_free(keys);
|
||||||
diagnostics_relay_client_free(diagnostics_client);
|
(void)diagnostics_relay_client_free(diagnostics_client);
|
||||||
lockdownd_service_descriptor_free(service);
|
(void)lockdownd_service_descriptor_free(service);
|
||||||
idevice_free(dev);
|
(void)idevice_free(dev);
|
||||||
|
|
||||||
if (derr != DIAGNOSTICS_RELAY_E_SUCCESS || !node)
|
if (derr != DIAGNOSTICS_RELAY_E_SUCCESS || !node)
|
||||||
{
|
{
|
||||||
@@ -322,7 +321,7 @@ int passstat_cmd(unsigned char* status, const char* udid) {
|
|||||||
plist_get_string_val(status_node, &passstat_status);
|
plist_get_string_val(status_node, &passstat_status);
|
||||||
if (!status || strncmp(passstat_status, "Succ", 4))
|
if (!status || strncmp(passstat_status, "Succ", 4))
|
||||||
{
|
{
|
||||||
if (passstat_status)
|
if (passstat_status)
|
||||||
free(passstat_status);
|
free(passstat_status);
|
||||||
passstat_status = NULL;
|
passstat_status = NULL;
|
||||||
plist_free(node);
|
plist_free(node);
|
||||||
@@ -349,20 +348,16 @@ int passstat_cmd(unsigned char* status, const char* udid) {
|
|||||||
int recvinfo_cmd(recvinfo_t* info, const uint64_t ecid) {
|
int recvinfo_cmd(recvinfo_t* info, const uint64_t ecid) {
|
||||||
irecv_client_t client = NULL;
|
irecv_client_t client = NULL;
|
||||||
irecv_error_t err = irecv_open_with_ecid(&client, ecid);
|
irecv_error_t err = irecv_open_with_ecid(&client, ecid);
|
||||||
if (err != IRECV_E_SUCCESS) {
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
irecv_get_mode(client, &mode);
|
err = irecv_get_mode(client, &mode);
|
||||||
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
char *ibootver = NULL;
|
char *ibootver = NULL;
|
||||||
irecv_getenv(client, "build-version", &ibootver);
|
err = irecv_getenv(client, "build-version", &ibootver);
|
||||||
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
irecv_device_t device;
|
irecv_device_t device;
|
||||||
err = irecv_devices_get_device_by_client(client, &device);
|
err = irecv_devices_get_device_by_client(client, &device);
|
||||||
if (err != IRECV_E_SUCCESS) {
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
info->mode = mode;
|
info->mode = mode;
|
||||||
info->cpid = device->chip_id;
|
info->cpid = device->chip_id;
|
||||||
snprintf(info->product_type, 0x20, "%s", device->product_type);
|
snprintf(info->product_type, 0x20, "%s", device->product_type);
|
||||||
@@ -371,33 +366,41 @@ int recvinfo_cmd(recvinfo_t* info, const uint64_t ecid) {
|
|||||||
free(ibootver);
|
free(ibootver);
|
||||||
irecv_close(client);
|
irecv_close(client);
|
||||||
return 0;
|
return 0;
|
||||||
|
err:
|
||||||
|
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int autoboot_cmd(const uint64_t ecid) {
|
int autoboot_cmd(const uint64_t ecid) {
|
||||||
irecv_client_t client = NULL;
|
irecv_client_t client = NULL;
|
||||||
irecv_error_t err = irecv_open_with_ecid(&client, ecid);
|
irecv_error_t err = irecv_open_with_ecid(&client, ecid);
|
||||||
if (err == IRECV_E_SUCCESS) {
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
irecv_setenv(client, "auto-boot", "true");
|
err = irecv_setenv(client, "auto-boot", "true");
|
||||||
irecv_saveenv(client);
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
irecv_close(client);
|
err = irecv_saveenv(client);
|
||||||
return 0;
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
} else {
|
err = irecv_close(client);
|
||||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
|
return 0;
|
||||||
|
err:
|
||||||
|
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int exitrecv_cmd(const uint64_t ecid) {
|
int exitrecv_cmd(const uint64_t ecid) {
|
||||||
irecv_client_t client = NULL;
|
irecv_client_t client = NULL;
|
||||||
irecv_error_t err = irecv_open_with_ecid(&client, ecid);
|
irecv_error_t err = irecv_open_with_ecid(&client, ecid);
|
||||||
if (err == IRECV_E_SUCCESS) {
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
irecv_setenv(client, "auto-boot", "true");
|
err = irecv_setenv(client, "auto-boot", "true");
|
||||||
irecv_saveenv(client);
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
irecv_reboot(client);
|
err = irecv_saveenv(client);
|
||||||
irecv_close(client);
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
return 0;
|
err = irecv_reboot(client);
|
||||||
} else {
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
err = irecv_close(client);
|
||||||
return -1;
|
if (err != IRECV_E_SUCCESS) goto err;
|
||||||
}
|
return 0;
|
||||||
|
err:
|
||||||
|
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
+104
-80
@@ -36,12 +36,20 @@ int dfuhelper_thr_running = false;
|
|||||||
|
|
||||||
void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) {
|
void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) {
|
||||||
for (int i = time2; i < time; i++) {
|
for (int i = time2; i < time; i++) {
|
||||||
printf(checkrain_option_enabled(host_flags, host_option_no_colors) ? "\r\033[K%s (%d)" : BCYN "\r\033[K%s (%d)" CRESET, text, time - i + time2);
|
printf(
|
||||||
|
checkrain_options_enabled(host_flags, host_option_no_colors)
|
||||||
|
? "\r\033[K%s (%d)"
|
||||||
|
: BCYN "\r\033[K%s (%d)" CRESET, text, time - i + time2
|
||||||
|
);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
if (cond != NULL && cond(cond_arg)) pthread_exit(NULL);
|
if (cond != NULL && cond(cond_arg)) pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
printf(checkrain_option_enabled(host_flags, host_option_no_colors) ? "\r%s (%d)" : CYN "\r%s (%d)" CRESET, text, time2);
|
printf(
|
||||||
|
checkrain_options_enabled(host_flags, host_option_no_colors)
|
||||||
|
? "\r%s (%d)"
|
||||||
|
: CYN "\r%s (%d)" CRESET, text, time2
|
||||||
|
);
|
||||||
if (time2 == 0) puts("");
|
if (time2 == 0) puts("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,13 +61,14 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
|||||||
LOG(LOG_ERROR, "Unable to get device information");
|
LOG(LOG_ERROR, "Unable to get device information");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strcmp(dev.CPUArchitecture, "arm64")) {
|
if (strncmp(dev.CPUArchitecture, "arm64", strlen("arm64"))) {
|
||||||
devinfo_free(&dev);
|
devinfo_free(&dev);
|
||||||
LOG(LOG_WARNING, "Ignoring non-arm64 device...");
|
LOG(LOG_WARNING, "Ignoring non-arm64 device...");
|
||||||
|
LOG(LOG_WARNING, "palera1n doesn't and never will work on A12+ (arm64e)");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
|
if (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
|
||||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||||
LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled", dev.productType);
|
LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled", dev.productType);
|
||||||
unsigned char passcode_state = 0;
|
unsigned char passcode_state = 0;
|
||||||
ret = passstat_cmd(&passcode_state, usbmuxd_device->udid);
|
ret = passstat_cmd(&passcode_state, usbmuxd_device->udid);
|
||||||
@@ -70,14 +79,14 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
|||||||
}
|
}
|
||||||
if (passcode_state) {
|
if (passcode_state) {
|
||||||
LOG(LOG_ERROR, "Passcode must be disabled on this device");
|
LOG(LOG_ERROR, "Passcode must be disabled on this device");
|
||||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||||
LOG(LOG_ERROR, "Additionally, passcode must never be set since restore on iOS 16+");
|
LOG(LOG_ERROR, "Additionally, passcode must never be set since a restore on iOS 16+");
|
||||||
devinfo_free(&dev);
|
devinfo_free(&dev);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkrain_option_enabled(host_flags, host_option_device_info)) {
|
if (checkrain_options_enabled(host_flags, host_option_device_info)) {
|
||||||
printf("Mode: normal\n");
|
printf("Mode: normal\n");
|
||||||
printf("ProductType: %s\n", dev.productType);
|
printf("ProductType: %s\n", dev.productType);
|
||||||
printf("Architecture: %s\n", dev.CPUArchitecture);
|
printf("Architecture: %s\n", dev.CPUArchitecture);
|
||||||
@@ -92,7 +101,7 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
|||||||
LOG(LOG_INFO, "Telling device with udid %s to enter recovery mode immediately", usbmuxd_device->udid);
|
LOG(LOG_INFO, "Telling device with udid %s to enter recovery mode immediately", usbmuxd_device->udid);
|
||||||
enter_recovery_cmd(usbmuxd_device->udid);
|
enter_recovery_cmd(usbmuxd_device->udid);
|
||||||
devinfo_free(&dev);
|
devinfo_free(&dev);
|
||||||
if (checkrain_option_enabled(host_flags, host_option_enter_recovery)) {
|
if (checkrain_options_enabled(host_flags, host_option_enter_recovery)) {
|
||||||
device_has_booted = true;
|
device_has_booted = true;
|
||||||
set_spin(0);
|
set_spin(0);
|
||||||
unsubscribe_cmd();
|
unsubscribe_cmd();
|
||||||
@@ -137,17 +146,14 @@ void* connected_recovery_mode(struct irecv_device_info* info) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
printf("\r\033[K");
|
printf("\r\033[K");
|
||||||
bool nohome = NOHOME;
|
if (NOHOME) {
|
||||||
if (nohome)
|
|
||||||
step(2, 0, "Hold volume down + side button", NULL, 0);
|
step(2, 0, "Hold volume down + side button", NULL, 0);
|
||||||
else
|
|
||||||
step(2, 0, "Hold home + power button", NULL, 0);
|
|
||||||
if (nohome)
|
|
||||||
step(10, 0, "Hold volume down button", conditional, ecid);
|
step(10, 0, "Hold volume down button", conditional, ecid);
|
||||||
else
|
|
||||||
step(10, 0, "Hold home button", conditional, ecid);
|
|
||||||
if (get_ecid_wait_for_dfu() != ecid) {
|
|
||||||
} else {
|
} else {
|
||||||
|
step(2, 0, "Hold home + power button", NULL, 0);
|
||||||
|
step(10, 0, "Hold home button", conditional, ecid);
|
||||||
|
}
|
||||||
|
if (get_ecid_wait_for_dfu() == ecid) {
|
||||||
LOG(LOG_WARNING, "Whoops, device did not enter DFU mode");
|
LOG(LOG_WARNING, "Whoops, device did not enter DFU mode");
|
||||||
LOG(LOG_INFO, "Waiting for device to reconnect...");
|
LOG(LOG_INFO, "Waiting for device to reconnect...");
|
||||||
set_ecid_wait_for_dfu(0);
|
set_ecid_wait_for_dfu(0);
|
||||||
@@ -175,13 +181,15 @@ void device_event_cb(const usbmuxd_event_t *event, void* userdata) {
|
|||||||
switch (event->event) {
|
switch (event->event) {
|
||||||
case UE_DEVICE_ADD:
|
case UE_DEVICE_ADD:
|
||||||
LOG(LOG_VERBOSE, "Normal mode device connected");
|
LOG(LOG_VERBOSE, "Normal mode device connected");
|
||||||
if (checkrain_option_enabled(host_flags, host_option_exit_recovery)) {
|
if (checkrain_options_enabled(host_flags, host_option_exit_recovery)) {
|
||||||
break;
|
break;
|
||||||
} else if (checkrain_option_enabled(host_flags, host_option_reboot_device)) {
|
} else if (checkrain_options_enabled(host_flags, host_option_reboot_device)) {
|
||||||
reboot_cmd(event->device.udid);
|
int ret = reboot_cmd(event->device.udid);
|
||||||
LOG(LOG_INFO, "Restarted device");
|
if (!ret) {
|
||||||
set_spin(0);
|
LOG(LOG_INFO, "Restarted device");
|
||||||
unsubscribe_cmd();
|
set_spin(0);
|
||||||
|
unsubscribe_cmd();
|
||||||
|
}
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -195,69 +203,85 @@ void device_event_cb(const usbmuxd_event_t *event, void* userdata) {
|
|||||||
|
|
||||||
void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
|
void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
|
||||||
pthread_t recovery_thread, dfu_thread;
|
pthread_t recovery_thread, dfu_thread;
|
||||||
|
int ret;
|
||||||
|
|
||||||
switch(event->type) {
|
switch(event->type) {
|
||||||
case IRECV_DEVICE_ADD:
|
case IRECV_DEVICE_ADD:
|
||||||
if (event->mode == IRECV_K_RECOVERY_MODE_1 || event->mode == IRECV_K_RECOVERY_MODE_2 || event->mode == IRECV_K_RECOVERY_MODE_3 || event->mode == IRECV_K_RECOVERY_MODE_4) {
|
if (event->mode == IRECV_K_RECOVERY_MODE_1 ||
|
||||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
event->mode == IRECV_K_RECOVERY_MODE_2 ||
|
||||||
LOG(LOG_VERBOSE, "Recovery mode device %ld connected", event->device_info->ecid);
|
event->mode == IRECV_K_RECOVERY_MODE_3 ||
|
||||||
if (checkrain_option_enabled(host_flags, host_option_exit_recovery)) {
|
event->mode == IRECV_K_RECOVERY_MODE_4) {
|
||||||
exitrecv_cmd(event->device_info->ecid);
|
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||||
LOG(LOG_INFO, "Exited recovery mode");
|
LOG(LOG_VERBOSE, "Recovery mode device %ld connected", event->device_info->ecid);
|
||||||
device_has_booted = true;
|
if (checkrain_options_enabled(host_flags, host_option_exit_recovery)) {
|
||||||
set_spin(0);
|
ret = exitrecv_cmd(event->device_info->ecid);
|
||||||
unsubscribe_cmd();
|
if (!ret) {
|
||||||
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
|
LOG(LOG_INFO, "Exited recovery mode");
|
||||||
pthread_exit(NULL);
|
device_has_booted = true;
|
||||||
break;
|
set_spin(0);
|
||||||
}
|
unsubscribe_cmd();
|
||||||
|
} else {
|
||||||
if (checkrain_option_enabled(host_flags, host_option_device_info)) {
|
LOG(LOG_WARNING, "Could not exit recovery mode");
|
||||||
recvinfo_t info;
|
}
|
||||||
recvinfo_cmd(&info, event->device_info->ecid);
|
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
|
||||||
printf("Mode: recovery\n");
|
pthread_exit(NULL);
|
||||||
printf("ProductType: %s\n", info.product_type);
|
|
||||||
printf("DisplayName: %s\n", info.display_name);
|
|
||||||
|
|
||||||
device_has_booted = true;
|
|
||||||
set_spin(0);
|
|
||||||
unsubscribe_cmd();
|
|
||||||
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
|
|
||||||
pthread_exit(NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
|
|
||||||
checkrain_option_enabled(host_flags, host_option_reboot_device)) return;
|
|
||||||
pthread_create(&recovery_thread, NULL, (void* (*)(void*))connected_recovery_mode, event->device_info);
|
|
||||||
} else if (event->mode == IRECV_K_DFU_MODE) {
|
|
||||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
|
||||||
LOG(LOG_VERBOSE, "DFU mode device %ld connected", event->device_info->ecid);
|
|
||||||
|
|
||||||
if (checkrain_option_enabled(host_flags, host_option_device_info)) {
|
|
||||||
recvinfo_t info;
|
|
||||||
recvinfo_cmd(&info, event->device_info->ecid);
|
|
||||||
printf("Mode: dfu\n");
|
|
||||||
printf("ProductType: %s\n", info.product_type);
|
|
||||||
printf("DisplayName: %s\n", info.display_name);
|
|
||||||
|
|
||||||
device_has_booted = true;
|
|
||||||
set_spin(0);
|
|
||||||
unsubscribe_cmd();
|
|
||||||
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
|
|
||||||
pthread_exit(NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
checkrain_option_enabled(host_flags, host_option_exit_recovery) ||
|
|
||||||
checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
|
|
||||||
checkrain_option_enabled(host_flags, host_option_reboot_device)) {
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkrain_options_enabled(host_flags, host_option_device_info)) {
|
||||||
|
recvinfo_t info;
|
||||||
|
ret = recvinfo_cmd(&info, event->device_info->ecid);
|
||||||
|
if (ret) {
|
||||||
|
LOG(LOG_WARNING, "Could not get info from device");
|
||||||
|
} else {
|
||||||
|
printf("Mode: Recovery\n");
|
||||||
|
printf("ProductType: %s\n", info.product_type);
|
||||||
|
printf("DisplayName: %s\n", info.display_name);
|
||||||
|
|
||||||
|
device_has_booted = true;
|
||||||
|
set_spin(0);
|
||||||
|
unsubscribe_cmd();
|
||||||
|
}
|
||||||
|
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
|
||||||
|
pthread_exit(NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkrain_options_enabled(host_flags, host_option_enter_recovery) ||
|
||||||
|
checkrain_options_enabled(host_flags, host_option_reboot_device)) return;
|
||||||
|
pthread_create(&recovery_thread, NULL, (pthread_start_t)connected_recovery_mode, event->device_info);
|
||||||
|
} else if (event->mode == IRECV_K_DFU_MODE) {
|
||||||
|
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||||
|
LOG(LOG_VERBOSE, "DFU mode device %ld connected", event->device_info->ecid);
|
||||||
|
|
||||||
|
if (checkrain_options_enabled(host_flags, host_option_device_info)) {
|
||||||
|
recvinfo_t info;
|
||||||
|
ret = recvinfo_cmd(&info, event->device_info->ecid);
|
||||||
|
if (ret) {
|
||||||
|
LOG(LOG_WARNING, "Could not get info from device");
|
||||||
|
} else {
|
||||||
|
printf("Mode: DFU\n");
|
||||||
|
printf("ProductType: %s\n", info.product_type);
|
||||||
|
printf("DisplayName: %s\n", info.display_name);
|
||||||
|
|
||||||
|
device_has_booted = true;
|
||||||
|
set_spin(0);
|
||||||
|
unsubscribe_cmd();
|
||||||
|
}
|
||||||
|
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
|
||||||
|
pthread_exit(NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
checkrain_options_enabled(host_flags, host_option_exit_recovery) ||
|
||||||
|
checkrain_options_enabled(host_flags, host_option_enter_recovery) ||
|
||||||
|
checkrain_options_enabled(host_flags, host_option_reboot_device)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pthread_create(&dfu_thread, NULL, (pthread_start_t)connected_dfu_mode, event->device_info);
|
||||||
}
|
}
|
||||||
pthread_create(&dfu_thread, NULL, (void* (*)(void*))connected_dfu_mode, event->device_info);
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IRECV_DEVICE_REMOVE:
|
case IRECV_DEVICE_REMOVE:
|
||||||
LOG(LOG_VERBOSE, "Recovery mode device disconnected");
|
LOG(LOG_VERBOSE, "Recovery mode device disconnected");
|
||||||
break;
|
break;
|
||||||
|
|||||||
+66
-26
@@ -26,37 +26,65 @@ extern char **environ;
|
|||||||
#include <palerain.h>
|
#include <palerain.h>
|
||||||
#include <xxd-embedded.h>
|
#include <xxd-embedded.h>
|
||||||
char* pongo_path = NULL;
|
char* pongo_path = NULL;
|
||||||
|
bool external_pongo = false;
|
||||||
char* ext_checkra1n = NULL;
|
char* ext_checkra1n = NULL;
|
||||||
|
|
||||||
#define tmpdir getenv("TMPDIR") == NULL ? "/tmp" : getenv("TMPDIR")
|
#define tmpdir getenv("TMPDIR") == NULL ? "/tmp" : getenv("TMPDIR")
|
||||||
|
|
||||||
int exec_checkra1n(void) {
|
int exec_checkra1n(void) {
|
||||||
LOG(LOG_INFO, "About to execute checkra1n");
|
LOG(LOG_INFO, "About to execute checkra1n");
|
||||||
int fd, ret;
|
int fd_checkra1n, fd_pongo, ret;
|
||||||
char* checkra1n_path = NULL;
|
char* checkra1n_path = NULL;
|
||||||
if (ext_checkra1n != NULL) {
|
if (ext_checkra1n != NULL) {
|
||||||
checkra1n_path = ext_checkra1n;
|
checkra1n_path = ext_checkra1n;
|
||||||
goto checkra1n_exec;
|
goto checkra1n_exec;
|
||||||
}
|
}
|
||||||
|
#ifndef NO_CUSTOM_PONGO
|
||||||
|
if (pongo_path == NULL) {
|
||||||
|
pongo_path = malloc(strlen(tmpdir) + 20);
|
||||||
|
snprintf(pongo_path, strlen(tmpdir) + 20, "%s/Pongo.bin.XXXXXX", tmpdir);
|
||||||
|
fd_pongo = mkstemp(pongo_path);
|
||||||
|
if (fd_pongo == -1) {
|
||||||
|
LOG(LOG_FATAL, "Cannot open temporary file %s: %d (%s)", pongo_path, errno, strerror(errno));
|
||||||
|
free(pongo_path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ssize_t didWrite_Pongo_bin = write(fd_pongo, Pongo_bin, Pongo_bin_len);
|
||||||
|
if (didWrite_Pongo_bin != (ssize_t)Pongo_bin_len) {
|
||||||
|
LOG(LOG_FATAL, "Size written to %s does not match expected: %lld != %d: %d (%s)", pongo_path, didWrite_Pongo_bin, Pongo_bin_len, errno, strerror(errno));
|
||||||
|
close(fd_pongo);
|
||||||
|
unlink(pongo_path);
|
||||||
|
free(pongo_path);
|
||||||
|
pongo_path = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else external_pongo = true;
|
||||||
|
#endif
|
||||||
checkra1n_path = malloc(strlen(tmpdir) + 20);
|
checkra1n_path = malloc(strlen(tmpdir) + 20);
|
||||||
snprintf(checkra1n_path, strlen(tmpdir) + 20, "%s/checkra1n.XXXXXX", tmpdir);
|
snprintf(checkra1n_path, strlen(tmpdir) + 20, "%s/checkra1n.XXXXXX", tmpdir);
|
||||||
fd = mkstemp(checkra1n_path);
|
fd_checkra1n = mkstemp(checkra1n_path);
|
||||||
if (fd == -1) {
|
if (fd_checkra1n == -1) {
|
||||||
LOG(LOG_FATAL, "Cannot open temporary file: %d (%s)", errno, strerror(errno));
|
LOG(LOG_FATAL, "Cannot open temporary file %s: %d (%s)", checkra1n_path, errno, strerror(errno));
|
||||||
|
free(checkra1n_path);
|
||||||
|
checkra1n_path = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ssize_t didWrite = write(fd, checkra1n, checkra1n_len);
|
ssize_t didWrite_checkra1n = write(fd_checkra1n, checkra1n, checkra1n_len);
|
||||||
if (didWrite != (ssize_t)checkra1n_len) {
|
if (didWrite_checkra1n != (ssize_t)checkra1n_len) {
|
||||||
LOG(LOG_FATAL, "Size written does not match expected: %lld != %d: %d (%s)", didWrite, checkra1n_len, errno, strerror(errno));
|
LOG(LOG_FATAL, "Size written to %s does not match expected: %lld != %d: %d (%s)", checkra1n_path, didWrite_checkra1n, checkra1n_len, errno, strerror(errno));
|
||||||
close(fd);
|
close(fd_checkra1n);
|
||||||
unlink(checkra1n_path);
|
unlink(checkra1n_path);
|
||||||
|
free(checkra1n_path);
|
||||||
|
checkra1n_path = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd_checkra1n);
|
||||||
ret = chmod(checkra1n_path, 0700);
|
ret = chmod(checkra1n_path, 0700);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG(LOG_FATAL, "Cannot chmod %s: %d (%s)", checkra1n_path, errno, strerror(errno));
|
LOG(LOG_FATAL, "Cannot chmod %s: %d (%s)", checkra1n_path, errno, strerror(errno));
|
||||||
unlink(checkra1n_path);
|
unlink(checkra1n_path);
|
||||||
|
free(checkra1n_path);
|
||||||
|
checkra1n_path = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#if defined(__APPLE__) && defined(__arm64__) && (TARGET_OS_IPHONE || defined(FORCE_HELPER))
|
#if defined(__APPLE__) && defined(__arm64__) && (TARGET_OS_IPHONE || defined(FORCE_HELPER))
|
||||||
@@ -76,9 +104,9 @@ int exec_checkra1n(void) {
|
|||||||
LOG(LOG_FATAL, "Cannot open temporary file: %d (%s)", errno, strerror(errno));
|
LOG(LOG_FATAL, "Cannot open temporary file: %d (%s)", errno, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ssize_t didWrite = write(helper_fd, libcheckra1nhelper_dylib, libcheckra1nhelper_dylib_len);
|
ssize_t didWrite_libcheckra1nhelper = write(helper_fd, libcheckra1nhelper_dylib, libcheckra1nhelper_dylib_len);
|
||||||
if ((unsigned int)didWrite != libcheckra1nhelper_dylib_len) {
|
if ((unsigned int)didWrite_libcheckra1nhelper != libcheckra1nhelper_dylib_len) {
|
||||||
LOG(LOG_FATAL, "Size written does not match expected: %lld != %d: %d (%s)", didWrite, libcheckra1nhelper_dylib_len, errno, strerror(errno));
|
LOG(LOG_FATAL, "Size written does not match expected: %lld != %d: %d (%s)", didWrite_libcheckra1nhelper, libcheckra1nhelper_dylib_len, errno, strerror(errno));
|
||||||
close(helper_fd);
|
close(helper_fd);
|
||||||
unlink(libcheckra1nhelper_dylib_path);
|
unlink(libcheckra1nhelper_dylib_path);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -98,25 +126,32 @@ int exec_checkra1n(void) {
|
|||||||
#endif
|
#endif
|
||||||
checkra1n_exec: {};
|
checkra1n_exec: {};
|
||||||
char args[0x10] = "-E";
|
char args[0x10] = "-E";
|
||||||
if (checkrain_option_enabled(host_flags, host_option_demote)) strncat(args, "d", 0xf);
|
if (checkrain_options_enabled(host_flags, host_option_demote)) strncat(args, "d", 0xf);
|
||||||
if (!checkrain_option_enabled(host_flags, palerain_option_checkrain_is_clone)) {
|
if (!checkrain_options_enabled(host_flags, palerain_option_checkrain_is_clone)) {
|
||||||
strncat(args, "p", 0xf);
|
strncat(args, "p", 0xf);
|
||||||
if (verbose >= 2) strncat(args, "v", 0xf);
|
if (verbose >= 2) strncat(args, "v", 0xf);
|
||||||
if (checkrain_option_enabled(host_flags, host_option_no_colors)) strncat(args, "n", 0xf);
|
if (checkrain_options_enabled(host_flags, host_option_no_colors)) strncat(args, "n", 0xf);
|
||||||
} else {
|
} else {
|
||||||
strncat(args, "R", 0xf);
|
strncat(args, "R", 0xf);
|
||||||
}
|
}
|
||||||
if (pongo_path != NULL) strncat(args, "k", 0xf); // keep this at last
|
LOG(LOG_VERBOSE5, args);
|
||||||
|
if (pongo_path != NULL) LOG(LOG_VERBOSE5, pongo_path);
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char* checkra1n_argv[] = {
|
if (pongo_path != NULL) {
|
||||||
checkra1n_path,
|
ret = posix_spawn(&pid, checkra1n_path, NULL, NULL, (char* []){
|
||||||
args,
|
checkra1n_path,
|
||||||
pongo_path,
|
args,
|
||||||
NULL
|
"-k",
|
||||||
};
|
pongo_path,
|
||||||
ret = posix_spawn(&pid, checkra1n_path, NULL, NULL, checkra1n_argv, environ);
|
NULL
|
||||||
if (pongo_path != NULL) free(pongo_path);
|
}, environ);
|
||||||
pongo_path = NULL;
|
} else {
|
||||||
|
ret = posix_spawn(&pid, checkra1n_path, NULL, NULL, (char* []){
|
||||||
|
checkra1n_path,
|
||||||
|
args,
|
||||||
|
NULL
|
||||||
|
}, environ);
|
||||||
|
}
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG(LOG_FATAL, "Cannot posix spawn %s: %d (%s)", checkra1n_path, errno, strerror(errno));
|
LOG(LOG_FATAL, "Cannot posix spawn %s: %d (%s)", checkra1n_path, errno, strerror(errno));
|
||||||
if (ext_checkra1n != NULL) unlink(checkra1n_path);
|
if (ext_checkra1n != NULL) unlink(checkra1n_path);
|
||||||
@@ -129,6 +164,12 @@ checkra1n_exec: {};
|
|||||||
free(checkra1n_path);
|
free(checkra1n_path);
|
||||||
checkra1n_path = NULL;
|
checkra1n_path = NULL;
|
||||||
}
|
}
|
||||||
|
waitpid(pid, NULL, 0);
|
||||||
|
if (!external_pongo && pongo_path != NULL) {
|
||||||
|
unlink(pongo_path);
|
||||||
|
}
|
||||||
|
if (pongo_path != NULL) free(pongo_path);
|
||||||
|
pongo_path = NULL;
|
||||||
#if defined(__APPLE__) && defined(__arm64__) && (TARGET_OS_IPHONE || defined(FORCE_HELPER))
|
#if defined(__APPLE__) && defined(__arm64__) && (TARGET_OS_IPHONE || defined(FORCE_HELPER))
|
||||||
if (libcheckra1nhelper_dylib_path != NULL) {
|
if (libcheckra1nhelper_dylib_path != NULL) {
|
||||||
unlink(libcheckra1nhelper_dylib_path);
|
unlink(libcheckra1nhelper_dylib_path);
|
||||||
@@ -138,6 +179,5 @@ checkra1n_exec: {};
|
|||||||
libcheckra1nhelper_dylib_path = NULL;
|
libcheckra1nhelper_dylib_path = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
waitpid(pid, NULL, 0);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
+6
-1
@@ -15,7 +15,12 @@ unsigned char* checkra1n = NULL;
|
|||||||
unsigned int checkra1n_len = 0;
|
unsigned int checkra1n_len = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NO_BINPACK
|
#ifdef NO_OVERLAY
|
||||||
unsigned char* binpack_dmg = NULL;
|
unsigned char* binpack_dmg = NULL;
|
||||||
unsigned int binpack_dmg_len = 0;
|
unsigned int binpack_dmg_len = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NO_CUSTOM_PONGO
|
||||||
|
unsigned char* Pongo_bin = NULL;
|
||||||
|
unsigned int Pongo_bin_len = 0;
|
||||||
|
#endif
|
||||||
+2
-2
@@ -30,7 +30,7 @@
|
|||||||
#include <kerninfo.h>
|
#include <kerninfo.h>
|
||||||
|
|
||||||
pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
|
pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
#include <newt.h>
|
#include <newt.h>
|
||||||
pthread_mutex_t tui_log_mutex;
|
pthread_mutex_t tui_log_mutex;
|
||||||
newtComponent tui_log_output = NULL;
|
newtComponent tui_log_output = NULL;
|
||||||
@@ -89,7 +89,7 @@ uint64_t set_ecid_wait_for_dfu(uint64_t ecid) {
|
|||||||
return ecid;
|
return ecid;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
newtComponent get_tui_log() {
|
newtComponent get_tui_log() {
|
||||||
pthread_mutex_lock(&tui_log_mutex);
|
pthread_mutex_lock(&tui_log_mutex);
|
||||||
newtComponent ret = tui_log_output;
|
newtComponent ret = tui_log_output;
|
||||||
|
|||||||
+10
-20
@@ -11,22 +11,19 @@
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define log_debug(...) fprintf(stderr, __VA_ARGS__); fputc('\n', stderr)
|
#define log_debug(...) fprintf(stderr, __VA_ARGS__); fputc('\n', stderr)
|
||||||
#else
|
#else
|
||||||
#define log_debug(...)
|
#define log_debug(...) do {} while (0)
|
||||||
#endif
|
#endif
|
||||||
#define log_error(...) fprintf(stderr, __VA_ARGS__); fputc('\n', stderr)
|
#define log_error(...) fprintf(stderr, __VA_ARGS__); fputc('\n', stderr)
|
||||||
|
|
||||||
int lockdown_connect_handle(uint32_t handle)
|
int lockdown_connect_handle(uint32_t handle) {
|
||||||
{
|
|
||||||
int fd = usbmuxd_connect(handle, 62078);
|
int fd = usbmuxd_connect(handle, 62078);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
log_debug("Can't connect to lockownd on device #%u", handle);
|
log_debug("Can't connect to lockownd on device #%u", handle);
|
||||||
return fd;
|
|
||||||
}
|
}
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lockdown_connect_udid(const char* udid)
|
int lockdown_connect_udid(const char* udid) {
|
||||||
{
|
|
||||||
usbmuxd_device_info_t device;
|
usbmuxd_device_info_t device;
|
||||||
if (usbmuxd_get_device_by_udid(udid, &device) < 0) {
|
if (usbmuxd_get_device_by_udid(udid, &device) < 0) {
|
||||||
log_debug("Can't find device %s", udid);
|
log_debug("Can't find device %s", udid);
|
||||||
@@ -35,8 +32,7 @@ int lockdown_connect_udid(const char* udid)
|
|||||||
return lockdown_connect_handle(device.handle);
|
return lockdown_connect_handle(device.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lockdown_disconnect(int fd)
|
void lockdown_disconnect(int fd) {
|
||||||
{
|
|
||||||
usbmuxd_disconnect(fd);
|
usbmuxd_disconnect(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +52,7 @@ static const int INTEGER_NODE_SIZE = sizeof(INTEGER_NODE)-1;
|
|||||||
static const int STRING_NODE_SIZE = sizeof(STRING_NODE)-1;
|
static const int STRING_NODE_SIZE = sizeof(STRING_NODE)-1;
|
||||||
static const int ERROR_KEY_NODE_SIZE = sizeof(ERROR_KEY_NODE)-1;
|
static const int ERROR_KEY_NODE_SIZE = sizeof(ERROR_KEY_NODE)-1;
|
||||||
|
|
||||||
static void skip_ws(char** cur, char* end)
|
static void skip_ws(char** cur, char* end) {
|
||||||
{
|
|
||||||
char* p = *cur;
|
char* p = *cur;
|
||||||
while (p < end && ((*p == ' ') || (*p == '\t') || (*p == '\r') || (*p == '\n'))) {
|
while (p < end && ((*p == ' ') || (*p == '\t') || (*p == '\r') || (*p == '\n'))) {
|
||||||
p++;
|
p++;
|
||||||
@@ -65,8 +60,7 @@ static void skip_ws(char** cur, char* end)
|
|||||||
*cur = p;
|
*cur = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* _send_request_and_get_reply(int fd, const char* request, uint32_t len, uint32_t* received)
|
static char* _send_request_and_get_reply(int fd, const char* request, uint32_t len, uint32_t* received) {
|
||||||
{
|
|
||||||
uint32_t sent_bytes = 0;
|
uint32_t sent_bytes = 0;
|
||||||
usbmuxd_send(fd, request, len, &sent_bytes);
|
usbmuxd_send(fd, request, len, &sent_bytes);
|
||||||
if (sent_bytes != len) {
|
if (sent_bytes != len) {
|
||||||
@@ -100,8 +94,7 @@ static char* _send_request_and_get_reply(int fd, const char* request, uint32_t l
|
|||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lockdown_check_type(int fd, const char* type_match)
|
int lockdown_check_type(int fd, const char* type_match) {
|
||||||
{
|
|
||||||
unsigned char tmp[512];
|
unsigned char tmp[512];
|
||||||
uint32_t len = (uint32_t)snprintf((char*)tmp, 512, QUERY_TYPE_REQUEST);
|
uint32_t len = (uint32_t)snprintf((char*)tmp, 512, QUERY_TYPE_REQUEST);
|
||||||
uint32_t belen = htonl(len-4);
|
uint32_t belen = htonl(len-4);
|
||||||
@@ -119,8 +112,7 @@ int lockdown_check_type(int fd, const char* type_match)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lockdown_get_uint_value(int fd, const char* domain, const char* key, uint64_t* value)
|
int lockdown_get_uint_value(int fd, const char* domain, const char* key, uint64_t* value) {
|
||||||
{
|
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
if (domain) {
|
if (domain) {
|
||||||
@@ -159,8 +151,7 @@ int lockdown_get_uint_value(int fd, const char* domain, const char* key, uint64_
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lockdown_get_string_value(int fd, const char* domain, const char* key, char** value)
|
int lockdown_get_string_value(int fd, const char* domain, const char* key, char** value) {
|
||||||
{
|
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
if (domain) {
|
if (domain) {
|
||||||
@@ -212,8 +203,7 @@ int lockdown_get_string_value(int fd, const char* domain, const char* key, char*
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lockdown_enter_recovery(int fd)
|
int lockdown_enter_recovery(int fd) {
|
||||||
{
|
|
||||||
char tmp[512];
|
char tmp[512];
|
||||||
uint32_t len = (uint32_t)snprintf(tmp, 512, ENTER_RECOVERY_REQUEST);
|
uint32_t len = (uint32_t)snprintf(tmp, 512, ENTER_RECOVERY_REQUEST);
|
||||||
*(uint32_t*)&tmp = htonl(len-4);
|
*(uint32_t*)&tmp = htonl(len-4);
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxname, const char *__restrict format, ...)
|
int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxname, const char *__restrict format, ...)
|
||||||
{
|
{
|
||||||
if (verbose >= 5
|
if (verbose >= 5
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
&& !checkrain_option_enabled(host_flags, host_option_tui)
|
&& !checkrain_options_enabled(host_flags, host_option_tui)
|
||||||
#endif
|
#endif
|
||||||
) fprintf(stderr, "p1_log: loglevel %d from %s:%d:%s()\n", loglevel, fname, lineno, fxname);
|
) fprintf(stderr, "p1_log: loglevel %d from %s:%d:%s()\n", loglevel, fname, lineno, fxname);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -23,7 +23,7 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
|
|||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
if (verbose < (loglevel - 3) && loglevel > LOG_INFO) {
|
if (verbose < (loglevel - 3) && loglevel > LOG_INFO) {
|
||||||
if (verbose >= 5
|
if (verbose >= 5
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
&& !tui_started
|
&& !tui_started
|
||||||
#endif
|
#endif
|
||||||
) fprintf(stderr, "p1_log: hid log with high log level (%d < %d)\n", verbose, loglevel - 3);
|
) fprintf(stderr, "p1_log: hid log with high log level (%d < %d)\n", verbose, loglevel - 3);
|
||||||
@@ -57,12 +57,12 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
|
|||||||
snprintf(colour_bold, 0x10, "%s", BWHT);
|
snprintf(colour_bold, 0x10, "%s", BWHT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (checkrain_option_enabled(host_flags, host_option_no_colors)) {
|
if (checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||||
colour[0] = '\0';
|
colour[0] = '\0';
|
||||||
colour_bold[0] = '\0';
|
colour_bold[0] = '\0';
|
||||||
}
|
}
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
if (checkrain_option_enabled(host_flags, host_option_tui) && tui_started) {
|
if (checkrain_options_enabled(host_flags, host_option_tui) && tui_started) {
|
||||||
newtComponent co = get_tui_log();
|
newtComponent co = get_tui_log();
|
||||||
if (co == NULL) {
|
if (co == NULL) {
|
||||||
return 0; /* 0 bytes printed */
|
return 0; /* 0 bytes printed */
|
||||||
@@ -79,26 +79,26 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
|
|||||||
time_t curtime;
|
time_t curtime;
|
||||||
time(&curtime);
|
time(&curtime);
|
||||||
struct tm* timeinfo = localtime(&curtime);
|
struct tm* timeinfo = localtime(&curtime);
|
||||||
if (!checkrain_option_enabled(host_flags, host_option_no_colors))
|
if (!checkrain_options_enabled(host_flags, host_option_no_colors))
|
||||||
snprintf(timestring, 0x80, "%s[%s%02d/%02d/%d %02d:%02d:%02d%s]", CRESET, HBLK, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, CRESET);
|
snprintf(timestring, 0x80, "%s[%s%02d/%02d/%d %02d:%02d:%02d%s]", CRESET, HBLK, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, CRESET);
|
||||||
else
|
else
|
||||||
snprintf(timestring, 0x80, "[%02d/%02d/%d %02d:%02d:%02d]", timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
|
snprintf(timestring, 0x80, "[%02d/%02d/%d %02d:%02d:%02d]", timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
|
||||||
if (verbose >= 2 && !checkrain_option_enabled(host_flags, host_option_no_colors)) {
|
if (verbose >= 2 && !checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||||
printf("%s| - %s%s <%s> " CRESET "%s" HBLU "%s" CRESET ":" BLU "%d" CRESET ":" BMAG "%s()" CRESET ": \n%s| ----> ", colour_bold, timestring, colour_bold, type, WHT, fname, lineno, fxname, colour_bold);
|
printf("%s| - %s%s <%s> " CRESET "%s" HBLU "%s" CRESET ":" BLU "%d" CRESET ":" BMAG "%s()" CRESET ": \n%s| ----> ", colour_bold, timestring, colour_bold, type, WHT, fname, lineno, fxname, colour_bold);
|
||||||
} else if (!checkrain_option_enabled(host_flags, host_option_no_colors)) {
|
} else if (!checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||||
printf(" - %s %s<%s>%s: ", timestring, colour_bold, type, CRESET);
|
printf(" - %s %s<%s>%s: ", timestring, colour_bold, type, CRESET);
|
||||||
} else if (verbose >= 2 && checkrain_option_enabled(host_flags, host_option_no_colors)) {
|
} else if (verbose >= 2 && checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||||
printf("%s| - %s%s <%s> %s:%d:%s(): \n%s| ----> ", colour_bold, timestring, colour_bold, type, fname, lineno, fxname, colour_bold);
|
printf("%s| - %s%s <%s> %s:%d:%s(): \n%s| ----> ", colour_bold, timestring, colour_bold, type, fname, lineno, fxname, colour_bold);
|
||||||
} else if (checkrain_option_enabled(host_flags, host_option_no_colors)) {
|
} else if (checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||||
printf(" - %s %s<%s>: ", timestring, colour_bold, type);
|
printf(" - %s %s<%s>: ", timestring, colour_bold, type);
|
||||||
}
|
}
|
||||||
printf("%s", colour);
|
printf("%s", colour);
|
||||||
ret = vprintf(format, args);
|
ret = vprintf(format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (verbose < 2 && !checkrain_option_enabled(host_flags, host_option_no_colors))
|
if (verbose < 2 && !checkrain_options_enabled(host_flags, host_option_no_colors))
|
||||||
printf(CRESET "\n");
|
printf(CRESET "\n");
|
||||||
else if (!checkrain_option_enabled(host_flags, host_option_no_colors))
|
else if (!checkrain_options_enabled(host_flags, host_option_no_colors))
|
||||||
printf("\n%s-%s\n", colour, CRESET);
|
printf("\n%s-%s\n", colour, CRESET);
|
||||||
else if (verbose < 2)
|
else if (verbose < 2)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|||||||
+14
-17
@@ -72,9 +72,8 @@ int build_checks(void) {
|
|||||||
if (checkra1n_len <= (UCHAR_MAX + 1)) {
|
if (checkra1n_len <= (UCHAR_MAX + 1)) {
|
||||||
LOG(LOG_FATAL, "checkra1n too small");
|
LOG(LOG_FATAL, "checkra1n too small");
|
||||||
}
|
}
|
||||||
if (boyermoore_horspool_memmem(&checkra1n[0], checkra1n_len, (const unsigned char*)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL) {
|
if (boyermoore_horspool_memmem(&checkra1n[0], checkra1n_len, (const unsigned char *)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL) {
|
||||||
host_flags |= palerain_option_checkrain_is_clone;
|
host_flags |= palerain_option_checkrain_is_clone;
|
||||||
LOG(LOG_WARNING, "Do not distribute!");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef NO_KPF
|
#ifndef NO_KPF
|
||||||
@@ -82,8 +81,7 @@ int build_checks(void) {
|
|||||||
if (kpf_hdr->magic != MH_MAGIC_64 && kpf_hdr->magic != MH_CIGAM_64) {
|
if (kpf_hdr->magic != MH_MAGIC_64 && kpf_hdr->magic != MH_CIGAM_64) {
|
||||||
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: Not thin 64-bit Mach-O");
|
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: Not thin 64-bit Mach-O");
|
||||||
return -1;
|
return -1;
|
||||||
} else
|
} else if (kpf_hdr->filetype != MH_KEXT_BUNDLE) {
|
||||||
if (kpf_hdr->filetype != MH_KEXT_BUNDLE) {
|
|
||||||
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: Not a kext bundle");
|
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: Not a kext bundle");
|
||||||
return -1;
|
return -1;
|
||||||
} else if (kpf_hdr->cputype != CPU_TYPE_ARM64) {
|
} else if (kpf_hdr->cputype != CPU_TYPE_ARM64) {
|
||||||
@@ -94,7 +92,7 @@ int build_checks(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
bool tui_started = false;
|
bool tui_started = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -113,10 +111,9 @@ int palera1n(int argc, char *argv[]) {
|
|||||||
pthread_mutex_init(&ecid_dfu_wait_mutex, NULL);
|
pthread_mutex_init(&ecid_dfu_wait_mutex, NULL);
|
||||||
if ((ret = build_checks())) return ret;
|
if ((ret = build_checks())) return ret;
|
||||||
if ((ret = optparse(argc, argv))) goto cleanup;
|
if ((ret = optparse(argc, argv))) goto cleanup;
|
||||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
if (!checkrain_options_enabled(host_flags, host_option_device_info) && checkrain_options_enabled(host_flags, host_option_palerain_version)) goto normal_exit;
|
||||||
if (checkrain_option_enabled(host_flags, host_option_palerain_version)) goto normal_exit;
|
#ifdef TUI
|
||||||
#ifdef DEV_BUILD
|
if (checkrain_options_enabled(host_flags, host_option_tui)) {
|
||||||
if (checkrain_option_enabled(host_flags, host_option_tui)) {
|
|
||||||
ret = tui();
|
ret = tui();
|
||||||
if (ret) goto cleanup;
|
if (ret) goto cleanup;
|
||||||
else goto normal_exit;
|
else goto normal_exit;
|
||||||
@@ -136,7 +133,7 @@ int palera1n(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||||
LOG(LOG_INFO, "Waiting for devices");
|
LOG(LOG_INFO, "Waiting for devices");
|
||||||
|
|
||||||
if (access("/var/run/usbmuxd", F_OK) != 0)
|
if (access("/var/run/usbmuxd", F_OK) != 0)
|
||||||
@@ -146,16 +143,16 @@ int palera1n(int argc, char *argv[]) {
|
|||||||
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
|
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
|
||||||
pthread_join(dfuhelper_thread, NULL);
|
pthread_join(dfuhelper_thread, NULL);
|
||||||
set_spin(0);
|
set_spin(0);
|
||||||
if (checkrain_option_enabled(host_flags, host_option_dfuhelper_only) ||
|
if (checkrain_options_enabled(host_flags, host_option_dfuhelper_only |
|
||||||
checkrain_option_enabled(host_flags, host_option_reboot_device) ||
|
host_option_reboot_device |
|
||||||
checkrain_option_enabled(host_flags, host_option_exit_recovery) ||
|
host_option_exit_recovery |
|
||||||
checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
|
host_option_enter_recovery |
|
||||||
checkrain_option_enabled(host_flags, host_option_device_info) ||
|
host_option_device_info
|
||||||
device_has_booted)
|
) || device_has_booted)
|
||||||
goto normal_exit;
|
goto normal_exit;
|
||||||
if (exec_checkra1n()) goto cleanup;
|
if (exec_checkra1n()) goto cleanup;
|
||||||
|
|
||||||
if (checkrain_option_enabled(host_flags, host_option_pongo_exit) || checkrain_option_enabled(host_flags, host_option_demote))
|
if (checkrain_options_enabled(host_flags, host_option_pongo_exit | host_option_demote))
|
||||||
goto normal_exit;
|
goto normal_exit;
|
||||||
set_spin(1);
|
set_spin(1);
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
|||||||
+46
-23
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
checkrain_option_t host_flags = 0;
|
checkrain_option_t host_flags = 0;
|
||||||
checkrain_option_p host_flags_p = &host_flags;
|
checkrain_option_p host_flags_p = &host_flags;
|
||||||
|
static bool force_use_verbose_boot = false;
|
||||||
|
|
||||||
static struct option longopts[] = {
|
static struct option longopts[] = {
|
||||||
{"setup-partial-fakefs", no_argument, NULL, 'B'},
|
{"setup-partial-fakefs", no_argument, NULL, 'B'},
|
||||||
@@ -47,6 +48,8 @@ static struct option longopts[] = {
|
|||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
{"test1", no_argument, NULL, '1'},
|
{"test1", no_argument, NULL, '1'},
|
||||||
{"test2", no_argument, NULL, '2'},
|
{"test2", no_argument, NULL, '2'},
|
||||||
|
#endif
|
||||||
|
#ifdef TUI
|
||||||
{"tui", no_argument, NULL, 't'},
|
{"tui", no_argument, NULL, 't'},
|
||||||
#endif
|
#endif
|
||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
@@ -55,27 +58,37 @@ static struct option longopts[] = {
|
|||||||
static int usage(int e, char* prog_name)
|
static int usage(int e, char* prog_name)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
"Usage: %s [-"
|
||||||
|
"DEhpvVldsSLRnPI"
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
"Usage: %s [-12cCdDEfhIlLnOpRsStvV]"
|
"12"
|
||||||
#else
|
|
||||||
"Usage: %s [-cCdDEfhIlLnOpRsSvV]"
|
|
||||||
#endif
|
#endif
|
||||||
" [-e boot arguments] [-k Pongo image] [-o overlay file] [-r ramdisk file] [-K KPF file] [-i checkra1n file]\n"
|
#ifdef ROOTFUL
|
||||||
|
"cfB"
|
||||||
|
#endif
|
||||||
|
#ifdef TUI
|
||||||
|
"t"
|
||||||
|
#endif
|
||||||
|
"] [-e boot arguments] [-k Pongo image] [-o overlay file] [-r ramdisk file] [-K KPF file] [-i checkra1n file]\n"
|
||||||
"Copyright (C) 2023, palera1n team, All Rights Reserved.\n\n"
|
"Copyright (C) 2023, palera1n team, All Rights Reserved.\n\n"
|
||||||
"iOS/iPadOS 15.0-16.3.1 arm64 jailbreaking tool\n\n"
|
"iOS/iPadOS 15.0-16.4.1 arm64 jailbreaking tool\n\n"
|
||||||
"\t--version\t\t\t\tPrint version\n"
|
"\t--version\t\t\t\tPrint version\n"
|
||||||
"\t--force-revert\t\t\t\tRemove jailbreak\n"
|
"\t--force-revert\t\t\t\tRemove jailbreak\n"
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
"\t-1, --test1\t\t\t\tSet palerain_option_test1\n"
|
"\t-1, --test1\t\t\t\tSet palerain_option_test1\n"
|
||||||
"\t-2, --test2\t\t\t\tSet palerain_option_test2\n"
|
"\t-2, --test2\t\t\t\tSet palerain_option_test2\n"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ROOTFUL
|
||||||
"\t-B, --setup-partial-fakefs\t\tSetup partial fakefs\n"
|
"\t-B, --setup-partial-fakefs\t\tSetup partial fakefs\n"
|
||||||
"\t-c, --setup-fakefs\t\t\tSetup fakefs\n"
|
"\t-c, --setup-fakefs\t\t\tSetup fakefs\n"
|
||||||
|
#endif
|
||||||
"\t-d, --demote\t\t\t\tDemote\n"
|
"\t-d, --demote\t\t\t\tDemote\n"
|
||||||
"\t-D, --dfuhelper\t\t\tExit after entering DFU\n"
|
"\t-D, --dfuhelper\t\t\t\tExit after entering DFU\n"
|
||||||
"\t-e, --boot-args <boot arguments>\tXNU boot arguments\n"
|
"\t-e, --boot-args <boot arguments>\tXNU boot arguments\n"
|
||||||
"\t-E, --enter-recovery\t\t\tEnter recovery mode\n"
|
"\t-E, --enter-recovery\t\t\tEnter recovery mode\n"
|
||||||
|
#ifdef ROOTFUL
|
||||||
"\t-f, --fakefs \t\t\t\tBoots fakefs\n"
|
"\t-f, --fakefs \t\t\t\tBoots fakefs\n"
|
||||||
|
#endif
|
||||||
"\t-h, --help\t\t\t\tShow this help\n"
|
"\t-h, --help\t\t\t\tShow this help\n"
|
||||||
"\t-i, --override-checkra1n <file>\t\tOverride checkra1n\n"
|
"\t-i, --override-checkra1n <file>\t\tOverride checkra1n\n"
|
||||||
"\t-k, --override-pongo <file>\t\tOverride Pongo image\n"
|
"\t-k, --override-pongo <file>\t\tOverride Pongo image\n"
|
||||||
@@ -90,12 +103,12 @@ static int usage(int e, char* prog_name)
|
|||||||
"\t-r, --override-ramdisk <file>\t\tOverride ramdisk\n"
|
"\t-r, --override-ramdisk <file>\t\tOverride ramdisk\n"
|
||||||
"\t-R, --reboot-device\t\t\tReboot connected device in normal mode\n"
|
"\t-R, --reboot-device\t\t\tReboot connected device in normal mode\n"
|
||||||
"\t-s, --safe-mode\t\t\t\tEnter safe mode\n"
|
"\t-s, --safe-mode\t\t\t\tEnter safe mode\n"
|
||||||
"\t-S, --no-colors\t\t\tDisable colors on the command line\n"
|
"\t-S, --no-colors\t\t\t\tDisable colors on the command line\n"
|
||||||
"\t-v, --debug-logging\t\t\tEnable debug logging\n"
|
"\t-v, --debug-logging\t\t\tEnable debug logging\n"
|
||||||
"\t\tThis option can be repeated for extra verbosity.\n"
|
"\t\tThis option can be repeated for extra verbosity.\n"
|
||||||
"\t-V, --verbose-boot\t\t\tVerbose boot\n"
|
"\t-V, --verbose-boot\t\t\tVerbose boot\n"
|
||||||
|
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
"\t-t, --tui\t\t\t\tTerminal user interface\n"
|
"\t-t, --tui\t\t\t\tTerminal user interface\n"
|
||||||
#endif
|
#endif
|
||||||
"\nEnvironmental variables:\n"
|
"\nEnvironmental variables:\n"
|
||||||
@@ -108,13 +121,13 @@ static int usage(int e, char* prog_name)
|
|||||||
int optparse(int argc, char* argv[]) {
|
int optparse(int argc, char* argv[]) {
|
||||||
int opt;
|
int opt;
|
||||||
int index;
|
int index;
|
||||||
while ((opt = getopt_long(argc, argv,
|
while ((opt = getopt_long(argc, argv,
|
||||||
|
"DEhpvVldsSLtRnPIe:o:r:K:k:i:"
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
"12BcDEhpvVldsSLftRnPIe:o:r:K:k:i:",
|
"12"
|
||||||
#else
|
|
||||||
"BcDEhpvVldsSLfRnPIe:o:r:K:k:i:",
|
|
||||||
#endif
|
#endif
|
||||||
longopts, NULL)) != -1)
|
"fcB"
|
||||||
|
,longopts, NULL)) != -1)
|
||||||
{
|
{
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'B':
|
case 'B':
|
||||||
@@ -143,6 +156,7 @@ int optparse(int argc, char* argv[]) {
|
|||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
kpf_flags |= checkrain_option_verbose_boot;
|
kpf_flags |= checkrain_option_verbose_boot;
|
||||||
|
force_use_verbose_boot = true;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
if (strstr(optarg, "rootdev=") != NULL) {
|
if (strstr(optarg, "rootdev=") != NULL) {
|
||||||
@@ -213,7 +227,7 @@ int optparse(int argc, char* argv[]) {
|
|||||||
} else if (!(st.st_mode & S_IXUSR) && !(st.st_mode & S_IXGRP) && !(st.st_mode & S_IXOTH)) {
|
} else if (!(st.st_mode & S_IXUSR) && !(st.st_mode & S_IXGRP) && !(st.st_mode & S_IXOTH)) {
|
||||||
LOG(LOG_FATAL, "%s is not executable", optarg);
|
LOG(LOG_FATAL, "%s is not executable", optarg);
|
||||||
return -1;
|
return -1;
|
||||||
} else if (!(st.st_mode & S_IFREG)) {
|
} else if (!S_ISREG(st.st_mode)) {
|
||||||
LOG(LOG_FATAL, "%s is not a regular file", optarg);
|
LOG(LOG_FATAL, "%s is not a regular file", optarg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -258,10 +272,12 @@ int optparse(int argc, char* argv[]) {
|
|||||||
case 'S':
|
case 'S':
|
||||||
host_flags |= host_option_no_colors;
|
host_flags |= host_option_no_colors;
|
||||||
break;
|
break;
|
||||||
#ifdef DEV_BUILD
|
#ifdef TUI
|
||||||
case 't':
|
case 't':
|
||||||
host_flags |= host_option_tui;
|
host_flags |= host_option_tui;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef DEV_BUILD
|
||||||
case '1':
|
case '1':
|
||||||
palerain_flags |= palerain_option_test1;
|
palerain_flags |= palerain_option_test1;
|
||||||
break;
|
break;
|
||||||
@@ -280,7 +296,7 @@ int optparse(int argc, char* argv[]) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (checkrain_option_enabled(host_flags, host_option_palerain_version)) {
|
if (checkrain_options_enabled(host_flags, host_option_palerain_version)) {
|
||||||
printf(
|
printf(
|
||||||
"palera1n " PALERAIN_VERSION "\n"
|
"palera1n " PALERAIN_VERSION "\n"
|
||||||
BUILD_COMMIT " " BUILD_NUMBER " (" BUILD_BRANCH ")\n\n"
|
BUILD_COMMIT " " BUILD_NUMBER " (" BUILD_BRANCH ")\n\n"
|
||||||
@@ -293,10 +309,15 @@ int optparse(int argc, char* argv[]) {
|
|||||||
#else
|
#else
|
||||||
"USB backend: IOKit\n"
|
"USB backend: IOKit\n"
|
||||||
#endif
|
#endif
|
||||||
|
"Build options: " BUILD_OPTIONS "\n"
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((strstr(xargs_cmd, "serial=") != NULL) && !force_use_verbose_boot && checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
||||||
|
kpf_flags &= ~checkrain_option_verbose_boot;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(checkrain_flags_cmd, 0x20, "checkra1n_flags 0x%x", checkrain_flags);
|
snprintf(checkrain_flags_cmd, 0x20, "checkra1n_flags 0x%x", checkrain_flags);
|
||||||
snprintf(palerain_flags_cmd, 0x20, "palera1n_flags 0x%x", palerain_flags);
|
snprintf(palerain_flags_cmd, 0x20, "palera1n_flags 0x%x", palerain_flags);
|
||||||
snprintf(kpf_flags_cmd, 0x20, "kpf_flags 0x%x", kpf_flags);
|
snprintf(kpf_flags_cmd, 0x20, "kpf_flags 0x%x", kpf_flags);
|
||||||
@@ -317,17 +338,17 @@ int optparse(int argc, char* argv[]) {
|
|||||||
LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload);
|
LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!checkrain_option_enabled(palerain_flags, palerain_option_rootful)) {
|
if (!checkrain_options_enabled(palerain_flags, palerain_option_rootful)) {
|
||||||
if (checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful) || checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful_forced)) {
|
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful) || checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful_forced)) {
|
||||||
LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode.");
|
LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(
|
if (!(
|
||||||
checkrain_option_enabled(host_flags, host_option_dfuhelper_only) ||
|
checkrain_options_enabled(host_flags, host_option_dfuhelper_only) ||
|
||||||
checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
|
checkrain_options_enabled(host_flags, host_option_enter_recovery) ||
|
||||||
checkrain_option_enabled(host_flags, host_option_exit_recovery) ||
|
checkrain_options_enabled(host_flags, host_option_exit_recovery) ||
|
||||||
checkrain_option_enabled(host_flags, host_option_reboot_device)))
|
checkrain_options_enabled(host_flags, host_option_reboot_device)))
|
||||||
{
|
{
|
||||||
#ifdef NO_CHECKRAIN
|
#ifdef NO_CHECKRAIN
|
||||||
if (checkra1n_len == 0 && ext_checkra1n == NULL)
|
if (checkra1n_len == 0 && ext_checkra1n == NULL)
|
||||||
@@ -335,7 +356,7 @@ int optparse(int argc, char* argv[]) {
|
|||||||
LOG(LOG_FATAL, "checkra1n omitted in build but no override specified");
|
LOG(LOG_FATAL, "checkra1n omitted in build but no override specified");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!(checkrain_option_enabled(host_flags, host_option_pongo_exit) || checkrain_option_enabled(host_flags, host_option_pongo_exit)))
|
if (!(checkrain_options_enabled(host_flags, host_option_pongo_exit) || checkrain_options_enabled(host_flags, host_option_pongo_exit)))
|
||||||
{
|
{
|
||||||
#ifdef NO_KPF
|
#ifdef NO_KPF
|
||||||
if (checkra1n_kpf_pongo_len == 0)
|
if (checkra1n_kpf_pongo_len == 0)
|
||||||
@@ -364,8 +385,10 @@ int optparse(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (verbose >= 2) setenv("LIBUSB_DEBUG", "1", 1);
|
if (verbose >= 2) setenv("LIBUSB_DEBUG", "1", 1);
|
||||||
|
|
||||||
if (verbose >= 3)
|
if (verbose >= 3)
|
||||||
{
|
{
|
||||||
|
libusbmuxd_set_debug_level(verbose - 2);
|
||||||
irecv_set_debug_level(1);
|
irecv_set_debug_level(1);
|
||||||
setenv("LIBUSB_DEBUG", "2", 1);
|
setenv("LIBUSB_DEBUG", "2", 1);
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-11
@@ -29,15 +29,15 @@ void* pongo_helper(void* ptr) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *pongo_usb_callback(void *arg) {
|
void *pongo_usb_callback(stuff_t *arg) {
|
||||||
if (get_found_pongo())
|
if (get_found_pongo())
|
||||||
return NULL;
|
return NULL;
|
||||||
set_found_pongo(1);
|
set_found_pongo(1);
|
||||||
if (checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
||||||
strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1);
|
strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1);
|
||||||
}
|
}
|
||||||
LOG(LOG_INFO, "Found PongoOS USB Device");
|
LOG(LOG_INFO, "Found PongoOS USB Device");
|
||||||
usb_device_handle_t handle = (((stuff_t *)arg)->handle);
|
usb_device_handle_t handle = arg->handle;
|
||||||
issue_pongo_command(handle, NULL);
|
issue_pongo_command(handle, NULL);
|
||||||
issue_pongo_command(handle, "fuse lock");
|
issue_pongo_command(handle, "fuse lock");
|
||||||
issue_pongo_command(handle, "sep auto");
|
issue_pongo_command(handle, "sep auto");
|
||||||
@@ -46,7 +46,7 @@ void *pongo_usb_callback(void *arg) {
|
|||||||
issue_pongo_command(handle, kpf_flags_cmd);
|
issue_pongo_command(handle, kpf_flags_cmd);
|
||||||
issue_pongo_command(handle, checkrain_flags_cmd);
|
issue_pongo_command(handle, checkrain_flags_cmd);
|
||||||
issue_pongo_command(handle, palerain_flags_cmd);
|
issue_pongo_command(handle, palerain_flags_cmd);
|
||||||
if (checkrain_option_enabled(palerain_flags, palerain_option_rootful))
|
if (checkrain_options_enabled(palerain_flags, palerain_option_rootful))
|
||||||
{
|
{
|
||||||
issue_pongo_command(handle, "rootfs");
|
issue_pongo_command(handle, "rootfs");
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ void *pongo_usb_callback(void *arg) {
|
|||||||
upload_pongo_file(handle, **ramdisk_to_upload, ramdisk_dmg_len);
|
upload_pongo_file(handle, **ramdisk_to_upload, ramdisk_dmg_len);
|
||||||
issue_pongo_command(handle, "ramdisk");
|
issue_pongo_command(handle, "ramdisk");
|
||||||
}
|
}
|
||||||
#ifdef NO_BINPACK
|
#ifdef NO_OVERLAY
|
||||||
if (binpack_dmg_len != 0)
|
if (binpack_dmg_len != 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -66,13 +66,13 @@ void *pongo_usb_callback(void *arg) {
|
|||||||
issue_pongo_command(handle, "overlay");
|
issue_pongo_command(handle, "overlay");
|
||||||
}
|
}
|
||||||
issue_pongo_command(handle, xargs_cmd);
|
issue_pongo_command(handle, xargs_cmd);
|
||||||
if (checkrain_option_enabled(host_flags, host_option_pongo_full)) goto done;
|
if (checkrain_options_enabled(host_flags, host_option_pongo_full)) goto done;
|
||||||
issue_pongo_command(handle, "bootx");
|
issue_pongo_command(handle, "bootx");
|
||||||
LOG(LOG_INFO, "Booting Kernel...");
|
LOG(LOG_INFO, "Booting Kernel...");
|
||||||
if (checkrain_option_enabled(palerain_flags, palerain_option_setup_partial_root)) {
|
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_partial_root)) {
|
||||||
LOG(LOG_INFO, "Please wait up to 5 minutes for the bindfs to be created.");
|
LOG(LOG_INFO, "Please wait up to 5 minutes for the bindfs to be created.");
|
||||||
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -B (Create BindFS) option to jailbreak.");
|
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -B (Create BindFS) option to jailbreak.");
|
||||||
} else if (checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
} else if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
||||||
LOG(LOG_INFO, "Please wait up to 10 minutes for the fakefs to be created.");
|
LOG(LOG_INFO, "Please wait up to 10 minutes for the fakefs to be created.");
|
||||||
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -c (Create FakeFS) option to jailbreak.");
|
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -c (Create FakeFS) option to jailbreak.");
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ void *pongo_usb_callback(void *arg) {
|
|||||||
done:
|
done:
|
||||||
device_has_booted = true;
|
device_has_booted = true;
|
||||||
#ifdef USE_LIBUSB
|
#ifdef USE_LIBUSB
|
||||||
libusb_unref_device(((stuff_t *)arg)->dev);
|
libusb_unref_device(arg->dev);
|
||||||
#endif
|
#endif
|
||||||
set_spin(0);
|
set_spin(0);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -163,7 +163,7 @@ int upload_pongo_file(usb_device_handle_t handle, unsigned char *buf, unsigned i
|
|||||||
if (verbose < 3 || verbose > 4) {
|
if (verbose < 3 || verbose > 4) {
|
||||||
LOG(LOG_VERBOSE, "Uploaded %llu bytes to PongoOS", (unsigned long long)buf_len);
|
LOG(LOG_VERBOSE, "Uploaded %llu bytes to PongoOS", (unsigned long long)buf_len);
|
||||||
} else {
|
} else {
|
||||||
if (checkrain_option_enabled(host_flags, host_option_no_colors))
|
if (checkrain_options_enabled(host_flags, host_option_no_colors))
|
||||||
printf("/send mem:%p:%p\nUploaded %llu bytes]\n", (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
|
printf("/send mem:%p:%p\nUploaded %llu bytes]\n", (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
|
||||||
else
|
else
|
||||||
printf("/send mem:%p:%p\n" BCYN "[Uploaded %llu bytes]\n" CRESET, (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
|
printf("/send mem:%p:%p\n" BCYN "[Uploaded %llu bytes]\n" CRESET, (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
|
||||||
@@ -176,7 +176,7 @@ int upload_pongo_file(usb_device_handle_t handle, unsigned char *buf, unsigned i
|
|||||||
|
|
||||||
void io_start(stuff_t *stuff)
|
void io_start(stuff_t *stuff)
|
||||||
{
|
{
|
||||||
int r = pthread_create(&stuff->th, NULL, &pongo_usb_callback, stuff);
|
int r = pthread_create(&stuff->th, NULL, (pthread_start_t)pongo_usb_callback, stuff);
|
||||||
if(r != 0)
|
if(r != 0)
|
||||||
{
|
{
|
||||||
ERR("pthread_create: %s", strerror(r));
|
ERR("pthread_create: %s", strerror(r));
|
||||||
|
|||||||
Reference in new issue
Block a user