mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 17:57:01 +02:00
Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e61ae40291 | ||
|
|
48bd5dccc2 | ||
|
|
310e0313d3 | ||
|
|
0b95d8ad44 | ||
|
|
91d17c2422 | ||
|
|
aad7a4bc05 | ||
|
|
2e483568b0 | ||
|
|
a74c5a1236 | ||
|
|
131bba04b6 | ||
|
|
20f5c3c987 | ||
|
|
07578558a2 | ||
|
|
e811c9c0f9 | ||
|
|
98a9310d25 | ||
|
|
7439d7f9eb | ||
|
|
fc77488b6d | ||
|
|
8590c9a054 | ||
|
|
fcc34b920d | ||
|
|
2133f2f94f | ||
|
|
aace97112f | ||
|
|
df68b2910e | ||
|
|
8a912898c9 |
No files matched your search
+280
-121
@@ -11,14 +11,6 @@ on:
|
||||
- 'CMakeLists.txt'
|
||||
- '.github/workflows/build.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'docs/**'
|
||||
- 'patches/**'
|
||||
- 'include/**'
|
||||
- 'Makefile'
|
||||
- 'CMakeLists.txt'
|
||||
- '.github/workflows/build.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -52,6 +44,236 @@ jobs:
|
||||
localDir: 'ready/'
|
||||
remoteDir: '/palera1n/artifacts/c-rewrite'
|
||||
|
||||
build-loader:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Get loader commit
|
||||
run: echo "LOADER_COMMIT=$(git -C src/loader rev-parse HEAD)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache compile
|
||||
id: loader_cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: src/loader/packages
|
||||
key: loader-${{ env.LOADER_COMMIT }}
|
||||
|
||||
- name: Install dependencies (packages)
|
||||
if: steps.loader_cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
curl -LO https://github.com/ProcursusTeam/ldid/releases/download/v2.1.5-procursus7/ldid_macosx_x86_64
|
||||
sudo install -m755 ldid_macosx_x86_64 /usr/local/bin/ldid
|
||||
|
||||
- name: Compile
|
||||
if: steps.loader_cache.outputs.cache-hit != 'true'
|
||||
run: make -C src/loader
|
||||
|
||||
- name: Upload loader
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: palera1n.ipa
|
||||
path: src/loader/packages/palera1n.ipa
|
||||
retention-days: 1
|
||||
|
||||
build-binpack:
|
||||
needs: build-loader
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- name: Cache Procursus
|
||||
uses: actions/cache@v3
|
||||
id: procache
|
||||
with:
|
||||
path: |
|
||||
~/__cache
|
||||
key: ${{ runner.os }}-procursus
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Get binpack commit
|
||||
run: echo "BINPACK_COMMIT=$(git -C src/binpack rev-parse HEAD)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache binpack.tgz
|
||||
uses: actions/cache@v3
|
||||
id: binpack_cache
|
||||
with:
|
||||
path: src/jbinit/binpack.tgz
|
||||
key: binpack-${{ env.BINPACK_COMMIT }}
|
||||
|
||||
- name: Download loader
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: palera1n.ipa
|
||||
path: src/jbinit/palera1n.ipa
|
||||
|
||||
- name: Checkout Procursus
|
||||
if: steps.binpack_cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ProcursusTeam/Procursus
|
||||
path: src/Procursus
|
||||
|
||||
- name: Setup Procursus Bootstrap (install)
|
||||
if: steps.procache.outputs.cache-hit != 'true' && steps.binpack_cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
wget https://apt.procurs.us/bootstraps/big_sur/bootstrap-darwin-amd64.tar.zst
|
||||
sudo gtar --preserve-permissions -xkf ./bootstrap-darwin-amd64.tar.zst -C /
|
||||
echo '/opt/procursus/sbin:/opt/procursus/bin' >> $GITHUB_PATH
|
||||
PATH=/opt/procursus/sbin:/opt/procursus/bin:$PATH sudo /opt/procursus/bin/apt update
|
||||
sudo /opt/procursus/bin/apt -V full-upgrade -y || :
|
||||
sudo /opt/procursus/bin/apt install asciidoc autoconf autoconf-archive automake autopoint bash bison cmake docbook-xml docbook-xsl fakeroot findutils flex file gawk git gnupg gpgrt-tools groff gzip ldid libtool libltdl-dev llvm make ncurses-bin openssl patch pkg-config po4a python3 sed tar triehash wget xz-utils zstd -y
|
||||
|
||||
- name: Add Procursus to PATH
|
||||
if: steps.binpack_cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
echo '/opt/procursus/sbin:/opt/procursus/bin' >> $GITHUB_PATH
|
||||
|
||||
- name: Setup Procursus Bootstrap (cache)
|
||||
if: steps.procache.outputs.cache-hit == 'true' && steps.binpack_cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
sudo mkdir -p ~/__cache/procursus/var/cache/apt/archives/partial ~/__cache/procursus/var/lib/apt/lists/partial
|
||||
sudo rsync -aP ~/__cache/procursus /opt
|
||||
sudo /opt/procursus/bin/apt update
|
||||
sudo /opt/procursus/bin/apt --allow-downgrades -V dist-upgrade -y
|
||||
sudo /opt/procursus/bin/apt --allow-downgrades -V dist-upgrade -y
|
||||
|
||||
- name: Build binpack
|
||||
if: steps.binpack_cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd src/binpack
|
||||
gmake MEMO_CFVER=1800 MEMO_PREFIX=/cores/binpack MEMO_TARGET=iphoneos-arm64 binpack
|
||||
cd ../..
|
||||
|
||||
- name: Process binpack.tar into binpack.tgz
|
||||
if: steps.binpack_cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd src/jbinit
|
||||
cp ../binpack/build_strap/iphoneos-arm64/1800/binpack.tar .
|
||||
sudo tar --preserve-permissions -xf binpack.tar
|
||||
sudo cp -R cores/binpack .
|
||||
sudo chown $UID:$GID .
|
||||
sudo mkdir -p binpack/Library/LaunchDaemons
|
||||
sudo sed 's|/binpack|/cores/binpack|' binpack/usr/share/dropbear.plist.example | sudo tee binpack/Library/LaunchDaemons/dropbear.plist
|
||||
sudo rm -rf binpack/usr/share/dropbear.plist.example
|
||||
sudo plutil -convert binary1 binpack/Library/LaunchDaemons/dropbear.plist
|
||||
sudo chown 0:0 binpack/Library/LaunchDaemons/dropbear.plist
|
||||
sudo gchmod 755 -R binpack/Library
|
||||
sudo gchmod 644 binpack/Library/LaunchDaemons/dropbear.plist
|
||||
tar -zcf binpack.tgz binpack
|
||||
cd ../..
|
||||
|
||||
- name: Generate binpack.dmg
|
||||
run: |
|
||||
cd src/jbinit
|
||||
sudo gmake binpack.dmg
|
||||
cd ../..
|
||||
|
||||
- name: Upload binpack
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: binpack.dmg
|
||||
path: src/jbinit/binpack.dmg
|
||||
retention-days: 1
|
||||
|
||||
- name: Copy Procursus to Cache Location
|
||||
run: |
|
||||
sudo mkdir -p ~/__cache
|
||||
sudo rsync -aP /opt/procursus ~/__cache
|
||||
sudo rm -rf ~/__cache/procursus/var/cache/apt/archives/partial ~/__cache/procursus/var/lib/apt/lists/partial ~/__cache/procursus/Library/dpkg/triggers/Lock
|
||||
|
||||
build-jbinit:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Get jbinit commit
|
||||
run: echo "JBINIT_COMMIT=$(git -C src/jbinit rev-parse HEAD)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache jbinit
|
||||
uses: actions/cache@v3
|
||||
id: jbinit_cache
|
||||
with:
|
||||
path: src/jbinit/ramdisk.dmg
|
||||
key: jbinit-${{ env.JBINIT_COMMIT }}
|
||||
|
||||
- name: Download dependencies
|
||||
if: steps.jbinit_cache.cache_hit != 'true'
|
||||
run: |
|
||||
brew install make coreutils
|
||||
curl -LO https://github.com/ProcursusTeam/ldid/releases/download/v2.1.5-procursus7/ldid_macosx_x86_64
|
||||
sudo install -m755 ldid_macosx_x86_64 /usr/local/bin/ldid
|
||||
|
||||
- name: Build jbinit
|
||||
if: steps.jbinit_cache.cache_hit != 'true'
|
||||
run: |
|
||||
cd src/jbinit
|
||||
git submodule update --init --recursive
|
||||
sudo cp -a $(xcrun -sdk macosx --show-sdk-path)/usr/include/{xpc,{launch,bootstrap}.h} $(xcrun -sdk iphoneos --show-sdk-path)/usr/include
|
||||
sudo sed -i.bak -Ee 's/API_UNAVAILABLE\(.*\)//g' $(xcrun -sdk iphoneos --show-sdk-path)//System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h
|
||||
sudo sed -i.bak -e 's/;}/;/g' $(xcrun -sdk iphoneos --show-sdk-path)//System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h
|
||||
sudo sed -i.bak -e 's/__UNAVAILABLE_PUBLIC_IOS;/;/g' $(xcrun -sdk iphoneos --show-sdk-path)/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h
|
||||
ruby -e "File.write(ARGV[0], File.read(ARGV[0]).gsub(ARGV[1]) { ARGV[2] })" $(xcrun -sdk iphoneos --show-sdk-path)/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h '__API_DEPRECATED_WITH_REPLACEMENT("kIOMainPortDefault", macos(10.0, 12.0)) __API_UNAVAILABLE(ios, watchos, tvos);' '__API_DEPRECATED_WITH_REPLACEMENT("kIOMainPortDefault", macos(10.0, 12.0)) /*__API_UNAVAILABLE(ios, watchos, tvos)*/;'
|
||||
sudo chown $UID:$GID .
|
||||
sudo gmake -j$(sysctl -n hw.ncpu) ramdisk.dmg
|
||||
|
||||
- name: Upload ramdisk
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ramdisk.dmg
|
||||
path: src/jbinit/ramdisk.dmg
|
||||
retention-days: 1
|
||||
|
||||
build-kpf:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Install toolchain
|
||||
run: |
|
||||
echo 'deb https://assets.checkra.in/debian /' | sudo tee /etc/apt/sources.list.d/checkra1n.list
|
||||
sudo apt-key adv --fetch-keys https://assets.checkra.in/debian/archive.key
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ld64 cctools-strip
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Get Pongo commit
|
||||
run: echo "PONGO_COMMIT=$(git -C src/PongoOS rev-parse HEAD)" >> $GITHUB_ENV
|
||||
|
||||
- name: Voodoo magic
|
||||
id: voodoo
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
key: ${{ github.event_name }}-${{ env.PONGO_COMMIT }}-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
pongo-${{ env.PONGO_COMMIT }}-
|
||||
pongo-
|
||||
path: |
|
||||
src/PongoOS/**
|
||||
|
||||
- name: Compile
|
||||
run: |
|
||||
cd src/PongoOS
|
||||
EMBEDDED_CC='clang-10' EMBEDDED_AR='llvm-ar-10' EMBEDDED_RANLIB='llvm-ranlib-10' DEV_BUILD=1 make build/checkra1n-kpf-pongo
|
||||
|
||||
- name: Upload checkra1n-kpf-pongo
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: checkra1n-kpf-pongo
|
||||
path: src/PongoOS/build/checkra1n-kpf-pongo
|
||||
retention-days: 1
|
||||
|
||||
build-darwin:
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -69,6 +291,7 @@ jobs:
|
||||
os: iphoneos
|
||||
minos: 7.0
|
||||
runs-on: macos-12
|
||||
needs: [build-loader, build-jbinit, build-binpack, build-kpf]
|
||||
env:
|
||||
MBEDTLS_VERSION: 3.3.0
|
||||
READLINE_VERSION: 8.2
|
||||
@@ -93,6 +316,24 @@ jobs:
|
||||
- name: Download dependencies (embedded binaries)
|
||||
run: |
|
||||
echo "SDK=$(xcrun -sdk ${{ matrix.os }} --show-sdk-path)" >> $GITHUB_ENV
|
||||
|
||||
- name: Download binpack.dmg
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: binpack.dmg
|
||||
path: src/palera1n/binpack.dmg
|
||||
|
||||
- name: Download ramdisk.dmg
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ramdisk.dmg
|
||||
path: src/palera1n/ramdisk.dmg
|
||||
|
||||
- name: Download checkra1n-kpf-pongo
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: checkra1n-kpf-pongo
|
||||
path: src/palera1n/checkra1n-kpf-pongo
|
||||
|
||||
- name: Download dependencies (source code)
|
||||
run: |
|
||||
@@ -128,7 +369,7 @@ jobs:
|
||||
echo "CC=$(xcrun --find cc)" >> $GITHUB_ENV
|
||||
echo "CXX=$(xcrun --find c++)" >> $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 -g -flto=full -Wl,-object_path_lto,lto.o" >> $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 "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 "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
|
||||
@@ -359,18 +600,6 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
needs: build-darwin
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Procursus
|
||||
uses: beerpiss/[email protected]
|
||||
with:
|
||||
packages: sed coreutils
|
||||
cache: true
|
||||
mirror: 'https://procursus.itsnebula.net/'
|
||||
|
||||
- name: Download all Darwin artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
@@ -389,79 +618,6 @@ jobs:
|
||||
zip -r9 ready/palera1n-ios.dSYM.zip palera1n-iphoneos-arm64.dSYM
|
||||
zip -r9 ready/palera1n-macos.dSYM.zip palera1n-macos.dSYM
|
||||
|
||||
- name: Build debs
|
||||
run: |
|
||||
make -j$(sysctl -n hw.ncpu) docs
|
||||
version=$(git describe --dirty --tags --abbrev=7 | sed 's|^v||' | sed 's|-beta|~beta|')
|
||||
|
||||
# Darwin x86_64
|
||||
mkdir -p stage/DEBIAN
|
||||
mkdir -p stage/opt/procursus/bin
|
||||
mkdir -p stage/opt/procursus/usr/share/man/man1
|
||||
cp packaging/control.macosx stage/DEBIAN/control
|
||||
|
||||
gsed 's|@DEB_ARCH@|darwin-amd64|g' -i stage/DEBIAN/control
|
||||
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||
|
||||
ginstall -Dm644 ready/palera1n-macos-x86_64 stage/opt/procursus/bin/palera1n
|
||||
ginstall -Dm644 docs/palera1n.1 stage/opt/procursus/usr/share/man/man1/palera1n.1
|
||||
chmod +x stage/opt/procursus/bin/palera1n
|
||||
|
||||
dpkg-deb -Zzstd -b stage palera1n_darwin-amd64.deb
|
||||
mv palera1n*.deb ready/
|
||||
rm -rf stage
|
||||
|
||||
# Darwin arm64
|
||||
mkdir -p stage/DEBIAN
|
||||
mkdir -p stage/opt/procursus/bin
|
||||
mkdir -p stage/opt/procursus/usr/share/man/man1
|
||||
cp packaging/control.macosx stage/DEBIAN/control
|
||||
|
||||
gsed 's|@DEB_ARCH@|darwin-arm64|g' -i stage/DEBIAN/control
|
||||
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||
|
||||
ginstall -Dm644 ready/palera1n-macos-arm64 stage/opt/procursus/bin/palera1n
|
||||
ginstall -Dm644 docs/palera1n.1 stage/opt/procursus/usr/share/man/man1/palera1n.1
|
||||
chmod +x stage/opt/procursus/bin/palera1n
|
||||
|
||||
dpkg-deb -Zzstd -b stage palera1n_darwin-arm64.deb
|
||||
mv palera1n*.deb ready/
|
||||
rm -rf stage
|
||||
|
||||
# iPhoneOS
|
||||
mkdir -p stage/DEBIAN
|
||||
mkdir -p stage/usr/bin
|
||||
mkdir -p stage/usr/share/man/man1
|
||||
cp packaging/control stage/DEBIAN/control
|
||||
|
||||
gsed 's|@DEB_ARCH@|iphoneos-arm|g' -i stage/DEBIAN/control
|
||||
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||
|
||||
ginstall -Dm644 ready/palera1n-ios stage/usr/bin/palera1n
|
||||
ginstall -Dm644 docs/palera1n.1 stage/usr/share/man/man1/palera1n.1
|
||||
chmod +x stage/usr/bin/palera1n
|
||||
|
||||
dpkg-deb -Zzstd -b stage palera1n_iphoneos-arm.deb
|
||||
mv palera1n*.deb ready/
|
||||
rm -rf stage
|
||||
|
||||
# iPhoneOS (rootless)
|
||||
mkdir -p stage/DEBIAN
|
||||
mkdir -p stage/var/jb/usr/bin
|
||||
mkdir -p stage/var/jb/usr/share/man/man1
|
||||
cp packaging/control stage/DEBIAN/control
|
||||
|
||||
gsed 's|@DEB_ARCH@|iphoneos-arm64|g' -i stage/DEBIAN/control
|
||||
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||
|
||||
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
|
||||
chmod +x stage/var/jb/usr/bin/palera1n
|
||||
|
||||
dpkg-deb -Zzstd -b stage palera1n_iphoneos-arm64.deb
|
||||
mv palera1n*.deb ready/
|
||||
rm -rf stage
|
||||
|
||||
- name: Upload artifact
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
uses: wangyucode/[email protected]
|
||||
@@ -484,6 +640,7 @@ jobs:
|
||||
- armel-linux-musleabi
|
||||
- aarch64-linux-musl
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-loader, build-jbinit, build-binpack, build-kpf]
|
||||
env:
|
||||
MBEDTLS_VERSION: 3.3.0
|
||||
LIBUSB_VERSION: 1.0.26
|
||||
@@ -502,7 +659,7 @@ jobs:
|
||||
- name: Install build dependencies (packages)
|
||||
run: |
|
||||
sudo apt-get remove -y libssl-dev libreadline-dev
|
||||
sudo apt-get install -y pkg-config autoconf automake autopoint mandoc
|
||||
sudo apt-get install -y pkg-config autoconf automake autopoint
|
||||
sudo pip3 install jsonschema jinja2
|
||||
|
||||
- name: Download toolchain checksum
|
||||
@@ -522,6 +679,24 @@ jobs:
|
||||
run: |
|
||||
curl -LO https://musl.cc/${{ matrix.triple }}-cross.tgz
|
||||
|
||||
- name: Download binpack.dmg
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: binpack.dmg
|
||||
path: src/palera1n/binpack.dmg
|
||||
|
||||
- name: Download ramdisk.dmg
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ramdisk.dmg
|
||||
path: src/palera1n/ramdisk.dmg
|
||||
|
||||
- name: Download checkra1n-kpf-pongo
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: checkra1n-kpf-pongo
|
||||
path: src/palera1n/checkra1n-kpf-pongo
|
||||
|
||||
- name: Setup environment
|
||||
run: |
|
||||
tar -xf ${{ matrix.triple }}-cross.tgz
|
||||
@@ -530,19 +705,15 @@ jobs:
|
||||
case ${{ matrix.triple }} in
|
||||
i486-linux-musl)
|
||||
echo "CHECKRA1N_NAME=linux-x86" >> $GITHUB_ENV
|
||||
echo "ARCH_NAME=i386" >> $GITHUB_ENV
|
||||
;;
|
||||
x86_64-linux-musl)
|
||||
echo "CHECKRA1N_NAME=linux-x86_64" >> $GITHUB_ENV
|
||||
echo "ARCH_NAME=amd64" >> $GITHUB_ENV
|
||||
;;
|
||||
armel-linux-musleabi)
|
||||
echo "CHECKRA1N_NAME=linux-armel" >> $GITHUB_ENV
|
||||
echo "ARCH_NAME=armel" >> $GITHUB_ENV
|
||||
;;
|
||||
aarch64-linux-musl)
|
||||
echo "CHECKRA1N_NAME=linux-arm64" >> $GITHUB_ENV
|
||||
echo "ARCH_NAME=arm64" >> $GITHUB_ENV
|
||||
;;
|
||||
esac
|
||||
echo "PKG_CONFIG_PATH=$(pwd)/sysroot/usr/local/lib/pkgconfig" >> $GITHUB_ENV
|
||||
@@ -556,7 +727,6 @@ jobs:
|
||||
echo "CROSS_COMPILE=${{ matrix.triple }}-" >> $GITHUB_ENV
|
||||
mkdir -p $(pwd)/sysroot/usr/local/lib
|
||||
ln -sf $(pwd)/sysroot/usr/local/lib{,64}
|
||||
|
||||
- name: Download dependencies (source code)
|
||||
run: |
|
||||
curl -LOOOOOOO \
|
||||
@@ -750,27 +920,6 @@ jobs:
|
||||
mv src/palera1n ready/palera1n-${{ env.CHECKRA1N_NAME }}
|
||||
tar -zcf ready/dep_root_${{ matrix.triple }}.tgz dep_root
|
||||
|
||||
- name: Build debs
|
||||
run: |
|
||||
version=$(git describe --dirty --tags --abbrev=7 | sed 's|^v||' | sed 's|-beta|~beta|')
|
||||
|
||||
make -j$(nproc) docs
|
||||
mkdir -p stage/DEBIAN
|
||||
mkdir -p stage/usr/bin
|
||||
mkdir -p stage/usr/share/man/man1
|
||||
cp packaging/control stage/DEBIAN/control
|
||||
|
||||
sed 's|@DEB_ARCH@|${{ env.ARCH_NAME }}|g' -i stage/DEBIAN/control
|
||||
sed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||
|
||||
install -Dm644 ready/palera1n-${{ env.CHECKRA1N_NAME }} stage/usr/bin/palera1n
|
||||
install -Dm644 docs/palera1n.1 stage/usr/share/man/man1/palera1n.1
|
||||
chmod +x stage/usr/bin/palera1n
|
||||
|
||||
dpkg-deb -b stage palera1n_${{ env.ARCH_NAME }}.deb
|
||||
mv palera1n*.deb ready/
|
||||
rm -rf stage
|
||||
|
||||
- name: Upload artifact
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
uses: wangyucode/[email protected]
|
||||
@@ -783,3 +932,13 @@ jobs:
|
||||
dryRun: false
|
||||
localDir: 'ready/'
|
||||
remoteDir: '/palera1n/artifacts/c-rewrite'
|
||||
|
||||
delete-artifacts:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [darwin-dist, build-Linux]
|
||||
steps:
|
||||
- name: Delete all artifacts on GitHub
|
||||
uses: geekyeggo/delete-artifact@v2
|
||||
with:
|
||||
name: '*'
|
||||
failOnError: false
|
||||
+6
-8
@@ -7,19 +7,17 @@ contrib/
|
||||
.vscode
|
||||
checkra1n*
|
||||
payload.c
|
||||
src/palera1n
|
||||
src/palera1n/palera1n
|
||||
!xxd-embedded.h
|
||||
src/binpack.dmg
|
||||
src/ramdisk.dmg
|
||||
src/xxd-*.c
|
||||
src/palera1n/binpack.dmg
|
||||
src/palera1n/ramdisk.dmg
|
||||
src/palera1n/xxd-*.c
|
||||
.DS_Store
|
||||
!palera1n.1
|
||||
palera1n.1.html
|
||||
Payload
|
||||
docs/*.html
|
||||
build
|
||||
src/*.dmg.c
|
||||
src/palera1n/*.dmg.c
|
||||
.idea
|
||||
src/stage2/
|
||||
src/libcheckra1nhelper.dylib*
|
||||
src/Pongo.bin
|
||||
src/palera1n/libcheckra1nhelper.dylib*
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
[submodule "src/PongoOS"]
|
||||
path = src/PongoOS
|
||||
url = [email protected]:plooshi/PongoOS.git
|
||||
[submodule "src/jbinit"]
|
||||
path = src/jbinit
|
||||
url = [email protected]:palera1n/jbinit.git
|
||||
[submodule "src/loader"]
|
||||
path = src/loader
|
||||
url = [email protected]:palera1n/loader.git
|
||||
[submodule "src/binpack"]
|
||||
path = src/binpack
|
||||
url = [email protected]:palera1n/binpack.git
|
||||
@@ -1,12 +1,12 @@
|
||||
NAME = bakepale
|
||||
NAME = The Beginning of the End
|
||||
|
||||
SRC = $(shell pwd)
|
||||
DEP = $(SRC)/dep_root
|
||||
STRIP = strip
|
||||
CC ?= cc
|
||||
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC)
|
||||
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
|
||||
CFLAGS += -Wall -Wextra -DPALERAIN_VERSION=\"2.0.0\" -Wall -Wextra -Wno-unused-parameter
|
||||
CFLAGS += -Wno-unused-variable -I$(SRC)/src/palera1n -std=c99 -pedantic-errors -D_C99_SOURCE -D_POSIX_C_SOURCE=200112L -D_DARWIN_C_SOURCE
|
||||
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
|
||||
ifeq ($(TARGET_OS),)
|
||||
@@ -25,13 +25,11 @@ LDFLAGS += -static -no-pie -Wl,--gc-sections
|
||||
endif
|
||||
LIBS += $(DEP)/lib/libmbedtls.a $(DEP)/lib/libmbedcrypto.a $(DEP)/lib/libmbedx509.a $(DEP)/lib/libreadline.a
|
||||
|
||||
ifeq ($(TUI),1)
|
||||
ifeq ($(DEV_BUILD),1)
|
||||
LIBS += $(DEP)/lib/libnewt.a $(DEP)/lib/libpopt.a $(DEP)/lib/libslang.a
|
||||
ifeq ($(TARGET_OS),Linux)
|
||||
LIBS += $(DEP)/lib/libgpm.a
|
||||
endif
|
||||
endif
|
||||
ifeq ($(DEV_BUILD),1)
|
||||
CFLAGS += -O0 -g -DDEV_BUILD -fno-omit-frame-pointer
|
||||
ifeq ($(ASAN),1)
|
||||
BUILD_STYLE=ASAN
|
||||
@@ -53,36 +51,30 @@ CFLAGS += -DBAKERAIN_DEVELOPE_R="\"$(BAKERAIN_DEVELOPE_R)\""
|
||||
endif
|
||||
|
||||
BUILD_DATE := $(shell LANG=C date)
|
||||
BUILD_NUMBER := $(shell git rev-list --count HEAD)
|
||||
BUILD_TAG := $(shell git describe --dirty --tags --abbrev=7)
|
||||
BUILD_WHOAMI := $(shell whoami)
|
||||
BUILD_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
||||
BUILD_COMMIT := $(shell git rev-parse HEAD)
|
||||
|
||||
CFLAGS += -DBUILD_STYLE="\"$(BUILD_STYLE)\"" -DBUILD_DATE="\"$(BUILD_DATE)\""
|
||||
CFLAGS += -DBUILD_WHOAMI="\"$(BUILD_WHOAMI)\"" -DBUILD_TAG="\"$(BUILD_TAG)\""
|
||||
CFLAGS += -DBUILD_NUMBER="\"$(BUILD_NUMBER)\"" -DBUILD_BRANCH="\"$(BUILD_BRANCH)\""
|
||||
CFLAGS += -DBUILD_COMMIT="\"$(BUILD_COMMIT)\""
|
||||
CFLAGS += -DBUILD_STYLE="\"$(BUILD_STYLE)\"" -DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_WHOAMI=\"$(BUILD_WHOAMI)\" -DBUILD_TAG=\"$(BUILD_TAG)\"
|
||||
|
||||
export SRC DEP CC CFLAGS LDFLAGS LIBS TARGET_OS DEV_BUILD BUILD_DATE BUILD_TAG BUILD_WHOAMI BUILD_STYLE BUILD_NUMBER BUILD_BRANCH
|
||||
export SRC DEP CC CFLAGS LDFLAGS LIBS TARGET_OS DEV_BUILD BUILD_DATE BUILD_TAG BUILD_WHOAMI BUILD_STYLE
|
||||
|
||||
all: palera1n
|
||||
|
||||
palera1n: download-deps
|
||||
$(MAKE) -C src
|
||||
$(MAKE) -C src/palera1n
|
||||
|
||||
clean:
|
||||
$(MAKE) -C src clean
|
||||
$(MAKE) -C src/palera1n clean
|
||||
$(MAKE) -C docs clean
|
||||
|
||||
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 Pongo.bin
|
||||
$(MAKE) -C src/palera1n checkra1n-macos checkra1n-linux-arm64 checkra1n-linux-armel checkra1n-linux-x86 checkra1n-linux-x86_64 checkra1n-kpf-pongo ramdisk.dmg binpack.dmg
|
||||
|
||||
docs:
|
||||
$(MAKE) -C docs
|
||||
|
||||
distclean: clean
|
||||
rm -rf palera1n-* palera1n*.dSYM src/checkra1n-* src/checkra1n-kpf-pongo src/ramdisk.dmg src/binpack.dmg src/Pongo.bin
|
||||
rm -rf palera1n-* palera1n*.dSYM src/checkra1n-* src/checkra1n-kpf-pongo src/ramdisk.dmg src/binpack.dmg
|
||||
|
||||
.PHONY: all palera1n clean docs distclean
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<picture>
|
||||
<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>
|
||||
<img align="left" height="120" src="https://cdn.discordapp.com/attachments/1017854329887129611/1073858292159352862/thing.png" alt="palera1n logo" style="float: left;"/>
|
||||
<h3 align="right">An iOS 15.0-16.3.1 work-in-progress, <br>semi-tethered checkm8 jailbreak</h3>
|
||||
|
||||
<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>
|
||||
@@ -15,8 +12,6 @@
|
||||
</p>
|
||||
<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).
|
||||
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).
|
||||
|
||||
@@ -41,10 +36,6 @@ If you need an older v2.0.0 beta, please get it [here](https://github.com/palera
|
||||
- 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.
|
||||
- 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?
|
||||
|
||||
@@ -56,7 +47,7 @@ Make sure you provide full details on your device, such as:
|
||||
|
||||
Using `-V` and `-v` would help with debugging.
|
||||
|
||||
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).
|
||||
Join the [Support Discord](https://dsc.gg/palera1n), and find the palera1n-c thread under #jailbreak [here](https://discord.com/channels/1028398973452570725/1074251283143344180).
|
||||
|
||||
# Credits
|
||||
<details><summary>palera1n-c Contributors and Credits</summary>
|
||||
@@ -90,6 +81,5 @@ 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://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://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>
|
||||
<a href="https://blog.stevesec.com/"><img width=64 style="border-radius: 25%;" src="https://blog.stevesec.com/img/avatar.jpg"></img></a>
|
||||
</p>
|
||||
+18
-40
@@ -2,25 +2,25 @@
|
||||
.\" Copyright (c) 2023 Nick Chan
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.\"
|
||||
.Dd "20 March 2023"
|
||||
.Dd "06 February 2023"
|
||||
.Dt "Nick Chan utilities manual" 1 "palera1n"
|
||||
.Dt palera1n 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm palera1n
|
||||
.Nd iOS 15.0-16.4.1 arm64 iOS/iPadOS jailbreaking tool
|
||||
.Nd iOS 15.0-16.3.1 arm64 iOS/iPadOS jailbreaking tool
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl cCdDEfhIlLnpRsSvV
|
||||
.Op Fl BcdDEfhlnLOpRsvVI
|
||||
.Op Fl e Ar Boot arguments
|
||||
.Op Fl k Ar Pongo image
|
||||
.Op Fl o Ar overlay file
|
||||
.Op Fl r Ar ramdisk file
|
||||
.Op Fl K Ar KPF file
|
||||
.Op Fl i Ar checkra1n file
|
||||
.Op Fl -version
|
||||
.Op Fl -force-revert
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
jailbreaks any iOS/iPadOS device with an arm64 (arm64e excluded) on iOS 15.0-16.4.1,
|
||||
jailbreaks any iOS/iPadOS device with an arm64 (arm64e excluded) on iOS 15.0-16.3.1,
|
||||
utilizing the
|
||||
.Em checkm8
|
||||
bootROM exploit.
|
||||
@@ -48,11 +48,8 @@ On iOS 16, the passcode must be off since restore, and
|
||||
from settings app counts as a restore.
|
||||
A backup may be used in this case.
|
||||
.Pp
|
||||
In the remainder of this document, the term "iOS" and "iPadOS" will be used interchangably
|
||||
as the difference is negligible as far as the jailbreak is concerened.
|
||||
.Pp
|
||||
.Sh SUPPORTED DEVICES
|
||||
As described above, arm64 iOS 15.0-16.4.1 devices are supported, here is an explicit
|
||||
As described above, arm64 iOS/iPadOS 15.0-16.3.1 devices are supported, here is an explicit
|
||||
list of supported devicecs:
|
||||
|
||||
.Bl -tag -compact
|
||||
@@ -106,13 +103,11 @@ is not supported when this option is used together with
|
||||
Like
|
||||
.Fl c , -setup-fakefs
|
||||
but the size of the created fakefs is smaller at the expense of having unwritable
|
||||
parts in rarely-written paths. When jailbreaking 16 GB devices, this option must be used
|
||||
when setting up fakefs for rootful, as they do not have enough storage for full fakefs.
|
||||
This option currently does not work on iOS 16.
|
||||
parts in rarely-written paths. (good for 16 GB devices)
|
||||
.It Fl c , -setup-fakefs
|
||||
When used with
|
||||
.Fl f , -fakefs ,
|
||||
creates the new APFS volume required for rootful. Will fail if one already exists.
|
||||
Create the new APFS volume required for rootful. Will fail if one already exists.
|
||||
.It Fl d , -demote
|
||||
Set the effective production fuse to 0, so as to enable hardware debugging features.
|
||||
.It Fl D , -dfuhelper
|
||||
@@ -129,7 +124,7 @@ argument is used during fakefs setup.
|
||||
.It Fl E , -enter-recovery
|
||||
Exit after entering recovery mode.
|
||||
.It Fl f , -fakefs
|
||||
Proceed in rootful mode. This applies to both full fakefs and partial fakefs.
|
||||
Jailbreak in rootful mode.
|
||||
.It Fl h , -help
|
||||
Prints help text.
|
||||
.It Fl i , -checkra1n-file Ar checkra1n file
|
||||
@@ -143,10 +138,10 @@ Override the kernel patchfinder PongoOS module. The module is required to suppor
|
||||
root filesystem in paleinfo with
|
||||
.Em rootfs
|
||||
command. If in doubt, use
|
||||
.Sy https://github.com/palera1n/PongoOS
|
||||
.Sy https://github.com/guacaplushy/PongoOS
|
||||
iOS15 branch or your own fork of it.
|
||||
.It Fl l , -rootless
|
||||
Proceed in rootless mode, this is the default when neither
|
||||
Jailbreak in rootless mode, this is the default when neither
|
||||
.Fl l , -rootless
|
||||
and
|
||||
.Fl f , -fakefs
|
||||
@@ -166,6 +161,8 @@ at the root of it, as well as a dmg named
|
||||
.Em loader.dmg
|
||||
at the root of it. Otherwise, the device will not boot. It is also expected that it
|
||||
contains a shell, a ssh server, and various command line utilities.
|
||||
.It Fl O , -disable-ohio
|
||||
Disable ohio (disable analytics)
|
||||
.It Fl p , -pongo-shell
|
||||
Exit after booting into a clean PongoOS shell
|
||||
.It Fl P , -pongo-full
|
||||
@@ -186,8 +183,6 @@ specified (see
|
||||
.Sy FILES
|
||||
section below) will be executed. The loader app and the built in SSH server can still be used,
|
||||
as well as any jailbreak-specific apps you have installed.
|
||||
.It Fl S , -no-colors
|
||||
Disable colors on the command line. External programs like checkra1n clones may still output colors.
|
||||
.It Fl v , -debug-logging
|
||||
Enable debug logging. The option may be repeated for extra verbosity.
|
||||
.It Fl V , -verbose-boot
|
||||
@@ -197,7 +192,7 @@ Prints info about device and exits.
|
||||
.El
|
||||
.Sh ENVIRONMENTAL VARIABLES
|
||||
.Bl -tag -width -indent
|
||||
.It Ev TMPDIR
|
||||
.It TMPDIR
|
||||
This environmental variable should contain the a directory for temporary
|
||||
files. Without the
|
||||
.Fl i , -override-checkra1n
|
||||
@@ -242,7 +237,7 @@ To exit recovery mode:
|
||||
.Sh CAVEATS
|
||||
.Pp
|
||||
.Em -v
|
||||
is not a real XNU boot argument. It is interpreted by iBoot. However, since XNU
|
||||
is not a real XNU boot argument. It is intercepted by iBoot. However, since XNU
|
||||
boot arguments are set in PongoOS, which is ran after iBoot has ran, it does nothing.
|
||||
To verbose boot, use the
|
||||
.Fl V , -verbose-boot
|
||||
@@ -257,16 +252,11 @@ version of the Procursus fork of
|
||||
before they can be ran on a device jailbroken with
|
||||
.Nm
|
||||
\[char46]
|
||||
.Pp
|
||||
When using rootful mode, the
|
||||
.Fl f , -fakefs
|
||||
flag must be specified at all times. It does not matter whether you want to create fakefs,
|
||||
create partial fakefs, rejailbreak or remove jailbreak.
|
||||
.Sh POST INSTALLATION
|
||||
.Sh POST INSTLLATION
|
||||
The palera1n loader app will take up to 30 seconds to appear on the homescreen after the
|
||||
device has booted. If it does not appear, you can try using the shortcut:
|
||||
.Pp
|
||||
.Lk https://www.icloud.com/shortcuts/8cd5f489c8854ee0ab9ee38f2e62f87d
|
||||
.Sy https://www.icloud.com/shortcuts/8cd5f489c8854ee0ab9ee38f2e62f87d
|
||||
.Pp
|
||||
to open it. After opening the loader app, press install to install a bootstrap as well as
|
||||
the
|
||||
@@ -310,23 +300,11 @@ may crash if the machine it is running on:
|
||||
.Dl "- Has non-compliant USB devices plugged in"
|
||||
.Pp
|
||||
The exploit may also work less reliably on some hosts, like AMD desktops, or some MediaTek devices.
|
||||
.Pp
|
||||
The device may randomly crash and reboot due to launchd exiting with code 7.
|
||||
.Sh NOTES
|
||||
.Nm
|
||||
injects a dylib into launchd to allow the
|
||||
.Sy launchctl runstats
|
||||
command to be used on the device.
|
||||
.Sh DEPRECATED AND REMOVED FUNCTIONALITY
|
||||
There was an option in
|
||||
.Nm
|
||||
to force create the fakefs even when one already exists (which would overwrite
|
||||
the existing fakefs), by setting the palerain_option_setup_rootful_forced flag
|
||||
in palera1n flags. This option was removed because using
|
||||
.Fl -force-revert
|
||||
and
|
||||
.Fl c
|
||||
at the same time has exactly the same effect.
|
||||
.Sh SEE ALSO
|
||||
.Xr launchd 8
|
||||
.Xr launchd.plist 5
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
curl -LOOOOOO \
|
||||
https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v3.3.0.tar.gz \
|
||||
https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 \
|
||||
https://mirror-hk.koddos.net/gnu/readline/readline-8.2.tar.gz \
|
||||
https://www.jedsoft.org/releases/slang/slang-2.3.3.tar.bz2 \
|
||||
https://releases.pagure.org/newt/newt-0.52.23.tar.gz \
|
||||
https://github.com/rpm-software-management/popt/archive/master-release.tar.gz
|
||||
|
||||
tar xf v3.3.0.tar.gz
|
||||
tar xf libusb-1.0.26.tar.bz2
|
||||
tar xf readline-8.2.tar.gz
|
||||
tar xf slang-2.3.3.tar.bz2
|
||||
tar xf newt-0.52.23.tar.gz
|
||||
tar xf master-release.tar.gz
|
||||
|
||||
git clone --depth=1 https://github.com/libimobiledevice/libplist
|
||||
git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice-glue
|
||||
git clone --depth=1 https://github.com/libimobiledevice/libirecovery
|
||||
git clone --depth=1 https://github.com/libimobiledevice/libusbmuxd
|
||||
git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice
|
||||
+13
-5
@@ -60,7 +60,6 @@
|
||||
#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_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
|
||||
#define palerain_option_test1 (1 << 29)
|
||||
@@ -70,20 +69,19 @@
|
||||
// palerain host options
|
||||
#define host_option_dfuhelper_only (1 << 0) /* dfuhelper only */
|
||||
#define host_option_pongo_exit (1 << 1) /* boot to clean pongo shell */
|
||||
#ifdef TUI
|
||||
#ifdef DEV_BUILD
|
||||
#define host_option_tui (1 << 2) /* use terminal user interface */
|
||||
#else
|
||||
#define host_option_res1 (1 << 2) /* reserved */
|
||||
#endif
|
||||
#define host_option_demote (1 << 3) /* Demote effective production fuse status */
|
||||
// (1 << 4) is removed
|
||||
#define host_option_no_ohio (1 << 4) /* Disable Ohio (Analytics) */
|
||||
#define host_option_pongo_full (1 << 5) /* Boot to pongo with default images and options */
|
||||
#define host_option_palerain_version (1 << 6) /* Print version */
|
||||
#define host_option_exit_recovery (1 << 7) /* Exit recovery mode */
|
||||
#define host_option_reboot_device (1 << 8) /* Reboot device in normal mode */
|
||||
#define host_option_enter_recovery (1 << 9) /* Enter recovery mode */
|
||||
#define host_option_device_info (1 << 10) /* Print device info */
|
||||
#define host_option_no_colors (1 << 11) /* no colors */
|
||||
|
||||
#define PALEINFO_MAGIC 'PLSH'
|
||||
#define PALEINFO_CIGAM 'HSLP'
|
||||
@@ -122,8 +120,18 @@ struct kpfinfo {
|
||||
options = (checkrain_option_t)(options & ~option); \
|
||||
} while (0);
|
||||
|
||||
static inline bool checkrain_options_enabled(checkrain_option_t flags, checkrain_option_t opt)
|
||||
static inline bool checkrain_option_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;
|
||||
}
|
||||
|
||||
|
||||
+4
-6
@@ -2,7 +2,7 @@
|
||||
#define PALERAIN_H
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#define NSIG __DARWIN_NSIG
|
||||
#define _DARWIN_C_SOURCE 1
|
||||
#endif
|
||||
|
||||
#include "xxd-embedded.h"
|
||||
@@ -100,8 +100,6 @@ struct mach_header_64
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef void *(*pthread_start_t)(void *);
|
||||
|
||||
// Keep in sync with Pongo
|
||||
#define PONGO_USB_VENDOR 0x05ac
|
||||
#define PONGO_USB_PRODUCT 0x4141
|
||||
@@ -151,7 +149,7 @@ typedef unsigned char niarelap_file_t[];
|
||||
extern unsigned int verbose;
|
||||
|
||||
extern char* pongo_path;
|
||||
#ifdef TUI
|
||||
#ifdef DEV_BUILD
|
||||
extern bool tui_started;
|
||||
#endif
|
||||
|
||||
@@ -205,7 +203,7 @@ boyermoore_horspool_memmem(const unsigned char* haystack, size_t hlen,
|
||||
const unsigned char* needle, size_t nlen);
|
||||
|
||||
|
||||
extern void* pongo_usb_callback(stuff_t* arg);
|
||||
extern void* pongo_usb_callback(void* 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);
|
||||
const char *usb_strerror(usb_ret_t err);
|
||||
int wait_for_pongo(void);
|
||||
@@ -228,7 +226,7 @@ void io_stop(stuff_t *stuff);
|
||||
|
||||
void print_credits(void);
|
||||
|
||||
#ifdef TUI
|
||||
#ifdef DEV_BUILD
|
||||
#include <newt.h>
|
||||
newtComponent get_tui_log();
|
||||
newtComponent set_tui_log(newtComponent co);
|
||||
|
||||
+1
-2
@@ -11,7 +11,6 @@
|
||||
#include <locale.h>
|
||||
#include <unistd.h>
|
||||
#include <newt.h>
|
||||
#include <kerninfo.h>
|
||||
|
||||
#define WIDTH 76
|
||||
#define HEIGHT 19
|
||||
@@ -20,7 +19,7 @@
|
||||
#define PI_STEP_CURRENT NEWT_COLORSET_CUSTOM(1)
|
||||
#define PI_STEP_OTHER NEWT_COLORSET_CUSTOM(2)
|
||||
|
||||
#define CHECKBOX_STATE(flags, opt) checkrain_options_enabled(flags, opt) ? '*' : ' '
|
||||
#define CHECKBOX_STATE(flags, opt) checkrain_option_enabled(flags, opt) ? '*' : ' '
|
||||
|
||||
typedef enum tui_screens {
|
||||
ERROR_SCREEN = -1,
|
||||
|
||||
@@ -17,9 +17,6 @@ extern unsigned int ramdisk_dmg_len;
|
||||
extern unsigned char binpack_dmg[];
|
||||
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))
|
||||
extern unsigned char libcheckra1nhelper_dylib[];
|
||||
extern unsigned int libcheckra1nhelper_dylib_len;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
Package: palera1n
|
||||
Name: palera1n
|
||||
Version: @DEB_VERSION@
|
||||
Architecture: @DEB_ARCH@
|
||||
Maintainer: palera1n team
|
||||
Author: palera1n team
|
||||
Depends: usbmuxd
|
||||
Section: Utilities
|
||||
Priority: optional
|
||||
Homepage: https://palera.in
|
||||
Description: iOS 15.0-16.4.1 semi-tethered checkm8 jailbreak
|
||||
palera1n is an iOS/iPadOS 15.0-15.3.1 semi tethered jailbreak
|
||||
based on the checkm8 exploit.
|
||||
.
|
||||
palera1n is able to jailbreak the device in fakefs-rootful mode,
|
||||
where / is writable, as well as rootless mode, where / cannot be
|
||||
written to.
|
||||
@@ -1,16 +0,0 @@
|
||||
Package: palera1n
|
||||
Name: palera1n
|
||||
Version: @DEB_VERSION@
|
||||
Architecture: @DEB_ARCH@
|
||||
Maintainer: palera1n team
|
||||
Author: palera1n team
|
||||
Section: Utilities
|
||||
Priority: optional
|
||||
Homepage: https://palera.in
|
||||
Description: iOS 15.0-16.4.1 semi-tethered checkm8 jailbreak
|
||||
palera1n is an iOS/iPadOS 15.0-15.3.1 semi tethered jailbreak
|
||||
based on the checkm8 exploit.
|
||||
.
|
||||
palera1n is able to jailbreak the device in fakefs-rootful mode,
|
||||
where / is writable, as well as rootless mode, where / cannot be
|
||||
written to.
|
||||
Submodule
+1
Submodule src/PongoOS added at f3e1294f42.
Submodule
+1
Submodule src/binpack added at dc0ef6423c.
Submodule
+1
Submodule src/jbinit added at 68dfd57cd5.
Submodule
+1
Submodule src/loader added at d73b4ac49f.
@@ -14,46 +14,32 @@ endif
|
||||
ifeq ($(FORCE_HELPER),1)
|
||||
OBJECTS += xxd-libcheckra1nhelper.dylib.o
|
||||
CFLAGS += -DFORCE_HELPER
|
||||
BUILD_OPTIONS += FORCE_HELPER
|
||||
endif
|
||||
|
||||
ifneq ($(NO_RAMDISK),1)
|
||||
OBJECTS += xxd-ramdisk.dmg.o
|
||||
else
|
||||
CFLAGS += -DNO_RAMDISK
|
||||
BUILD_OPTIONS += NO_RAMDISK
|
||||
endif
|
||||
ifneq ($(NO_KPF),1)
|
||||
OBJECTS += xxd-checkra1n-kpf-pongo.o
|
||||
else
|
||||
CFLAGS += -DNO_KPF
|
||||
BUILD_OPTIONS += NO_KPF
|
||||
endif
|
||||
ifneq ($(NO_OVERLAY),1)
|
||||
ifneq ($(NO_BINPACK),1)
|
||||
OBJECTS += xxd-binpack.dmg.o
|
||||
else
|
||||
CFLAGS += -DNO_OVERLAY
|
||||
BUILD_OPTIONS += NO_OVERLAY
|
||||
CFLAGS += -DNO_BINPACK
|
||||
endif
|
||||
ifneq ($(NO_CHECKRAIN),1)
|
||||
OBJECTS += xxd-checkra1n.o
|
||||
else
|
||||
CFLAGS += -DNO_CHECKRAIN
|
||||
BUILD_OPTIONS += NO_CHECKRAIN
|
||||
endif
|
||||
|
||||
ifneq ($(NO_CUSTOM_PONGO),1)
|
||||
OBJECTS += xxd-Pongo.bin.o
|
||||
else
|
||||
CFLAGS += -DNO_CUSTOM_PONGO
|
||||
BUILD_OPTIONS += NO_CUSTOM_PONGO
|
||||
endif
|
||||
|
||||
ifeq ($(TUI),1)
|
||||
ifeq ($(DEV_BUILD),1)
|
||||
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
|
||||
BUILD_OPTIONS += TUI
|
||||
CFLAGS += -DTUI
|
||||
endif
|
||||
|
||||
CHECKRA1N_VERSION ?= 0.1337.1
|
||||
@@ -65,11 +51,7 @@ ifneq ($(USE_LIBUSB),1)
|
||||
OBJECTS += usb_iokit.o
|
||||
else
|
||||
LIBS += -framework SystemConfiguration -framework Security
|
||||
BUILD_OPTIONS += USE_LIBUSB
|
||||
endif
|
||||
# add lto and debug symbols for lto
|
||||
CFLAGS += -flto=full -g
|
||||
LDFLAGS += -Wl,-object_path_lto,lto.o
|
||||
else
|
||||
USE_LIBUSB = 1
|
||||
endif
|
||||
@@ -80,17 +62,6 @@ CFLAGS += -DUSE_LIBUSB=1
|
||||
LIBS += $(DEP)/lib/libusb-1.0.a
|
||||
endif
|
||||
|
||||
ifneq ($(ROOTFUL),0)
|
||||
CFLAGS += -DROOTFUL=1
|
||||
BUILD_OPTIONS += ROOTFUL
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_OPTIONS),)
|
||||
BUILD_OPTIONS = (none)
|
||||
endif
|
||||
|
||||
CFLAGS += -DBUILD_OPTIONS=\""$(BUILD_OPTIONS)"\"
|
||||
|
||||
checkra1n-%:
|
||||
curl -LO https://assets.checkra.in/downloads/preview/$(CHECKRA1N_VERSION)/$@
|
||||
chmod 755 $@
|
||||
@@ -145,9 +116,6 @@ ramdisk.dmg:
|
||||
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:
|
||||
rm -rf *.o palera1n checkra1n checkra1n.c palera1n.dSYM libcheckra1nhelper.dylib
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef BAKERAIN_DEVELOPE_R
|
||||
#define BAKERAIN_DEVELOPE_R "kok3shidoll"
|
||||
#define BAKERAIN_DEVELOPE_R "dora2ios"
|
||||
#endif
|
||||
#define THE_PLUSH "Ploosh"
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
#define R print_credits(void) {
|
||||
#define O fprintf
|
||||
#define U (
|
||||
#define B stderr
|
||||
#define B stdout
|
||||
#define L ,
|
||||
#define E "# == palera1n-c == \n#\n"
|
||||
#define M "# Made by: Nick Chan, " THE_PLUSH ", Samara, Nebula, staturnz, " BAKERAIN_DEVELOPE_R " \n#\n"
|
||||
#define A "# Thanks to: pythonplayer123, llsc12, Mineek, tihmstar, nikias\n"
|
||||
#define M "# Made by: Nick Chan, " THE_PLUSH ", Mineek, Nebula, llsc12\n#\n"
|
||||
#define A "# Thanks to: " BAKERAIN_DEVELOPE_R ", pythonplayer, tihmstar, nikias\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 N )
|
||||
@@ -76,27 +76,27 @@ bool cpid_is_arm64(unsigned int cpid) {
|
||||
* ========== 0x8960 ===========
|
||||
* (ARM64) A7
|
||||
*/
|
||||
return (
|
||||
cpid == 0x8960 || cpid == 0x7000 || cpid == 0x7001 ||
|
||||
cpid == 0x8000 || cpid == 0x8001 || cpid == 0x8003 ||
|
||||
cpid == 0x8010 || cpid == 0x8011 || cpid == 0x8012 ||
|
||||
cpid == 0x8015
|
||||
);
|
||||
if (
|
||||
cpid == 0x8960 || cpid == 0x7000 || cpid == 0x7001
|
||||
|| cpid == 0x8000 || cpid == 0x8001 || cpid == 0x8003
|
||||
|| cpid == 0x8010 || cpid == 0x8011 || cpid == 0x8012
|
||||
|| 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 ret;
|
||||
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;
|
||||
usbmuxd_events_subscribe(&usbmuxdctx, device_event_cb, NULL);
|
||||
irecv_device_event_subscribe(&irecvctx, irecv_event_cb, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int unsubscribe_cmd(void)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = usbmuxd_events_unsubscribe(usbmuxdctx))) return ret;
|
||||
if ((ret = irecv_device_event_unsubscribe(irecvctx))) return ret;
|
||||
usbmuxd_events_unsubscribe(usbmuxdctx);
|
||||
irecv_device_event_unsubscribe(irecvctx);
|
||||
irecvctx = NULL;
|
||||
usbmuxdctx = NULL;
|
||||
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)
|
||||
{
|
||||
(void)idevice_free(device);
|
||||
idevice_free(device);
|
||||
LOG(LOG_ERROR, "Device is not in normal mode.");
|
||||
return -1;
|
||||
}
|
||||
plist_t node = NULL;
|
||||
if (lockdownd_get_value(lockdown, NULL, "UniqueChipID", &node) != LOCKDOWN_E_SUCCESS)
|
||||
{
|
||||
(void)lockdownd_client_free(lockdown);
|
||||
(void)idevice_free(device);
|
||||
lockdownd_client_free(lockdown);
|
||||
idevice_free(device);
|
||||
LOG(LOG_ERROR, "Error getting ECID");
|
||||
return -1;
|
||||
}
|
||||
@@ -137,8 +137,8 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
|
||||
node = NULL;
|
||||
if (lockdownd_get_value(lockdown, NULL, "ProductType", &node) != LOCKDOWN_E_SUCCESS)
|
||||
{
|
||||
(void)lockdownd_client_free(lockdown);
|
||||
(void)idevice_free(device);
|
||||
lockdownd_client_free(lockdown);
|
||||
idevice_free(device);
|
||||
LOG(LOG_ERROR, "Error getting product type");
|
||||
return -1;
|
||||
}
|
||||
@@ -148,8 +148,8 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
|
||||
node = NULL;
|
||||
if (lockdownd_get_value(lockdown, NULL, "CPUArchitecture", &node) != LOCKDOWN_E_SUCCESS)
|
||||
{
|
||||
(void)lockdownd_client_free(lockdown);
|
||||
(void)idevice_free(device);
|
||||
lockdownd_client_free(lockdown);
|
||||
idevice_free(device);
|
||||
LOG(LOG_ERROR, "Error getting CPU type");
|
||||
return -1;
|
||||
}
|
||||
@@ -159,8 +159,8 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
|
||||
node = NULL;
|
||||
if (lockdownd_get_value(lockdown, NULL, "ProductVersion", &node) != LOCKDOWN_E_SUCCESS)
|
||||
{
|
||||
(void)lockdownd_client_free(lockdown);
|
||||
(void)idevice_free(device);
|
||||
lockdownd_client_free(lockdown);
|
||||
idevice_free(device);
|
||||
LOG(LOG_ERROR, "Error getting product version");
|
||||
return -1;
|
||||
}
|
||||
@@ -170,21 +170,21 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
|
||||
node = NULL;
|
||||
if (lockdownd_get_value(lockdown, NULL, "BuildVersion", &node) != LOCKDOWN_E_SUCCESS)
|
||||
{
|
||||
(void)lockdownd_client_free(lockdown);
|
||||
(void)idevice_free(device);
|
||||
lockdownd_client_free(lockdown);
|
||||
idevice_free(device);
|
||||
LOG(LOG_ERROR, "Error getting build version");
|
||||
return -1;
|
||||
}
|
||||
plist_get_string_val(node, &buildVersion);
|
||||
plist_free(node);
|
||||
(void)lockdownd_client_free(lockdown);
|
||||
(void)idevice_free(device);
|
||||
|
||||
lockdownd_client_free(lockdown);
|
||||
idevice_free(device);
|
||||
irecv_device_t rcvydev;
|
||||
if (irecv_devices_get_device_by_product_type(productType, &rcvydev) == IRECV_E_SUCCESS)
|
||||
{
|
||||
displayName = rcvydev->display_name;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
displayName = productType;
|
||||
}
|
||||
@@ -209,22 +209,23 @@ int enter_recovery_cmd(const char* udid) {
|
||||
LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
|
||||
return -1;
|
||||
}
|
||||
ldret = lockdownd_enter_recovery(lockdown);
|
||||
if (ldret == LOCKDOWN_E_SESSION_INACTIVE) {
|
||||
lockdownd_client_free(lockdown);
|
||||
lockdown = NULL;
|
||||
ldret = lockdownd_client_new_with_handshake(device, &lockdown, "palera1n");
|
||||
do {
|
||||
ldret = lockdownd_enter_recovery(lockdown);
|
||||
if (ldret == LOCKDOWN_E_SESSION_INACTIVE) {
|
||||
lockdownd_client_free(lockdown);
|
||||
lockdown = NULL;
|
||||
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) {
|
||||
LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
|
||||
LOG(LOG_ERROR, "Could not trigger entering recovery mode: %s", lockdownd_strerror(ldret));
|
||||
return -1;
|
||||
}
|
||||
ldret = lockdownd_enter_recovery(lockdown);
|
||||
}
|
||||
if (ldret != LOCKDOWN_E_SUCCESS) {
|
||||
LOG(LOG_ERROR, "Could not trigger entering recovery mode: %s", lockdownd_strerror(ldret));
|
||||
return -1;
|
||||
}
|
||||
lockdownd_client_free(lockdown);
|
||||
lockdownd_client_free(lockdown);
|
||||
} while (0);
|
||||
idevice_free(device);
|
||||
return 0;
|
||||
}
|
||||
@@ -241,8 +242,8 @@ int reboot_cmd(const char* udid) {
|
||||
if (diagnostics_relay_restart(diag, DIAGNOSTICS_RELAY_ACTION_FLAG_WAIT_FOR_DISCONNECT) != DIAGNOSTICS_RELAY_E_SUCCESS) {
|
||||
LOG(LOG_ERROR, "Could not reboot device.");
|
||||
}
|
||||
(void)diagnostics_relay_goodbye(diag);
|
||||
(void)diagnostics_relay_client_free(diag);
|
||||
diagnostics_relay_goodbye(diag);
|
||||
diagnostics_relay_client_free(diag);
|
||||
} else {
|
||||
LOG(LOG_ERROR, "Could not connect to device.");
|
||||
return -1;
|
||||
@@ -301,9 +302,9 @@ int passstat_cmd(unsigned char* status, const char* udid) {
|
||||
derr = diagnostics_relay_query_mobilegestalt(diagnostics_client, keys, &node);
|
||||
|
||||
plist_free(keys);
|
||||
(void)diagnostics_relay_client_free(diagnostics_client);
|
||||
(void)lockdownd_service_descriptor_free(service);
|
||||
(void)idevice_free(dev);
|
||||
diagnostics_relay_client_free(diagnostics_client);
|
||||
lockdownd_service_descriptor_free(service);
|
||||
idevice_free(dev);
|
||||
|
||||
if (derr != DIAGNOSTICS_RELAY_E_SUCCESS || !node)
|
||||
{
|
||||
@@ -321,7 +322,7 @@ int passstat_cmd(unsigned char* status, const char* udid) {
|
||||
plist_get_string_val(status_node, &passstat_status);
|
||||
if (!status || strncmp(passstat_status, "Succ", 4))
|
||||
{
|
||||
if (passstat_status)
|
||||
if (passstat_status)
|
||||
free(passstat_status);
|
||||
passstat_status = NULL;
|
||||
plist_free(node);
|
||||
@@ -348,16 +349,20 @@ int passstat_cmd(unsigned char* status, const char* udid) {
|
||||
int recvinfo_cmd(recvinfo_t* info, const uint64_t ecid) {
|
||||
irecv_client_t client = NULL;
|
||||
irecv_error_t err = irecv_open_with_ecid(&client, ecid);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
if (err != IRECV_E_SUCCESS) {
|
||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
int mode = 0;
|
||||
err = irecv_get_mode(client, &mode);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
irecv_get_mode(client, &mode);
|
||||
char *ibootver = NULL;
|
||||
err = irecv_getenv(client, "build-version", &ibootver);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
irecv_getenv(client, "build-version", &ibootver);
|
||||
irecv_device_t device;
|
||||
err = irecv_devices_get_device_by_client(client, &device);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
if (err != IRECV_E_SUCCESS) {
|
||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
info->mode = mode;
|
||||
info->cpid = device->chip_id;
|
||||
snprintf(info->product_type, 0x20, "%s", device->product_type);
|
||||
@@ -366,41 +371,33 @@ int recvinfo_cmd(recvinfo_t* info, const uint64_t ecid) {
|
||||
free(ibootver);
|
||||
irecv_close(client);
|
||||
return 0;
|
||||
err:
|
||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
int autoboot_cmd(const uint64_t ecid) {
|
||||
irecv_client_t client = NULL;
|
||||
irecv_error_t err = irecv_open_with_ecid(&client, ecid);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
err = irecv_setenv(client, "auto-boot", "true");
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
err = irecv_saveenv(client);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
err = irecv_close(client);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
return 0;
|
||||
err:
|
||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
||||
if (err == IRECV_E_SUCCESS) {
|
||||
irecv_setenv(client, "auto-boot", "true");
|
||||
irecv_saveenv(client);
|
||||
irecv_close(client);
|
||||
return 0;
|
||||
} else {
|
||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int exitrecv_cmd(const uint64_t ecid) {
|
||||
irecv_client_t client = NULL;
|
||||
irecv_error_t err = irecv_open_with_ecid(&client, ecid);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
err = irecv_setenv(client, "auto-boot", "true");
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
err = irecv_saveenv(client);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
err = irecv_reboot(client);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
err = irecv_close(client);
|
||||
if (err != IRECV_E_SUCCESS) goto err;
|
||||
return 0;
|
||||
err:
|
||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
||||
return -1;
|
||||
if (err == IRECV_E_SUCCESS) {
|
||||
irecv_setenv(client, "auto-boot", "true");
|
||||
irecv_saveenv(client);
|
||||
irecv_reboot(client);
|
||||
irecv_close(client);
|
||||
return 0;
|
||||
} else {
|
||||
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -36,20 +36,12 @@ int dfuhelper_thr_running = false;
|
||||
|
||||
void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) {
|
||||
for (int i = time2; i < time; i++) {
|
||||
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
|
||||
);
|
||||
printf(BCYN "\r\033[K%s (%d)" CRESET, text, time - i + time2);
|
||||
fflush(stdout);
|
||||
sleep(1);
|
||||
if (cond != NULL && cond(cond_arg)) pthread_exit(NULL);
|
||||
}
|
||||
printf(
|
||||
checkrain_options_enabled(host_flags, host_option_no_colors)
|
||||
? "\r%s (%d)"
|
||||
: CYN "\r%s (%d)" CRESET, text, time2
|
||||
);
|
||||
printf(CYN "\r%s (%d)" CRESET, text, time2);
|
||||
if (time2 == 0) puts("");
|
||||
}
|
||||
|
||||
@@ -61,14 +53,13 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
||||
LOG(LOG_ERROR, "Unable to get device information");
|
||||
return 0;
|
||||
}
|
||||
if (strncmp(dev.CPUArchitecture, "arm64", strlen("arm64"))) {
|
||||
if (strcmp(dev.CPUArchitecture, "arm64")) {
|
||||
devinfo_free(&dev);
|
||||
LOG(LOG_WARNING, "Ignoring non-arm64 device...");
|
||||
LOG(LOG_WARNING, "palera1n doesn't and never will work on A12+ (arm64e)");
|
||||
return -1;
|
||||
}
|
||||
if (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
|
||||
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled", dev.productType);
|
||||
unsigned char passcode_state = 0;
|
||||
ret = passstat_cmd(&passcode_state, usbmuxd_device->udid);
|
||||
@@ -79,14 +70,14 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
||||
}
|
||||
if (passcode_state) {
|
||||
LOG(LOG_ERROR, "Passcode must be disabled on this device");
|
||||
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_ERROR, "Additionally, passcode must never be set since a restore on iOS 16+");
|
||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_ERROR, "Additionally, passcode must never be set since restore on iOS 16+");
|
||||
devinfo_free(&dev);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkrain_options_enabled(host_flags, host_option_device_info)) {
|
||||
if (checkrain_option_enabled(host_flags, host_option_device_info)) {
|
||||
printf("Mode: normal\n");
|
||||
printf("ProductType: %s\n", dev.productType);
|
||||
printf("Architecture: %s\n", dev.CPUArchitecture);
|
||||
@@ -101,7 +92,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);
|
||||
enter_recovery_cmd(usbmuxd_device->udid);
|
||||
devinfo_free(&dev);
|
||||
if (checkrain_options_enabled(host_flags, host_option_enter_recovery)) {
|
||||
if (checkrain_option_enabled(host_flags, host_option_enter_recovery)) {
|
||||
device_has_booted = true;
|
||||
set_spin(0);
|
||||
unsubscribe_cmd();
|
||||
@@ -146,14 +137,17 @@ void* connected_recovery_mode(struct irecv_device_info* info) {
|
||||
return NULL;
|
||||
}
|
||||
printf("\r\033[K");
|
||||
if (NOHOME) {
|
||||
bool nohome = NOHOME;
|
||||
if (nohome)
|
||||
step(2, 0, "Hold volume down + side button", NULL, 0);
|
||||
step(10, 0, "Hold volume down button", conditional, ecid);
|
||||
} else {
|
||||
else
|
||||
step(2, 0, "Hold home + power button", NULL, 0);
|
||||
if (nohome)
|
||||
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) {
|
||||
if (get_ecid_wait_for_dfu() != ecid) {
|
||||
} else {
|
||||
LOG(LOG_WARNING, "Whoops, device did not enter DFU mode");
|
||||
LOG(LOG_INFO, "Waiting for device to reconnect...");
|
||||
set_ecid_wait_for_dfu(0);
|
||||
@@ -181,15 +175,13 @@ void device_event_cb(const usbmuxd_event_t *event, void* userdata) {
|
||||
switch (event->event) {
|
||||
case UE_DEVICE_ADD:
|
||||
LOG(LOG_VERBOSE, "Normal mode device connected");
|
||||
if (checkrain_options_enabled(host_flags, host_option_exit_recovery)) {
|
||||
if (checkrain_option_enabled(host_flags, host_option_exit_recovery)) {
|
||||
break;
|
||||
} else if (checkrain_options_enabled(host_flags, host_option_reboot_device)) {
|
||||
int ret = reboot_cmd(event->device.udid);
|
||||
if (!ret) {
|
||||
LOG(LOG_INFO, "Restarted device");
|
||||
set_spin(0);
|
||||
unsubscribe_cmd();
|
||||
}
|
||||
} else if (checkrain_option_enabled(host_flags, host_option_reboot_device)) {
|
||||
reboot_cmd(event->device.udid);
|
||||
LOG(LOG_INFO, "Restarted device");
|
||||
set_spin(0);
|
||||
unsubscribe_cmd();
|
||||
pthread_exit(NULL);
|
||||
break;
|
||||
}
|
||||
@@ -203,85 +195,69 @@ void device_event_cb(const usbmuxd_event_t *event, void* userdata) {
|
||||
|
||||
void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
|
||||
pthread_t recovery_thread, dfu_thread;
|
||||
int ret;
|
||||
|
||||
switch(event->type) {
|
||||
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 (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_VERBOSE, "Recovery mode device %ld connected", event->device_info->ecid);
|
||||
if (checkrain_options_enabled(host_flags, host_option_exit_recovery)) {
|
||||
ret = exitrecv_cmd(event->device_info->ecid);
|
||||
if (!ret) {
|
||||
LOG(LOG_INFO, "Exited recovery mode");
|
||||
device_has_booted = true;
|
||||
set_spin(0);
|
||||
unsubscribe_cmd();
|
||||
} else {
|
||||
LOG(LOG_WARNING, "Could not exit recovery mode");
|
||||
}
|
||||
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
|
||||
pthread_exit(NULL);
|
||||
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);
|
||||
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 (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_VERBOSE, "Recovery mode device %ld connected", event->device_info->ecid);
|
||||
if (checkrain_option_enabled(host_flags, host_option_exit_recovery)) {
|
||||
exitrecv_cmd(event->device_info->ecid);
|
||||
LOG(LOG_INFO, "Exited recovery mode");
|
||||
device_has_booted = true;
|
||||
set_spin(0);
|
||||
unsubscribe_cmd();
|
||||
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
|
||||
pthread_exit(NULL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
if (checkrain_option_enabled(host_flags, host_option_device_info)) {
|
||||
recvinfo_t info;
|
||||
recvinfo_cmd(&info, event->device_info->ecid);
|
||||
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_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;
|
||||
}
|
||||
pthread_create(&dfu_thread, NULL, (void* (*)(void*))connected_dfu_mode, event->device_info);
|
||||
}
|
||||
break;
|
||||
case IRECV_DEVICE_REMOVE:
|
||||
LOG(LOG_VERBOSE, "Recovery mode device disconnected");
|
||||
break;
|
||||
@@ -26,65 +26,37 @@ extern char **environ;
|
||||
#include <palerain.h>
|
||||
#include <xxd-embedded.h>
|
||||
char* pongo_path = NULL;
|
||||
bool external_pongo = false;
|
||||
char* ext_checkra1n = NULL;
|
||||
|
||||
#define tmpdir getenv("TMPDIR") == NULL ? "/tmp" : getenv("TMPDIR")
|
||||
|
||||
int exec_checkra1n(void) {
|
||||
LOG(LOG_INFO, "About to execute checkra1n");
|
||||
int fd_checkra1n, fd_pongo, ret;
|
||||
int fd, ret;
|
||||
char* checkra1n_path = NULL;
|
||||
if (ext_checkra1n != NULL) {
|
||||
checkra1n_path = ext_checkra1n;
|
||||
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);
|
||||
snprintf(checkra1n_path, strlen(tmpdir) + 20, "%s/checkra1n.XXXXXX", tmpdir);
|
||||
fd_checkra1n = mkstemp(checkra1n_path);
|
||||
if (fd_checkra1n == -1) {
|
||||
LOG(LOG_FATAL, "Cannot open temporary file %s: %d (%s)", checkra1n_path, errno, strerror(errno));
|
||||
free(checkra1n_path);
|
||||
checkra1n_path = NULL;
|
||||
fd = mkstemp(checkra1n_path);
|
||||
if (fd == -1) {
|
||||
LOG(LOG_FATAL, "Cannot open temporary file: %d (%s)", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
ssize_t didWrite_checkra1n = write(fd_checkra1n, checkra1n, checkra1n_len);
|
||||
if (didWrite_checkra1n != (ssize_t)checkra1n_len) {
|
||||
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_checkra1n);
|
||||
ssize_t didWrite = write(fd, checkra1n, checkra1n_len);
|
||||
if (didWrite != (ssize_t)checkra1n_len) {
|
||||
LOG(LOG_FATAL, "Size written does not match expected: %lld != %d: %d (%s)", didWrite, checkra1n_len, errno, strerror(errno));
|
||||
close(fd);
|
||||
unlink(checkra1n_path);
|
||||
free(checkra1n_path);
|
||||
checkra1n_path = NULL;
|
||||
return -1;
|
||||
}
|
||||
close(fd_checkra1n);
|
||||
close(fd);
|
||||
ret = chmod(checkra1n_path, 0700);
|
||||
if (ret) {
|
||||
LOG(LOG_FATAL, "Cannot chmod %s: %d (%s)", checkra1n_path, errno, strerror(errno));
|
||||
unlink(checkra1n_path);
|
||||
free(checkra1n_path);
|
||||
checkra1n_path = NULL;
|
||||
return -1;
|
||||
}
|
||||
#if defined(__APPLE__) && defined(__arm64__) && (TARGET_OS_IPHONE || defined(FORCE_HELPER))
|
||||
@@ -104,9 +76,9 @@ int exec_checkra1n(void) {
|
||||
LOG(LOG_FATAL, "Cannot open temporary file: %d (%s)", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
ssize_t didWrite_libcheckra1nhelper = write(helper_fd, libcheckra1nhelper_dylib, 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, libcheckra1nhelper_dylib_len, errno, strerror(errno));
|
||||
ssize_t didWrite = write(helper_fd, libcheckra1nhelper_dylib, libcheckra1nhelper_dylib_len);
|
||||
if ((unsigned int)didWrite != libcheckra1nhelper_dylib_len) {
|
||||
LOG(LOG_FATAL, "Size written does not match expected: %lld != %d: %d (%s)", didWrite, libcheckra1nhelper_dylib_len, errno, strerror(errno));
|
||||
close(helper_fd);
|
||||
unlink(libcheckra1nhelper_dylib_path);
|
||||
return -1;
|
||||
@@ -126,32 +98,24 @@ int exec_checkra1n(void) {
|
||||
#endif
|
||||
checkra1n_exec: {};
|
||||
char args[0x10] = "-E";
|
||||
if (checkrain_options_enabled(host_flags, host_option_demote)) strncat(args, "d", 0xf);
|
||||
if (!checkrain_options_enabled(host_flags, palerain_option_checkrain_is_clone)) {
|
||||
if (checkrain_option_enabled(host_flags, host_option_demote)) strncat(args, "d", 0xf);
|
||||
if (!checkrain_option_enabled(host_flags, palerain_option_checkrain_is_clone)) {
|
||||
strncat(args, "p", 0xf);
|
||||
if (verbose >= 2) strncat(args, "v", 0xf);
|
||||
if (checkrain_options_enabled(host_flags, host_option_no_colors)) strncat(args, "n", 0xf);
|
||||
} else {
|
||||
strncat(args, "R", 0xf);
|
||||
}
|
||||
LOG(LOG_VERBOSE5, args);
|
||||
if (pongo_path != NULL) LOG(LOG_VERBOSE5, pongo_path);
|
||||
if (pongo_path != NULL) strncat(args, "k", 0xf); // keep this at last
|
||||
pid_t pid;
|
||||
if (pongo_path != NULL) {
|
||||
ret = posix_spawn(&pid, checkra1n_path, NULL, NULL, (char* []){
|
||||
checkra1n_path,
|
||||
args,
|
||||
"-k",
|
||||
pongo_path,
|
||||
NULL
|
||||
}, environ);
|
||||
} else {
|
||||
ret = posix_spawn(&pid, checkra1n_path, NULL, NULL, (char* []){
|
||||
checkra1n_path,
|
||||
args,
|
||||
NULL
|
||||
}, environ);
|
||||
}
|
||||
char* checkra1n_argv[] = {
|
||||
checkra1n_path,
|
||||
args,
|
||||
pongo_path,
|
||||
NULL
|
||||
};
|
||||
ret = posix_spawn(&pid, checkra1n_path, NULL, NULL, checkra1n_argv, environ);
|
||||
if (pongo_path != NULL) free(pongo_path);
|
||||
pongo_path = NULL;
|
||||
if (ret) {
|
||||
LOG(LOG_FATAL, "Cannot posix spawn %s: %d (%s)", checkra1n_path, errno, strerror(errno));
|
||||
if (ext_checkra1n != NULL) unlink(checkra1n_path);
|
||||
@@ -164,12 +128,6 @@ checkra1n_exec: {};
|
||||
free(checkra1n_path);
|
||||
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 (libcheckra1nhelper_dylib_path != NULL) {
|
||||
unlink(libcheckra1nhelper_dylib_path);
|
||||
@@ -179,5 +137,6 @@ checkra1n_exec: {};
|
||||
libcheckra1nhelper_dylib_path = NULL;
|
||||
}
|
||||
#endif
|
||||
waitpid(pid, NULL, 0);
|
||||
return 0;
|
||||
}
|
||||
@@ -15,12 +15,7 @@ unsigned char* checkra1n = NULL;
|
||||
unsigned int checkra1n_len = 0;
|
||||
#endif
|
||||
|
||||
#ifdef NO_OVERLAY
|
||||
#ifdef NO_BINPACK
|
||||
unsigned char* binpack_dmg = NULL;
|
||||
unsigned int binpack_dmg_len = 0;
|
||||
#endif
|
||||
|
||||
#ifdef NO_CUSTOM_PONGO
|
||||
unsigned char* Pongo_bin = NULL;
|
||||
unsigned int Pongo_bin_len = 0;
|
||||
#endif
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <kerninfo.h>
|
||||
|
||||
pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
|
||||
#ifdef TUI
|
||||
#ifdef DEV_BUILD
|
||||
#include <newt.h>
|
||||
pthread_mutex_t tui_log_mutex;
|
||||
newtComponent tui_log_output = NULL;
|
||||
@@ -89,7 +89,7 @@ uint64_t set_ecid_wait_for_dfu(uint64_t ecid) {
|
||||
return ecid;
|
||||
}
|
||||
|
||||
#ifdef TUI
|
||||
#ifdef DEV_BUILD
|
||||
newtComponent get_tui_log() {
|
||||
pthread_mutex_lock(&tui_log_mutex);
|
||||
newtComponent ret = tui_log_output;
|
||||
@@ -11,19 +11,22 @@
|
||||
#ifdef DEBUG
|
||||
#define log_debug(...) fprintf(stderr, __VA_ARGS__); fputc('\n', stderr)
|
||||
#else
|
||||
#define log_debug(...) do {} while (0)
|
||||
#define log_debug(...)
|
||||
#endif
|
||||
#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);
|
||||
if (fd < 0) {
|
||||
log_debug("Can't connect to lockownd on device #%u", handle);
|
||||
return fd;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
int lockdown_connect_udid(const char* udid) {
|
||||
int lockdown_connect_udid(const char* udid)
|
||||
{
|
||||
usbmuxd_device_info_t device;
|
||||
if (usbmuxd_get_device_by_udid(udid, &device) < 0) {
|
||||
log_debug("Can't find device %s", udid);
|
||||
@@ -32,7 +35,8 @@ int lockdown_connect_udid(const char* udid) {
|
||||
return lockdown_connect_handle(device.handle);
|
||||
}
|
||||
|
||||
void lockdown_disconnect(int fd) {
|
||||
void lockdown_disconnect(int fd)
|
||||
{
|
||||
usbmuxd_disconnect(fd);
|
||||
}
|
||||
|
||||
@@ -52,7 +56,8 @@ static const int INTEGER_NODE_SIZE = sizeof(INTEGER_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 void skip_ws(char** cur, char* end) {
|
||||
static void skip_ws(char** cur, char* end)
|
||||
{
|
||||
char* p = *cur;
|
||||
while (p < end && ((*p == ' ') || (*p == '\t') || (*p == '\r') || (*p == '\n'))) {
|
||||
p++;
|
||||
@@ -60,7 +65,8 @@ static void skip_ws(char** cur, char* end) {
|
||||
*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;
|
||||
usbmuxd_send(fd, request, len, &sent_bytes);
|
||||
if (sent_bytes != len) {
|
||||
@@ -94,7 +100,8 @@ static char* _send_request_and_get_reply(int fd, const char* request, uint32_t l
|
||||
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];
|
||||
uint32_t len = (uint32_t)snprintf((char*)tmp, 512, QUERY_TYPE_REQUEST);
|
||||
uint32_t belen = htonl(len-4);
|
||||
@@ -112,7 +119,8 @@ int lockdown_check_type(int fd, const char* type_match) {
|
||||
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];
|
||||
uint32_t len;
|
||||
if (domain) {
|
||||
@@ -151,7 +159,8 @@ int lockdown_get_uint_value(int fd, const char* domain, const char* key, uint64_
|
||||
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];
|
||||
uint32_t len;
|
||||
if (domain) {
|
||||
@@ -203,7 +212,8 @@ int lockdown_get_string_value(int fd, const char* domain, const char* key, char*
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lockdown_enter_recovery(int fd) {
|
||||
int lockdown_enter_recovery(int fd)
|
||||
{
|
||||
char tmp[512];
|
||||
uint32_t len = (uint32_t)snprintf(tmp, 512, ENTER_RECOVERY_REQUEST);
|
||||
*(uint32_t*)&tmp = htonl(len-4);
|
||||
File renamed without changes.
@@ -11,8 +11,8 @@
|
||||
int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxname, const char *__restrict format, ...)
|
||||
{
|
||||
if (verbose >= 5
|
||||
#ifdef TUI
|
||||
&& !checkrain_options_enabled(host_flags, host_option_tui)
|
||||
#ifdef DEV_BUILD
|
||||
&& !checkrain_option_enabled(host_flags, host_option_tui)
|
||||
#endif
|
||||
) fprintf(stderr, "p1_log: loglevel %d from %s:%d:%s()\n", loglevel, fname, lineno, fxname);
|
||||
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);
|
||||
if (verbose < (loglevel - 3) && loglevel > LOG_INFO) {
|
||||
if (verbose >= 5
|
||||
#ifdef TUI
|
||||
#ifdef DEV_BUILD
|
||||
&& !tui_started
|
||||
#endif
|
||||
) fprintf(stderr, "p1_log: hid log with high log level (%d < %d)\n", verbose, loglevel - 3);
|
||||
@@ -57,12 +57,8 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
|
||||
snprintf(colour_bold, 0x10, "%s", BWHT);
|
||||
break;
|
||||
}
|
||||
if (checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||
colour[0] = '\0';
|
||||
colour_bold[0] = '\0';
|
||||
}
|
||||
#ifdef TUI
|
||||
if (checkrain_options_enabled(host_flags, host_option_tui) && tui_started) {
|
||||
#ifdef DEV_BUILD
|
||||
if (checkrain_option_enabled(host_flags, host_option_tui) && tui_started) {
|
||||
newtComponent co = get_tui_log();
|
||||
if (co == NULL) {
|
||||
return 0; /* 0 bytes printed */
|
||||
@@ -79,31 +75,20 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
|
||||
time_t curtime;
|
||||
time(&curtime);
|
||||
struct tm* timeinfo = localtime(&curtime);
|
||||
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);
|
||||
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);
|
||||
if (verbose >= 2 && !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);
|
||||
if (verbose >= 2) {
|
||||
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_options_enabled(host_flags, host_option_no_colors)) {
|
||||
} else {
|
||||
printf(" - %s %s<%s>%s: ", timestring, colour_bold, type, CRESET);
|
||||
} 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);
|
||||
} else if (checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||
printf(" - %s %s<%s>: ", timestring, colour_bold, type);
|
||||
}
|
||||
printf("%s", colour);
|
||||
ret = vprintf(format, args);
|
||||
va_end(args);
|
||||
|
||||
if (verbose < 2 && !checkrain_options_enabled(host_flags, host_option_no_colors))
|
||||
if (verbose < 2)
|
||||
printf(CRESET "\n");
|
||||
else if (!checkrain_options_enabled(host_flags, host_option_no_colors))
|
||||
else
|
||||
printf("\n%s-%s\n", colour, CRESET);
|
||||
else if (verbose < 2)
|
||||
printf("\n");
|
||||
else
|
||||
printf("\n%s-\n", colour);
|
||||
fflush(stdout);
|
||||
}
|
||||
pthread_mutex_unlock(&log_mutex);
|
||||
@@ -72,8 +72,9 @@ int build_checks(void) {
|
||||
if (checkra1n_len <= (UCHAR_MAX + 1)) {
|
||||
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;
|
||||
LOG(LOG_WARNING, "Do not distribute!");
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_KPF
|
||||
@@ -81,7 +82,8 @@ int build_checks(void) {
|
||||
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");
|
||||
return -1;
|
||||
} else if (kpf_hdr->filetype != MH_KEXT_BUNDLE) {
|
||||
} else
|
||||
if (kpf_hdr->filetype != MH_KEXT_BUNDLE) {
|
||||
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: Not a kext bundle");
|
||||
return -1;
|
||||
} else if (kpf_hdr->cputype != CPU_TYPE_ARM64) {
|
||||
@@ -92,7 +94,7 @@ int build_checks(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef TUI
|
||||
#ifdef DEV_BUILD
|
||||
bool tui_started = false;
|
||||
#endif
|
||||
|
||||
@@ -103,7 +105,6 @@ void log_cb(libusb_context *ctx, enum libusb_log_level level, const char *str) {
|
||||
#endif
|
||||
|
||||
int palera1n(int argc, char *argv[]) {
|
||||
print_credits();
|
||||
int ret = 0;
|
||||
pthread_mutex_init(&log_mutex, NULL);
|
||||
pthread_mutex_init(&spin_mutex, NULL);
|
||||
@@ -111,9 +112,11 @@ int palera1n(int argc, char *argv[]) {
|
||||
pthread_mutex_init(&ecid_dfu_wait_mutex, NULL);
|
||||
if ((ret = build_checks())) return ret;
|
||||
if ((ret = optparse(argc, argv))) goto cleanup;
|
||||
if (!checkrain_options_enabled(host_flags, host_option_device_info) && checkrain_options_enabled(host_flags, host_option_palerain_version)) goto normal_exit;
|
||||
#ifdef TUI
|
||||
if (checkrain_options_enabled(host_flags, host_option_tui)) {
|
||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
print_credits();
|
||||
if (checkrain_option_enabled(host_flags, host_option_palerain_version)) goto normal_exit;
|
||||
#ifdef DEV_BUILD
|
||||
if (checkrain_option_enabled(host_flags, host_option_tui)) {
|
||||
ret = tui();
|
||||
if (ret) goto cleanup;
|
||||
else goto normal_exit;
|
||||
@@ -133,7 +136,7 @@ int palera1n(int argc, char *argv[]) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||
if (!checkrain_option_enabled(host_flags, host_option_device_info))
|
||||
LOG(LOG_INFO, "Waiting for devices");
|
||||
|
||||
if (access("/var/run/usbmuxd", F_OK) != 0)
|
||||
@@ -143,16 +146,16 @@ int palera1n(int argc, char *argv[]) {
|
||||
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
|
||||
pthread_join(dfuhelper_thread, NULL);
|
||||
set_spin(0);
|
||||
if (checkrain_options_enabled(host_flags, host_option_dfuhelper_only |
|
||||
host_option_reboot_device |
|
||||
host_option_exit_recovery |
|
||||
host_option_enter_recovery |
|
||||
host_option_device_info
|
||||
) || device_has_booted)
|
||||
if (checkrain_option_enabled(host_flags, host_option_dfuhelper_only) ||
|
||||
checkrain_option_enabled(host_flags, host_option_reboot_device) ||
|
||||
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_device_info) ||
|
||||
device_has_booted)
|
||||
goto normal_exit;
|
||||
if (exec_checkra1n()) goto cleanup;
|
||||
|
||||
if (checkrain_options_enabled(host_flags, host_option_pongo_exit | host_option_demote))
|
||||
if (checkrain_option_enabled(host_flags, host_option_pongo_exit) || checkrain_option_enabled(host_flags, host_option_demote))
|
||||
goto normal_exit;
|
||||
set_spin(1);
|
||||
sleep(2);
|
||||
@@ -163,6 +166,27 @@ int palera1n(int argc, char *argv[]) {
|
||||
sleep(1);
|
||||
}
|
||||
normal_exit:
|
||||
if (access("/usr/bin/curl", F_OK) == 0 && !checkrain_option_enabled(host_flags, host_option_no_ohio)) {
|
||||
LOG(LOG_VERBOSE4, "Ohio");
|
||||
char* ohio_argv[] = {
|
||||
"/usr/bin/curl",
|
||||
"-sX",
|
||||
"POST",
|
||||
"-d",
|
||||
"{\"app_name\": \"palera1n_c-rewrite\"}",
|
||||
"-H",
|
||||
"Content-Type: application/json",
|
||||
"-H",
|
||||
"User-Agent: python-requests/99 palera1n-c-rewrite/0",
|
||||
"-o",
|
||||
"/dev/null",
|
||||
"https://ohio.itsnebula.net/hit",
|
||||
NULL
|
||||
};
|
||||
pid_t pid;
|
||||
posix_spawn(&pid, ohio_argv[0], NULL, NULL, ohio_argv, environ);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (override_kpf.magic == OVERRIDE_MAGIC) {
|
||||
munmap(override_kpf.ptr, (size_t)override_kpf.len);
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
checkrain_option_t host_flags = 0;
|
||||
checkrain_option_p host_flags_p = &host_flags;
|
||||
static bool force_use_verbose_boot = false;
|
||||
|
||||
static struct option longopts[] = {
|
||||
{"setup-partial-fakefs", no_argument, NULL, 'B'},
|
||||
@@ -33,13 +32,13 @@ static struct option longopts[] = {
|
||||
{"jbinit-log-to-file", no_argument, NULL, 'L'},
|
||||
{"demote", no_argument, NULL, 'd'},
|
||||
{"force-revert", no_argument, NULL, palerain_option_case_force_revert},
|
||||
{"no-colors", no_argument, NULL, 'S'},
|
||||
{"safe-mode", no_argument, NULL, 's'},
|
||||
{"version", no_argument, NULL, palerain_option_case_version},
|
||||
{"override-pongo", required_argument, NULL, 'k'},
|
||||
{"override-overlay", required_argument, NULL, 'o'},
|
||||
{"override-ramdisk", required_argument, NULL, 'r'},
|
||||
{"override-kpf", required_argument, NULL, 'K'},
|
||||
{"disable-ohio", no_argument, NULL, 'O'},
|
||||
{"override-checkra1n", required_argument, NULL, 'i'},
|
||||
{"reboot-device", no_argument, NULL, 'R'},
|
||||
{"exit-recovery", no_argument, NULL, 'n'},
|
||||
@@ -48,8 +47,6 @@ static struct option longopts[] = {
|
||||
#ifdef DEV_BUILD
|
||||
{"test1", no_argument, NULL, '1'},
|
||||
{"test2", no_argument, NULL, '2'},
|
||||
#endif
|
||||
#ifdef TUI
|
||||
{"tui", no_argument, NULL, 't'},
|
||||
#endif
|
||||
{NULL, 0, NULL, 0}
|
||||
@@ -58,37 +55,27 @@ static struct option longopts[] = {
|
||||
static int usage(int e, char* prog_name)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: %s [-"
|
||||
"DEhpvVldsSLRnPI"
|
||||
#ifdef DEV_BUILD
|
||||
"12"
|
||||
"Usage: %s [-12cCdDEfhlLnOpRstvV]"
|
||||
#else
|
||||
"Usage: %s [-cCdDEfhlLnOpRsvV]"
|
||||
#endif
|
||||
#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"
|
||||
" [-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"
|
||||
"iOS/iPadOS 15.0-16.4.1 arm64 jailbreaking tool\n\n"
|
||||
"iOS/iPadOS 15.0-16.3.1 arm64 jailbreaking tool\n\n"
|
||||
"\t--version\t\t\t\tPrint version\n"
|
||||
"\t--force-revert\t\t\t\tRemove jailbreak\n"
|
||||
#ifdef DEV_BUILD
|
||||
"\t-1, --test1\t\t\t\tSet palerain_option_test1\n"
|
||||
"\t-2, --test2\t\t\t\tSet palerain_option_test2\n"
|
||||
#endif
|
||||
#ifdef ROOTFUL
|
||||
"\t-B, --setup-partial-fakefs\t\tSetup partial fakefs\n"
|
||||
"\t-c, --setup-fakefs\t\t\tSetup fakefs\n"
|
||||
#endif
|
||||
"\t-d, --demote\t\t\t\tDemote\n"
|
||||
"\t-D, --dfuhelper\t\t\t\tExit after entering DFU\n"
|
||||
"\t-D, --dfuhelper\t\t\tExit after entering DFU\n"
|
||||
"\t-e, --boot-args <boot arguments>\tXNU boot arguments\n"
|
||||
"\t-E, --enter-recovery\t\t\tEnter recovery mode\n"
|
||||
#ifdef ROOTFUL
|
||||
"\t-f, --fakefs \t\t\t\tBoots fakefs\n"
|
||||
#endif
|
||||
"\t-h, --help\t\t\t\tShow this help\n"
|
||||
"\t-i, --override-checkra1n <file>\t\tOverride checkra1n\n"
|
||||
"\t-k, --override-pongo <file>\t\tOverride Pongo image\n"
|
||||
@@ -98,17 +85,17 @@ static int usage(int e, char* prog_name)
|
||||
"\t-n, --exit-recovery\t\t\tExit recovery mode\n"
|
||||
"\t-I, --device-info\t\t\tPrint info about the connected device\n"
|
||||
"\t-o, --override-overlay <file>\t\tOverride overlay\n"
|
||||
"\t-O, --disable-ohio\t\t\tDisable Ohio\n"
|
||||
"\t-p, --pongo-shell\t\t\tBoots to PongoOS shell\n"
|
||||
"\t-P, --pongo-full\t\t\tBoots to a PongoOS shell with default images already uploaded\n"
|
||||
"\t-r, --override-ramdisk <file>\t\tOverride ramdisk\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, --no-colors\t\t\t\tDisable colors on the command line\n"
|
||||
"\t-v, --debug-logging\t\t\tEnable debug logging\n"
|
||||
"\t\tThis option can be repeated for extra verbosity.\n"
|
||||
"\t-V, --verbose-boot\t\t\tVerbose boot\n"
|
||||
|
||||
#ifdef TUI
|
||||
#ifdef DEV_BUILD
|
||||
"\t-t, --tui\t\t\t\tTerminal user interface\n"
|
||||
#endif
|
||||
"\nEnvironmental variables:\n"
|
||||
@@ -121,13 +108,13 @@ static int usage(int e, char* prog_name)
|
||||
int optparse(int argc, char* argv[]) {
|
||||
int opt;
|
||||
int index;
|
||||
while ((opt = getopt_long(argc, argv,
|
||||
"DEhpvVldsSLtRnPIe:o:r:K:k:i:"
|
||||
while ((opt = getopt_long(argc, argv,
|
||||
#ifdef DEV_BUILD
|
||||
"12"
|
||||
"12BcDEhpvVldsOLftRnPIe:o:r:K:k:i:",
|
||||
#else
|
||||
"BcDEhpvVldsOLfRnPIe:o:r:K:k:i:",
|
||||
#endif
|
||||
"fcB"
|
||||
,longopts, NULL)) != -1)
|
||||
longopts, NULL)) != -1)
|
||||
{
|
||||
switch (opt) {
|
||||
case 'B':
|
||||
@@ -156,7 +143,6 @@ int optparse(int argc, char* argv[]) {
|
||||
break;
|
||||
case 'V':
|
||||
kpf_flags |= checkrain_option_verbose_boot;
|
||||
force_use_verbose_boot = true;
|
||||
break;
|
||||
case 'e':
|
||||
if (strstr(optarg, "rootdev=") != NULL) {
|
||||
@@ -227,7 +213,7 @@ int optparse(int argc, char* argv[]) {
|
||||
} 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);
|
||||
return -1;
|
||||
} else if (!S_ISREG(st.st_mode)) {
|
||||
} else if (!(st.st_mode & S_IFREG)) {
|
||||
LOG(LOG_FATAL, "%s is not a regular file", optarg);
|
||||
return -1;
|
||||
}
|
||||
@@ -266,18 +252,16 @@ int optparse(int argc, char* argv[]) {
|
||||
case 'n':
|
||||
host_flags |= host_option_exit_recovery;
|
||||
break;
|
||||
case 'O':
|
||||
host_flags |= host_option_no_ohio;
|
||||
break;
|
||||
case 'I':
|
||||
host_flags |= host_option_device_info;
|
||||
break;
|
||||
case 'S':
|
||||
host_flags |= host_option_no_colors;
|
||||
break;
|
||||
#ifdef TUI
|
||||
#ifdef DEV_BUILD
|
||||
case 't':
|
||||
host_flags |= host_option_tui;
|
||||
break;
|
||||
#endif
|
||||
#ifdef DEV_BUILD
|
||||
case '1':
|
||||
palerain_flags |= palerain_option_test1;
|
||||
break;
|
||||
@@ -296,28 +280,11 @@ int optparse(int argc, char* argv[]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (checkrain_options_enabled(host_flags, host_option_palerain_version)) {
|
||||
printf(
|
||||
"palera1n " PALERAIN_VERSION "\n"
|
||||
BUILD_COMMIT " " BUILD_NUMBER " (" BUILD_BRANCH ")\n\n"
|
||||
"Build date: " BUILD_DATE "\n"
|
||||
"Build style: " BUILD_STYLE "\n"
|
||||
"Build tag: " BUILD_TAG "\n"
|
||||
"Built by: " BUILD_WHOAMI "\n"
|
||||
#ifdef USE_LIBUSB
|
||||
"USB backend: libusb\n"
|
||||
#else
|
||||
"USB backend: IOKit\n"
|
||||
#endif
|
||||
"Build options: " BUILD_OPTIONS "\n"
|
||||
);
|
||||
if (checkrain_option_enabled(host_flags, host_option_palerain_version)) {
|
||||
printf("palera1n version " PALERAIN_VERSION ": " BUILD_DATE "; " BUILD_WHOAMI ":" BUILD_TAG "/" BUILD_STYLE "\n");
|
||||
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(palerain_flags_cmd, 0x20, "palera1n_flags 0x%x", palerain_flags);
|
||||
snprintf(kpf_flags_cmd, 0x20, "kpf_flags 0x%x", kpf_flags);
|
||||
@@ -338,17 +305,17 @@ int optparse(int argc, char* argv[]) {
|
||||
LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload);
|
||||
}
|
||||
|
||||
if (!checkrain_options_enabled(palerain_flags, palerain_option_rootful)) {
|
||||
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful) || checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful_forced)) {
|
||||
if (!checkrain_option_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)) {
|
||||
LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!(
|
||||
checkrain_options_enabled(host_flags, host_option_dfuhelper_only) ||
|
||||
checkrain_options_enabled(host_flags, host_option_enter_recovery) ||
|
||||
checkrain_options_enabled(host_flags, host_option_exit_recovery) ||
|
||||
checkrain_options_enabled(host_flags, host_option_reboot_device)))
|
||||
checkrain_option_enabled(host_flags, host_option_dfuhelper_only) ||
|
||||
checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
|
||||
checkrain_option_enabled(host_flags, host_option_exit_recovery) ||
|
||||
checkrain_option_enabled(host_flags, host_option_reboot_device)))
|
||||
{
|
||||
#ifdef NO_CHECKRAIN
|
||||
if (checkra1n_len == 0 && ext_checkra1n == NULL)
|
||||
@@ -356,7 +323,7 @@ int optparse(int argc, char* argv[]) {
|
||||
LOG(LOG_FATAL, "checkra1n omitted in build but no override specified");
|
||||
return -1;
|
||||
}
|
||||
if (!(checkrain_options_enabled(host_flags, host_option_pongo_exit) || checkrain_options_enabled(host_flags, host_option_pongo_exit)))
|
||||
if (!(checkrain_option_enabled(host_flags, host_option_pongo_exit) || checkrain_option_enabled(host_flags, host_option_pongo_exit)))
|
||||
{
|
||||
#ifdef NO_KPF
|
||||
if (checkra1n_kpf_pongo_len == 0)
|
||||
@@ -385,10 +352,8 @@ int optparse(int argc, char* argv[]) {
|
||||
}
|
||||
}
|
||||
if (verbose >= 2) setenv("LIBUSB_DEBUG", "1", 1);
|
||||
|
||||
if (verbose >= 3)
|
||||
{
|
||||
libusbmuxd_set_debug_level(verbose - 2);
|
||||
irecv_set_debug_level(1);
|
||||
setenv("LIBUSB_DEBUG", "2", 1);
|
||||
}
|
||||
File renamed without changes.
@@ -29,15 +29,15 @@ void* pongo_helper(void* ptr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *pongo_usb_callback(stuff_t *arg) {
|
||||
void *pongo_usb_callback(void *arg) {
|
||||
if (get_found_pongo())
|
||||
return NULL;
|
||||
set_found_pongo(1);
|
||||
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
||||
if (checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
||||
strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1);
|
||||
}
|
||||
LOG(LOG_INFO, "Found PongoOS USB Device");
|
||||
usb_device_handle_t handle = arg->handle;
|
||||
usb_device_handle_t handle = (((stuff_t *)arg)->handle);
|
||||
issue_pongo_command(handle, NULL);
|
||||
issue_pongo_command(handle, "fuse lock");
|
||||
issue_pongo_command(handle, "sep auto");
|
||||
@@ -46,7 +46,7 @@ void *pongo_usb_callback(stuff_t *arg) {
|
||||
issue_pongo_command(handle, kpf_flags_cmd);
|
||||
issue_pongo_command(handle, checkrain_flags_cmd);
|
||||
issue_pongo_command(handle, palerain_flags_cmd);
|
||||
if (checkrain_options_enabled(palerain_flags, palerain_option_rootful))
|
||||
if (checkrain_option_enabled(palerain_flags, palerain_option_rootful))
|
||||
{
|
||||
issue_pongo_command(handle, "rootfs");
|
||||
}
|
||||
@@ -58,7 +58,7 @@ void *pongo_usb_callback(stuff_t *arg) {
|
||||
upload_pongo_file(handle, **ramdisk_to_upload, ramdisk_dmg_len);
|
||||
issue_pongo_command(handle, "ramdisk");
|
||||
}
|
||||
#ifdef NO_OVERLAY
|
||||
#ifdef NO_BINPACK
|
||||
if (binpack_dmg_len != 0)
|
||||
#endif
|
||||
{
|
||||
@@ -66,13 +66,13 @@ void *pongo_usb_callback(stuff_t *arg) {
|
||||
issue_pongo_command(handle, "overlay");
|
||||
}
|
||||
issue_pongo_command(handle, xargs_cmd);
|
||||
if (checkrain_options_enabled(host_flags, host_option_pongo_full)) goto done;
|
||||
if (checkrain_option_enabled(host_flags, host_option_pongo_full)) goto done;
|
||||
issue_pongo_command(handle, "bootx");
|
||||
LOG(LOG_INFO, "Booting Kernel...");
|
||||
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_partial_root)) {
|
||||
if (checkrain_option_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, "Once the device boots up to iOS, run again without the -B (Create BindFS) option to jailbreak.");
|
||||
} else if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
||||
} else if (checkrain_option_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, "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(stuff_t *arg) {
|
||||
done:
|
||||
device_has_booted = true;
|
||||
#ifdef USE_LIBUSB
|
||||
libusb_unref_device(arg->dev);
|
||||
libusb_unref_device(((stuff_t *)arg)->dev);
|
||||
#endif
|
||||
set_spin(0);
|
||||
return NULL;
|
||||
@@ -163,10 +163,7 @@ int upload_pongo_file(usb_device_handle_t handle, unsigned char *buf, unsigned i
|
||||
if (verbose < 3 || verbose > 4) {
|
||||
LOG(LOG_VERBOSE, "Uploaded %llu bytes to PongoOS", (unsigned long long)buf_len);
|
||||
} else {
|
||||
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);
|
||||
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 +173,7 @@ int upload_pongo_file(usb_device_handle_t handle, unsigned char *buf, unsigned i
|
||||
|
||||
void io_start(stuff_t *stuff)
|
||||
{
|
||||
int r = pthread_create(&stuff->th, NULL, (pthread_start_t)pongo_usb_callback, stuff);
|
||||
int r = pthread_create(&stuff->th, NULL, &pongo_usb_callback, stuff);
|
||||
if(r != 0)
|
||||
{
|
||||
ERR("pthread_create: %s", strerror(r));
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user