mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 17:57:01 +02:00
Compare commits
5
Commits
plooshInit
..
gui
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe6a3a8c13 | ||
|
|
1a3e99640b | ||
|
|
e5a618682f | ||
|
|
cee71af2a6 | ||
|
|
0278d19df8 |
No files matched your search
+64
-136
@@ -36,8 +36,8 @@ jobs:
|
|||||||
- name: Build Documentation
|
- name: Build Documentation
|
||||||
run: |
|
run: |
|
||||||
make -j$(nproc) docs
|
make -j$(nproc) docs
|
||||||
mkdir -p ready/docs
|
mkdir ready
|
||||||
cp docs/*.html docs/mandoc.css docs/palera1n.1 ready/docs
|
cp docs/*.html docs/mandoc.css docs/palera1n.1 ready
|
||||||
|
|
||||||
- name: Get branch name
|
- name: Get branch name
|
||||||
id: branch-name
|
id: branch-name
|
||||||
@@ -50,9 +50,9 @@ jobs:
|
|||||||
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
||||||
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
||||||
username: palera1n
|
username: palera1n
|
||||||
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
privateKey: ${{ secrets.NICKCHAN_FTP_KEY }}
|
||||||
forceUpload: true
|
forceUpload: true
|
||||||
dryRun: false
|
dryRun: true
|
||||||
localDir: 'ready/'
|
localDir: 'ready/'
|
||||||
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
|
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ jobs:
|
|||||||
minos: 7.0
|
minos: 7.0
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
env:
|
env:
|
||||||
MBEDTLS_VERSION: 3.5.0
|
MBEDTLS_VERSION: 3.4.0
|
||||||
READLINE_VERSION: 8.2
|
READLINE_VERSION: 8.2
|
||||||
SLANG_VERSION: 2.3.3
|
SLANG_VERSION: 2.3.3
|
||||||
NEWT_VERSION: 0.52.23
|
NEWT_VERSION: 0.52.23
|
||||||
@@ -317,25 +317,17 @@ jobs:
|
|||||||
find dep_root -name '*.dylib' -delete
|
find dep_root -name '*.dylib' -delete
|
||||||
find dep_root -name '*.la' -delete
|
find dep_root -name '*.la' -delete
|
||||||
gmake -j$(sysctl -n hw.ncpu)
|
gmake -j$(sysctl -n hw.ncpu)
|
||||||
cp src/palera1n palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
mkdir -p ready
|
||||||
|
mv src/palera1n palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
||||||
dsymutil palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
dsymutil palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
||||||
strip palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
strip palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
||||||
|
|
||||||
- name: Build palera1n (Development)
|
|
||||||
run: |
|
|
||||||
CC="${{ matrix.triple }}-gcc" gmake -j$(sysctl -n hw.ncpu) clean
|
|
||||||
CC="${{ matrix.triple }}-gcc" gmake -j$(sysctl -n hw.ncpu) DEV_BUILD=1 TUI=1 ROOTFUL=1
|
|
||||||
cp src/palera1n palera1n-${{ matrix.os }}-${{ matrix.arch }}.development
|
|
||||||
|
|
||||||
- name: Prepare artifact
|
|
||||||
run: |
|
|
||||||
mkdir -p ready/build_depends
|
|
||||||
tar -zcf ready/build_depends/dep_root-${{ matrix.os }}-${{ matrix.arch }}.tgz dep_root
|
|
||||||
if [ "${{ matrix.os }}" == "macosx" ]; then
|
if [ "${{ matrix.os }}" == "macosx" ]; then
|
||||||
ldid -S palera1n-${{ matrix.os }}-${{ matrix.arch }}{,.development}
|
ldid -S palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
||||||
else
|
else
|
||||||
ldid -Ssrc/usb.xml palera1n-${{ matrix.os }}-${{ matrix.arch }}{,.development}
|
ldid -Ssrc/usb.xml palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
||||||
fi
|
fi
|
||||||
|
mkdir -p ready
|
||||||
|
tar -zcf ready/dep_root-${{ matrix.os }}-${{ matrix.arch }}.tgz dep_root
|
||||||
|
|
||||||
- name: Get branch name
|
- name: Get branch name
|
||||||
id: branch-name
|
id: branch-name
|
||||||
@@ -348,11 +340,11 @@ jobs:
|
|||||||
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
||||||
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
||||||
username: palera1n
|
username: palera1n
|
||||||
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
privateKey: ${{ secrets.NICKCHAN_FTP_KEY }}
|
||||||
forceUpload: true
|
forceUpload: true
|
||||||
dryRun: false
|
dryRun: true
|
||||||
localDir: 'ready/'
|
localDir: 'ready/'
|
||||||
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
|
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref }}/${{ github.run_number }}"
|
||||||
|
|
||||||
- name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} build
|
- name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} build
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
@@ -362,15 +354,6 @@ jobs:
|
|||||||
path: palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
path: palera1n-${{ matrix.os }}-${{ matrix.arch }}
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
- name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} build (Development)
|
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: palera1n-${{ matrix.os }}-${{ matrix.arch }}.development
|
|
||||||
path: palera1n-${{ matrix.os }}-${{ matrix.arch }}.development
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
|
|
||||||
- name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} debug symbols
|
- name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} debug symbols
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -394,31 +377,25 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
packages: sed coreutils
|
packages: sed coreutils
|
||||||
cache: true
|
cache: true
|
||||||
mirror: 'https://apt.procurs.us/'
|
mirror: 'https://procursus.itsnebula.net/'
|
||||||
|
|
||||||
- name: Download all Darwin artifacts
|
- name: Download all Darwin artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
- name: Prepare artifact
|
- name: Prepare artifact
|
||||||
run: |
|
run: |
|
||||||
|
find .
|
||||||
lipo -create -arch arm64 ./palera1n-macosx-arm64/palera1n-macosx-arm64 -arch x86_64 ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 -output palera1n-macos
|
lipo -create -arch arm64 ./palera1n-macosx-arm64/palera1n-macosx-arm64 -arch x86_64 ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 -output palera1n-macos
|
||||||
lipo -create -arch arm64 ./palera1n-macosx-arm64.development/palera1n-macosx-arm64.development -arch x86_64 ./palera1n-macosx-x86_64.development/palera1n-macosx-x86_64.development -output palera1n-macos.development
|
|
||||||
mkdir -p palera1n-macos.dSYM/Contents/Resources/DWARF
|
mkdir -p palera1n-macos.dSYM/Contents/Resources/DWARF
|
||||||
cp ./palera1n-macosx-x86_64.dSYM/Contents/Info.plist palera1n-macos.dSYM/Contents
|
cp ./palera1n-macosx-x86_64.dSYM/Contents/Info.plist palera1n-macos.dSYM/Contents
|
||||||
lipo -create -arch arm64 palera1n-macosx-arm64.dSYM/Contents/Resources/DWARF/palera1n-macosx-arm64 -arch x86_64 palera1n-macosx-x86_64.dSYM/Contents/Resources/DWARF/palera1n-macosx-x86_64 -output palera1n-macos.dSYM/Contents/Resources/DWARF/palera1n-macos
|
lipo -create -arch arm64 palera1n-macosx-arm64.dSYM/Contents/Resources/DWARF/palera1n-macosx-arm64 -arch x86_64 palera1n-macosx-x86_64.dSYM/Contents/Resources/DWARF/palera1n-macosx-x86_64 -output palera1n-macos.dSYM/Contents/Resources/DWARF/palera1n-macos
|
||||||
mkdir -p ready/{debian,binaries,debug_symbols,binaries_development}
|
mkdir ready
|
||||||
cp palera1n-macos.development ready/binaries_development/palera1n-macos-universal.development
|
cp palera1n-macos ready/palera1n-macos-universal
|
||||||
cp palera1n-macos ready/binaries/palera1n-macos-universal
|
cp ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 ready/palera1n-macos-x86_64
|
||||||
cp ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 ready/binaries/palera1n-macos-x86_64
|
cp ./palera1n-macosx-arm64/palera1n-macosx-arm64 ready/palera1n-macos-arm64
|
||||||
cp ./palera1n-macosx-arm64/palera1n-macosx-arm64 ready/binaries/palera1n-macos-arm64
|
cp ./palera1n-iphoneos-arm64/palera1n-iphoneos-arm64 ready/palera1n-ios
|
||||||
cp ./palera1n-iphoneos-arm64/palera1n-iphoneos-arm64 ready/binaries/palera1n-iphoneos-arm64
|
zip -r9 ready/palera1n-ios.dSYM.zip palera1n-iphoneos-arm64.dSYM
|
||||||
cp ./palera1n-macosx-x86_64.development/palera1n-macosx-x86_64.development ready/binaries_development/palera1n-macos-x86_64.development
|
zip -r9 ready/palera1n-macos.dSYM.zip palera1n-macos.dSYM
|
||||||
cp ./palera1n-macosx-arm64.development/palera1n-macosx-arm64.development ready/binaries_development/palera1n-macos-arm64.development
|
|
||||||
cp ./palera1n-iphoneos-arm64.development/palera1n-iphoneos-arm64.development ready/binaries_development/palera1n-iphoneos-arm64.development
|
|
||||||
zip -r9 ready/debug_symbols/palera1n-iphoneos-arm64.dSYM.zip palera1n-iphoneos-arm64.dSYM
|
|
||||||
zip -r9 ready/debug_symbols/palera1n-macosx-arm64.dSYM.zip palera1n-macosx-arm64.dSYM
|
|
||||||
zip -r9 ready/debug_symbols/palera1n-macosx-x86_64.dSYM.zip palera1n-macosx-x86_64.dSYM
|
|
||||||
zip -r9 ready/debug_symbols/palera1n-macos.dSYM.zip palera1n-macos.dSYM
|
|
||||||
|
|
||||||
- name: Build debs
|
- name: Build debs
|
||||||
run: |
|
run: |
|
||||||
@@ -434,12 +411,12 @@ jobs:
|
|||||||
gsed 's|@DEB_ARCH@|darwin-amd64|g' -i stage/DEBIAN/control
|
gsed 's|@DEB_ARCH@|darwin-amd64|g' -i stage/DEBIAN/control
|
||||||
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||||
|
|
||||||
ginstall -Dm644 ready/binaries/palera1n-macos-x86_64 stage/opt/procursus/bin/palera1n
|
ginstall -Dm644 ready/palera1n-macos-x86_64 stage/opt/procursus/bin/palera1n
|
||||||
zstd -c19 docs/palera1n.1 > stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
|
ginstall -Dm644 docs/palera1n.1 stage/opt/procursus/usr/share/man/man1/palera1n.1
|
||||||
chmod 644 stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
|
chmod +x stage/opt/procursus/bin/palera1n
|
||||||
chmod 755 stage/opt/procursus/bin/palera1n
|
|
||||||
|
|
||||||
dpkg-deb --root-owner-group -Zzstd -b stage palera1n_darwin-amd64.deb
|
dpkg-deb -Zzstd -b stage palera1n_darwin-amd64.deb
|
||||||
|
mv palera1n*.deb ready/
|
||||||
rm -rf stage
|
rm -rf stage
|
||||||
|
|
||||||
# Darwin arm64
|
# Darwin arm64
|
||||||
@@ -451,12 +428,12 @@ jobs:
|
|||||||
gsed 's|@DEB_ARCH@|darwin-arm64|g' -i stage/DEBIAN/control
|
gsed 's|@DEB_ARCH@|darwin-arm64|g' -i stage/DEBIAN/control
|
||||||
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||||
|
|
||||||
ginstall -Dm644 ready/binaries/palera1n-macos-arm64 stage/opt/procursus/bin/palera1n
|
ginstall -Dm644 ready/palera1n-macos-arm64 stage/opt/procursus/bin/palera1n
|
||||||
zstd -c19 docs/palera1n.1 > stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
|
ginstall -Dm644 docs/palera1n.1 stage/opt/procursus/usr/share/man/man1/palera1n.1
|
||||||
chmod 644 stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
|
chmod +x stage/opt/procursus/bin/palera1n
|
||||||
chmod 755 stage/opt/procursus/bin/palera1n
|
|
||||||
|
|
||||||
dpkg-deb --root-owner-group -Zzstd -b stage palera1n_darwin-arm64.deb
|
dpkg-deb -Zzstd -b stage palera1n_darwin-arm64.deb
|
||||||
|
mv palera1n*.deb ready/
|
||||||
rm -rf stage
|
rm -rf stage
|
||||||
|
|
||||||
# iPhoneOS
|
# iPhoneOS
|
||||||
@@ -468,12 +445,12 @@ jobs:
|
|||||||
gsed 's|@DEB_ARCH@|iphoneos-arm|g' -i stage/DEBIAN/control
|
gsed 's|@DEB_ARCH@|iphoneos-arm|g' -i stage/DEBIAN/control
|
||||||
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||||
|
|
||||||
ginstall -Dm644 ready/binaries/palera1n-iphoneos-arm64 stage/usr/bin/palera1n
|
ginstall -Dm644 ready/palera1n-ios stage/usr/bin/palera1n
|
||||||
zstd -c19 docs/palera1n.1 > stage/usr/share/man/man1/palera1n.1.zst
|
ginstall -Dm644 docs/palera1n.1 stage/usr/share/man/man1/palera1n.1
|
||||||
chmod 644 stage/usr/share/man/man1/palera1n.1.zst
|
chmod +x stage/usr/bin/palera1n
|
||||||
chmod 755 stage/usr/bin/palera1n
|
|
||||||
|
|
||||||
dpkg-deb --root-owner-group -Zzstd -b stage palera1n_iphoneos-arm.deb
|
dpkg-deb -Zzstd -b stage palera1n_iphoneos-arm.deb
|
||||||
|
mv palera1n*.deb ready/
|
||||||
rm -rf stage
|
rm -rf stage
|
||||||
|
|
||||||
# iPhoneOS (rootless)
|
# iPhoneOS (rootless)
|
||||||
@@ -485,15 +462,13 @@ jobs:
|
|||||||
gsed 's|@DEB_ARCH@|iphoneos-arm64|g' -i stage/DEBIAN/control
|
gsed 's|@DEB_ARCH@|iphoneos-arm64|g' -i stage/DEBIAN/control
|
||||||
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||||
|
|
||||||
ginstall -Dm644 ready/binaries/palera1n-iphoneos-arm64 stage/var/jb/usr/bin/palera1n
|
ginstall -Dm644 ready/palera1n-ios stage/var/jb/usr/bin/palera1n
|
||||||
zstd -c19 docs/palera1n.1 > stage/var/jb/usr/share/man/man1/palera1n.1.zst
|
ginstall -Dm644 docs/palera1n.1 stage/var/jb/usr/share/man/man1/palera1n.1
|
||||||
chmod 644 stage/var/jb/usr/share/man/man1/palera1n.1.zst
|
chmod +x stage/var/jb/usr/bin/palera1n
|
||||||
chmod 755 stage/var/jb/usr/bin/palera1n
|
|
||||||
|
|
||||||
dpkg-deb --root-owner-group -Zzstd -b stage palera1n_iphoneos-arm64.deb
|
dpkg-deb -Zzstd -b stage palera1n_iphoneos-arm64.deb
|
||||||
|
mv palera1n*.deb ready/
|
||||||
rm -rf stage
|
rm -rf stage
|
||||||
|
|
||||||
mv palera1n*.deb ready/debian
|
|
||||||
|
|
||||||
- name: Save build tag
|
- name: Save build tag
|
||||||
run: echo "$(git describe --dirty --tags --abbrev=7 | sed 's|-dirty||')" > build-tag.txt
|
run: echo "$(git describe --dirty --tags --abbrev=7 | sed 's|-dirty||')" > build-tag.txt
|
||||||
@@ -515,11 +490,11 @@ jobs:
|
|||||||
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
||||||
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
||||||
username: palera1n
|
username: palera1n
|
||||||
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
privateKey: ${{ secrets.NICKCHAN_FTP_KEY }}
|
||||||
forceUpload: true
|
forceUpload: true
|
||||||
dryRun: false
|
dryRun: true
|
||||||
localDir: 'ready/'
|
localDir: 'ready/'
|
||||||
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
|
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref }}/${{ github.run_number }}"
|
||||||
|
|
||||||
build-Linux:
|
build-Linux:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -531,7 +506,7 @@ jobs:
|
|||||||
- aarch64-linux-musl
|
- aarch64-linux-musl
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
MBEDTLS_VERSION: 3.5.0
|
MBEDTLS_VERSION: 3.4.0
|
||||||
LIBUSB_VERSION: 1.0.26
|
LIBUSB_VERSION: 1.0.26
|
||||||
READLINE_VERSION: 8.2
|
READLINE_VERSION: 8.2
|
||||||
SLANG_VERSION: 2.3.3
|
SLANG_VERSION: 2.3.3
|
||||||
@@ -626,14 +601,12 @@ jobs:
|
|||||||
git clone --depth=1 https://github.com/libimobiledevice/libirecovery
|
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/libusbmuxd
|
||||||
git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice
|
git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice
|
||||||
git clone --depth=1 https://github.com/libimobiledevice/usbmuxd
|
|
||||||
|
|
||||||
- name: Build Mbed TLS
|
- name: Build Mbed TLS
|
||||||
run: |
|
run: |
|
||||||
cd mbedtls-${{ env.MBEDTLS_VERSION }}
|
cd mbedtls-${{ env.MBEDTLS_VERSION }}
|
||||||
cat ../patches/mbedtls/0001-Allow-empty-x509-cert-issuer.patch | patch -sN -d . -p1
|
cat ../patches/mbedtls/0001-Allow-empty-x509-cert-issuer.patch | patch -sN -d . -p1
|
||||||
mkdir build
|
mkdir build
|
||||||
if [ "${{ matrix.triple }}" = "i486-linux-musl" ]; then sed -i '/define MBEDTLS_AESNI_C/d' include/mbedtls/mbedtls_config.h; fi
|
|
||||||
cd build
|
cd build
|
||||||
cmake .. \
|
cmake .. \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
@@ -777,52 +750,26 @@ jobs:
|
|||||||
sudo rm /usr/local
|
sudo rm /usr/local
|
||||||
sudo mv /usr/local.bak /usr/local
|
sudo mv /usr/local.bak /usr/local
|
||||||
|
|
||||||
- name: Build usbmuxd
|
|
||||||
run: |
|
|
||||||
cd usbmuxd
|
|
||||||
autoreconf -fiv
|
|
||||||
./configure ${{ env.CONFIGURE_ARGS }} --without-systemd
|
|
||||||
${{ matrix.triple }}-gcc ${{ env.CFLAGS }} -I${{ env.DESTDIR }}/${{ env.PREFIX }}/include/libusb-1.0 src/*.c \
|
|
||||||
-DHAVE_CONFIG_H -no-pie \
|
|
||||||
-I. -static ${{ env.LDFLAGS }}} -limobiledevice-1.0 -lusbmuxd-2.0 -limobiledevice-glue-1.0 \
|
|
||||||
-lplist-2.0 -lusb-1.0 -lmbedtls -lmbedcrypto -lmbedx509 -lpthread -o usbmuxd
|
|
||||||
mkdir -p ${{ env.DESTDIR }}/${{ env.PREFIX }}/sbin
|
|
||||||
${{ matrix.triple }}-objcopy --only-keep-debug usbmuxd usbmuxd.debug
|
|
||||||
${{ matrix.triple }}-strip --strip-debug --strip-unneeded usbmuxd
|
|
||||||
${{ matrix.triple }}-objcopy --add-gnu-debuglink=usbmuxd.debug usbmuxd
|
|
||||||
install -m755 usbmuxd usbmuxd.debug ${{ env.DESTDIR }}/${{ env.PREFIX }}/sbin
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Build palera1n
|
- name: Build palera1n
|
||||||
run: |
|
run: |
|
||||||
cp -a ${{ env.DESTDIR }}/${{ env.PREFIX }}/{include,lib} dep_root
|
cp -a sysroot/${{ env.PREFIX }}/{include,lib} dep_root
|
||||||
find dep_root -name '*.so' -delete
|
find dep_root -name '*.so' -delete
|
||||||
find dep_root -name '*.la' -delete
|
find dep_root -name '*.la' -delete
|
||||||
CC="${{ matrix.triple }}-gcc" make -j$(nproc)
|
CC="${{ matrix.triple }}-gcc" make -j$(nproc)
|
||||||
cp src/palera1n palera1n.release
|
|
||||||
|
|
||||||
- name: Seperate debug symbols
|
- name: Seperate debug symbols
|
||||||
run: |
|
run: |
|
||||||
${{ matrix.triple }}-objcopy --only-keep-debug palera1n.release palera1n.debug
|
${{ matrix.triple }}-objcopy --only-keep-debug src/palera1n palera1n.debug
|
||||||
${{ matrix.triple }}-strip --strip-debug --strip-unneeded palera1n.release
|
${{ matrix.triple }}-strip --strip-debug --strip-unneeded src/palera1n
|
||||||
${{ matrix.triple }}-objcopy --add-gnu-debuglink=palera1n.debug palera1n.release
|
${{ matrix.triple }}-objcopy --add-gnu-debuglink=palera1n.debug src/palera1n
|
||||||
chmod -x palera1n.debug
|
chmod -x palera1n.debug
|
||||||
|
|
||||||
- name: Build palera1n (Development)
|
|
||||||
run: |
|
|
||||||
CC="${{ matrix.triple }}-gcc" make -j$(nproc) clean
|
|
||||||
CC="${{ matrix.triple }}-gcc" make -j$(nproc) DEV_BUILD=1 TUI=1 ROOTFUL=1
|
|
||||||
cp src/palera1n palera1n.development
|
|
||||||
|
|
||||||
- name: Prepare artifact
|
- name: Prepare artifact
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ready/{binaries,debian,binaries_development,build_depends,debug_symbols} usbmuxd-static
|
mkdir ready
|
||||||
mv palera1n.debug ready/debug_symbols/palera1n-${{ env.CHECKRA1N_NAME }}.debug
|
mv palera1n.debug ready/palera1n-${{ env.CHECKRA1N_NAME }}.debug
|
||||||
mv palera1n.release ready/binaries/palera1n-${{ env.CHECKRA1N_NAME }}
|
mv src/palera1n ready/palera1n-${{ env.CHECKRA1N_NAME }}
|
||||||
mv palera1n.development ready/binaries_development/palera1n-${{ env.CHECKRA1N_NAME }}.development
|
tar -zcf ready/dep_root_${{ matrix.triple }}.tgz dep_root
|
||||||
tar -zcf ready/build_depends/dep_root_${{ matrix.triple }}.tgz dep_root
|
|
||||||
install -m755 sysroot/${{ env.PREFIX }}/sbin/usbmuxd usbmuxd-static/usbmuxd-${{ env.CHECKRA1N_NAME }}
|
|
||||||
install -m755 sysroot/${{ env.PREFIX }}/sbin/usbmuxd.debug usbmuxd-static/usbmuxd-${{ env.CHECKRA1N_NAME }}.debug
|
|
||||||
|
|
||||||
- name: Build debs
|
- name: Build debs
|
||||||
run: |
|
run: |
|
||||||
@@ -837,13 +784,12 @@ jobs:
|
|||||||
sed 's|@DEB_ARCH@|${{ env.ARCH_NAME }}|g' -i 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
|
sed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
|
||||||
|
|
||||||
install -Dm644 ready/binaries/palera1n-${{ env.CHECKRA1N_NAME }} stage/usr/bin/palera1n
|
install -Dm644 ready/palera1n-${{ env.CHECKRA1N_NAME }} stage/usr/bin/palera1n
|
||||||
gzip -c9 docs/palera1n.1 > stage/usr/share/man/man1/palera1n.1.gz
|
install -Dm644 docs/palera1n.1 stage/usr/share/man/man1/palera1n.1
|
||||||
chmod 755 stage/usr/bin/palera1n
|
chmod +x stage/usr/bin/palera1n
|
||||||
chmod 644 stage/usr/share/man/man1/palera1n.1.gz
|
|
||||||
|
|
||||||
dpkg-deb --root-owner-group -b stage palera1n_${{ env.ARCH_NAME }}.deb
|
dpkg-deb -b stage palera1n_${{ env.ARCH_NAME }}.deb
|
||||||
mv palera1n*.deb ready/debian
|
mv palera1n*.deb ready/
|
||||||
rm -rf stage
|
rm -rf stage
|
||||||
|
|
||||||
- name: Get branch name
|
- name: Get branch name
|
||||||
@@ -857,24 +803,11 @@ jobs:
|
|||||||
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
||||||
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
||||||
username: palera1n
|
username: palera1n
|
||||||
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
privateKey: ${{ secrets.NICKCHAN_FTP_KEY }}
|
||||||
forceUpload: true
|
forceUpload: true
|
||||||
dryRun: false
|
dryRun: true
|
||||||
localDir: 'ready/'
|
localDir: 'ready/'
|
||||||
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
|
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref }}/${{ github.run_number }}"
|
||||||
|
|
||||||
- name: Upload usbmuxd artifact
|
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
|
||||||
uses: wangyucode/[email protected]
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
|
||||||
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
|
||||||
username: palera1n
|
|
||||||
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
|
||||||
forceUpload: true
|
|
||||||
dryRun: false
|
|
||||||
localDir: 'usbmuxd-static/'
|
|
||||||
remoteDir: "/palera1n/artifacts/usbmuxd-static"
|
|
||||||
|
|
||||||
finish-build:
|
finish-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -893,13 +826,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: build-tag
|
name: build-tag
|
||||||
|
|
||||||
- uses: geekyeggo/delete-artifact@v2
|
|
||||||
with:
|
|
||||||
name: '*'
|
|
||||||
failOnError: false
|
|
||||||
|
|
||||||
- name: Send Discord build message
|
- name: Send Discord build message
|
||||||
run: |
|
run: |
|
||||||
COMMITMESSAGE=`git log --pretty=format:'- \`%h\` %s' -1 --reverse` &&
|
COMMITMESSAGE=`git log --pretty=format:'- \`%h\` %s' -1 --reverse` &&
|
||||||
(curl "${{ secrets.DISCORD_WEBHOOK }}" -sS -H "Content-Type:application/json" -X POST -d "{\"content\":null,\"embeds\":[{\"title\":\"[palera1n:${{ steps.branch-name.outputs.ref_branch }}] Nightly Build ${{ github.run_number }}\",\"url\":\"https://github.com/palera1n/palera1n/actions/runs/${GITHUB_RUN_ID}\",\"color\":2829617,\"fields\":[{\"name\":\"Build tag\",\"value\":\"- \`$(cat build-tag.txt | sed 's|\n||')\`\"},{\"name\":\"Destination\",\"value\":\"- https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}\"},{\"name\":\"Documentation\",\"value\":\"- [palera1n.1.html](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/docs/palera1n.1.html)\"},{\"name\":\"Main Artifacts\",\"value\":\"- [palera1n-iphoneos-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-iphoneos-arm64)\n- [palera1n-linux-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-arm64)\n- [palera1n-linux-armel](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-armel)\n- [palera1n-linux-x86](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-x86)\n- [palera1n-linux-x86_64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-x86_64)\n- [palera1n-macos-universal](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-macos-universal)\"}],\"footer\":{\"text\":\"${{ github.actor }}\", \"icon_url\": \"https://github.com/${{ github.actor }}.png\",\"timestamp\":\"$(date -u +"%FT%TZ")\"}}],\"username\":\"GitHub Actions\",\"avatar_url\":\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}")
|
(curl "${{ secrets.DISCORD_WEBHOOK }}" -sS -H "Content-Type:application/json" -X POST -d "{\"content\":null,\"embeds\":[{\"title\":\"[palera1n:${{ steps.branch-name.outputs.ref_branch }}] Nightly Build ${{ github.run_number }}\",\"url\":\"https://github.com/palera1n/palera1n/actions/runs/${GITHUB_RUN_ID}\",\"color\":2829617,\"fields\":[{\"name\":\"Build tag\",\"value\":\"- \`$(cat build-tag.txt | sed 's|\n||')\`\"},{\"name\":\"Destination\",\"value\":\"- https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}\"},{\"name\":\"Documentation\",\"value\":\"- [palera1n.1.html](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n.1.html)\"},{\"name\":\"Main Artifacts\",\"value\":\"- [palera1n-ios](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n-ios)\n- [palera1n-linux-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n-linux-arm64)\n- [palera1n-linux-armel](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n-linux-armel)\n- [palera1n-linux-x86](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/$${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n-linux-x86)\n- [palera1n-linux-x86_64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n-linux-x86_64)\n- [palera1n-macos-universal](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n-macos-universal)\"}],\"footer\":{\"text\":\"${{ github.actor }}\", \"icon_url\": \"https://github.com/${{ github.actor }}.png\",\"timestamp\":\"$(date -u +"%FT%TZ")\"}}],\"username\":\"GitHub Actions\",\"avatar_url\":\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}")
|
||||||
|
|
||||||
@@ -11,7 +11,6 @@ src/palera1n
|
|||||||
!xxd-embedded.h
|
!xxd-embedded.h
|
||||||
src/binpack.dmg
|
src/binpack.dmg
|
||||||
src/ramdisk.dmg
|
src/ramdisk.dmg
|
||||||
src/ramdisk.dmg.lzma
|
|
||||||
src/xxd-*.c
|
src/xxd-*.c
|
||||||
.DS_Store
|
.DS_Store
|
||||||
!palera1n.1
|
!palera1n.1
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
|
NAME = bakepale
|
||||||
|
|
||||||
SRC = $(shell pwd)
|
SRC = $(shell pwd)
|
||||||
DEP = $(SRC)/dep_root
|
DEP = $(SRC)/dep_root
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
CC ?= cc
|
CC ?= cc
|
||||||
CFLAGS += -isystem $(DEP)/include -I$(SRC)/include -I$(SRC) -D_XOPEN_SOURCE=500
|
CXX ?= c++
|
||||||
CFLAGS += -Wall -Wextra -Wno-unused-parameter -DPALERAIN_VERSION=\"2.0.0\" -DHAVE_LIBIMOBILEDEVICE
|
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC) -D_XOPEN_SOURCE=500
|
||||||
|
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 += -Wno-unused-variable -I$(SRC)/src -std=c99 -pedantic-errors -D_C99_SOURCE -D_POSIX_C_SOURCE=200112L
|
||||||
|
CXXFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC) -std=c++11
|
||||||
LIBS += $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a
|
LIBS += $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a
|
||||||
LIBS += $(DEP)/lib/libimobiledevice-glue-1.0.a $(DEP)/lib/libplist-2.0.a -pthread -lm
|
LIBS += $(DEP)/lib/libimobiledevice-glue-1.0.a $(DEP)/lib/libplist-2.0.a -pthread -lm
|
||||||
ifeq ($(TARGET_OS),)
|
ifeq ($(TARGET_OS),)
|
||||||
TARGET_OS = $(shell uname -s)
|
TARGET_OS = $(shell uname -s)
|
||||||
UNAME = $(TARGET_OS)
|
|
||||||
else
|
|
||||||
UNAME = $(shell uname -s)
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_OS),Darwin)
|
ifeq ($(TARGET_OS),Darwin)
|
||||||
CFLAGS += -Wno-nullability-extension
|
CFLAGS += -Wno-nullability-extension
|
||||||
@@ -22,7 +23,7 @@ LDFLAGS += -Wl,-dead_strip
|
|||||||
LIBS += -framework CoreFoundation -framework IOKit
|
LIBS += -framework CoreFoundation -framework IOKit
|
||||||
else
|
else
|
||||||
CFLAGS += -fdata-sections -ffunction-sections
|
CFLAGS += -fdata-sections -ffunction-sections
|
||||||
LDFLAGS += -Wl,--gc-sections
|
LDFLAGS += -static -no-pie -Wl,--gc-sections
|
||||||
endif
|
endif
|
||||||
LIBS += $(DEP)/lib/libmbedtls.a $(DEP)/lib/libmbedcrypto.a $(DEP)/lib/libmbedx509.a $(DEP)/lib/libreadline.a
|
LIBS += $(DEP)/lib/libmbedtls.a $(DEP)/lib/libmbedcrypto.a $(DEP)/lib/libmbedx509.a $(DEP)/lib/libreadline.a
|
||||||
|
|
||||||
@@ -32,6 +33,13 @@ ifeq ($(TARGET_OS),Linux)
|
|||||||
LIBS += $(DEP)/lib/libgpm.a
|
LIBS += $(DEP)/lib/libgpm.a
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(GUI),1)
|
||||||
|
LIBS += $(DEP)/lib/libguira1n.a
|
||||||
|
ifeq ($(TARGET_OS),Darwin)
|
||||||
|
LIBS += -framework Foundation -framework AppKit
|
||||||
|
CXXFLAGS += -x objective-c++
|
||||||
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(DEV_BUILD),1)
|
ifeq ($(DEV_BUILD),1)
|
||||||
CFLAGS += -O0 -g -DDEV_BUILD -fno-omit-frame-pointer
|
CFLAGS += -O0 -g -DDEV_BUILD -fno-omit-frame-pointer
|
||||||
ifeq ($(ASAN),1)
|
ifeq ($(ASAN),1)
|
||||||
@@ -49,12 +57,6 @@ BUILD_STYLE = RELEASE
|
|||||||
endif
|
endif
|
||||||
LIBS += -lc
|
LIBS += -lc
|
||||||
|
|
||||||
ifeq ($(TARGET_OS),Linux)
|
|
||||||
ifneq ($(shell echo '$(BUILD_STYLE)' | grep -q '[A-Z]\+SAN' && echo 1),1)
|
|
||||||
LDFLAGS += -static -no-pie
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(BAKERAIN_DEVELOPE_R),)
|
ifneq ($(BAKERAIN_DEVELOPE_R),)
|
||||||
CFLAGS += -DBAKERAIN_DEVELOPE_R="\"$(BAKERAIN_DEVELOPE_R)\""
|
CFLAGS += -DBAKERAIN_DEVELOPE_R="\"$(BAKERAIN_DEVELOPE_R)\""
|
||||||
endif
|
endif
|
||||||
@@ -71,7 +73,7 @@ CFLAGS += -DBUILD_WHOAMI="\"$(BUILD_WHOAMI)\"" -DBUILD_TAG="\"$(BUILD_TAG)\""
|
|||||||
CFLAGS += -DBUILD_NUMBER="\"$(BUILD_NUMBER)\"" -DBUILD_BRANCH="\"$(BUILD_BRANCH)\""
|
CFLAGS += -DBUILD_NUMBER="\"$(BUILD_NUMBER)\"" -DBUILD_BRANCH="\"$(BUILD_BRANCH)\""
|
||||||
CFLAGS += -DBUILD_COMMIT="\"$(BUILD_COMMIT)\""
|
CFLAGS += -DBUILD_COMMIT="\"$(BUILD_COMMIT)\""
|
||||||
|
|
||||||
export SRC DEP UNAME CC CFLAGS LDFLAGS LIBS SHELL TARGET_OS DEV_BUILD BUILD_DATE BUILD_TAG BUILD_WHOAMI BUILD_STYLE BUILD_NUMBER BUILD_BRANCH
|
export SRC DEP CC CXX CFLAGS CXXFLAGS LDFLAGS LIBS TARGET_OS DEV_BUILD BUILD_DATE BUILD_TAG BUILD_WHOAMI BUILD_STYLE BUILD_NUMBER BUILD_BRANCH
|
||||||
|
|
||||||
all: palera1n
|
all: palera1n
|
||||||
|
|
||||||
@@ -83,13 +85,13 @@ clean:
|
|||||||
$(MAKE) -C docs clean
|
$(MAKE) -C docs clean
|
||||||
|
|
||||||
download-deps:
|
download-deps:
|
||||||
$(MAKE) -C src $(patsubst %, resources/%, 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 checkra1n-macos checkra1n-linux-arm64 checkra1n-linux-armel checkra1n-linux-x86 checkra1n-linux-x86_64 checkra1n-kpf-pongo ramdisk.dmg binpack.dmg Pongo.bin
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
$(MAKE) -C docs
|
$(MAKE) -C docs
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
$(MAKE) -C src distclean
|
rm -rf palera1n-* palera1n*.dSYM src/checkra1n-* src/checkra1n-kpf-pongo src/ramdisk.dmg src/binpack.dmg src/Pongo.bin
|
||||||
|
|
||||||
.PHONY: all palera1n clean docs distclean
|
.PHONY: all palera1n clean docs distclean
|
||||||
|
|
||||||
@@ -1,34 +1,23 @@
|
|||||||
<center>
|
<picture>
|
||||||
<a href="#"><img src="https://cdn.discordapp.com/attachments/1103485261196832779/1126450758523572285/pxd.png" alt="Logo"></a>
|
<source media="(prefers-color-scheme: light)" srcset="https://cdn.discordapp.com/attachments/1028398976640229380/1088049124441604136/IMG_0033.png">
|
||||||
</center>
|
<img align="left" height="120" src="https://cdn.discordapp.com/attachments/1017854329887129611/1073858292159352862/thing.png" alt="palera1n logo" style="float: left;"/>
|
||||||
|
</picture>
|
||||||
|
|
||||||
<p align="center">
|
<br clear="both"/>
|
||||||
<a href="https://cdn.nickchan.lol/palera1n/c-rewrite/releases/v2.0.0-beta.7/palera1n.1.html">Documentation</a> •
|
|
||||||
<a href="https://ios.cfw.guide/installing-palera1n">Installation Guide</a> •
|
|
||||||
<a href="#requirements">Requirements</a> •
|
|
||||||
<a href="https://discord.gg/palera1n">Support Discord</a> •
|
|
||||||
<a href="https://palera.in">Website</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
## Information
|
## Information
|
||||||
This is the official repo for the palera1n project, a jailbreak for arm64 devices on iOS 15.0+
|
- Guides to palera1n can be found [here](https://ios.cfw.guide/installing-palera1n).
|
||||||
|
- Full documentation can be also found [here](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n.1.html).
|
||||||
- Loader application used in palera1n can be found [here](https://github.com/palera1n/loader).
|
|
||||||
- palera1ns jbinit can be found [here](https://github.com/palera1n/jbinit).
|
|
||||||
- palera1ns custom PongoOS can be found [here](https://github.com/palera1n/pongoos).
|
|
||||||
|
|
||||||
Website & credits can be found at https://palera.in (scroll down for credits).
|
|
||||||
|
|
||||||
## Warnings
|
## Warnings
|
||||||
We are **NOT** responsible for any data loss, or the result of a device being bricked. The user of this program accepts responsibility should something happen to their device. While nothing should happen, jailbreaking has risks in itself.
|
- We are **NOT** responsible for any data loss, or the result of a device being bricked. The user of this program accepts responsibility should something happen to their device. While nothing should happen, jailbreaking has risks in itself.
|
||||||
- If your device is stuck in recovery, please run futurerestore `--exit-recovery`, or use `irecovery -n`.
|
- If your device is stuck in recovery, please run futurerestore `--exit-recovery`, or use `irecovery -n`.
|
||||||
|
|
||||||
- If you're unable to get out of recovery via these methods please restore with iTunes or Finder.
|
|
||||||
|
|
||||||
- palera1n will never work in VirtualBox, VMware or any virtual machine that doesn't support PCI passthrough.
|
- palera1n will never work in VirtualBox, VMware or any virtual machine that doesn't support PCI passthrough.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
- A checkm8 vulnerable iOS device on iOS 15+ (`A8` - `A11`)
|
- A checkm8 vulnerable iOS device on iOS 15.x or 16.x (`A8` - `A11`)
|
||||||
|
- If using rootful, you will need **5-10GB of space** for the fakefs. This means 16GB devices cannot use the full fakefs creation. However, you can change the arguments to `-Bf` to create a fakefs with bind mounts, so it uses a smaller size, at the expense having unwritable parts in rarely-written paths, and then boot it
|
||||||
- On `A11`, **you must disable your passcode while in the jailbroken state** (on iOS 16, you need to **reset your device** before proceeding with palera1n).
|
- On `A11`, **you must disable your passcode while in the jailbroken state** (on iOS 16, you need to **reset your device** before proceeding with palera1n).
|
||||||
|
|
||||||
- **USB-A** cables are recommended to use, USB-C may have issues with palera1n and getting into DFU mode.<details><summary>Technical explanation</summary>The BootROM will only enter DFU if it detects USB voltage, which boils down to checking whether a certain pin is asserted from the Tristar chip. The Tristar does this based on the cable's accessory ID, and apparently USB-A and USB-C cables have different accessory IDs, and the one of the USB-C cables makes the Tristar not assert the USB voltage pin.</details>
|
- **USB-A** cables are recommended to use, USB-C may have issues with palera1n and getting into DFU mode.<details><summary>Technical explanation</summary>The BootROM will only enter DFU if it detects USB voltage, which boils down to checking whether a certain pin is asserted from the Tristar chip. The Tristar does this based on the cable's accessory ID, and apparently USB-A and USB-C cables have different accessory IDs, and the one of the USB-C cables makes the Tristar not assert the USB voltage pin.</details>
|
||||||
@@ -39,7 +28,7 @@ We are **NOT** responsible for any data loss, or the result of a device being br
|
|||||||
|
|
||||||
- Apple Silicon Macs with USB-C
|
- 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.
|
- 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 USB hub, though extensions can vary.
|
- This problem may be solved by connecting via USBHub.
|
||||||
|
|
||||||
## Need help?
|
## Need help?
|
||||||
|
|
||||||
@@ -51,4 +40,36 @@ Make sure you provide full details on your device, such as:
|
|||||||
|
|
||||||
Using `-VvL` would help with debugging.
|
Using `-VvL` would help with debugging.
|
||||||
|
|
||||||
Join the [Support Discord](https://dsc.gg/palera1n)
|
Join the [Support Discord](https://dsc.gg/palera1n), and create a thread in [#support](https://discord.com/channels/1028398973452570725/1028730487700738130) or ask in [#general](https://discord.com/channels/1028398973452570725/1028398976640229380).
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
<details><summary>Credits</summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
- [Lakhan Lothiyi](https://github.com/llsc12) for older palera1n loader app
|
||||||
|
- [checkra1n](https://github.com/checkra1n) for the base of the kpf
|
||||||
|
- [the Procursus Team](https://github.com/ProcursusTeam) for the amazing [bootstrap](https://github.com/ProcursusTeam/Procursus)
|
||||||
|
- [Évelyne](https://github.com/evelyneee) for [ElleKit](https://github.com/evelyneee/ellekit), rootless tweak injection
|
||||||
|
- [Sam Bingner](https://github.com/sbingner) for [Substitute](https://github.com/sbingner/substitute), rootful tweak injection
|
||||||
|
|
||||||
|
</details>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<p align="center">
|
||||||
|
Thank you so much to our Patreons that make the future development possible! You may sub <a href="https://patreon.com/palera1n">here</a>, if you'd like to.</br>
|
||||||
|
</p>
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://github.com/samh06"><img width=64 style="border-radius: 25%;" src="https://user-images.githubusercontent.com/18669106/206333607-881d7ca1-f3bf-4e18-b620-25de0c527315.png"></img></a>
|
||||||
|
<a href="https://havoc.app"><img width=64 style="border-radius: 25%;" src="https://docs.havoc.app/img/standard_icon.png"></img></a>
|
||||||
|
<a href="https://twitter.com/yyyyyy_public"><img width=64 style="border-radius: 25%;" src="https://cdn.discordapp.com/attachments/1054239098006683688/1072587455779328040/image.png?size=400"></img></a>
|
||||||
|
<a href="https://twitter.com/0xSp00kyb0t"><img width=64 style="border-radius: 25%;" src="https://pbs.twimg.com/profile_images/1603601553226620935/1t4yD1bD_400x400.jpg"></img></a>
|
||||||
|
<a href="https://chariz.com"><img width=64 src="https://chariz.com/img/favicon.png"></img></a>
|
||||||
|
<a href="https://twitter.com/stars6220"><img width=64 style="border-radius: 25%;" src="https://pbs.twimg.com/profile_images/1621062976982728706/pWVZQ-NO_400x400.jpg"></img></a>
|
||||||
|
<a href="https://github.com/TheFunnyMan16"><img width=64 style="border-radius: 25%;" src="https://cdn.discordapp.com/attachments/1050068822473842778/1082867264807772281/IMG_3942.jpg">
|
||||||
|
<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>
|
||||||
|
</p>
|
||||||
+97
-12
@@ -2,14 +2,14 @@
|
|||||||
.\" Copyright (c) 2023 Nick Chan
|
.\" Copyright (c) 2023 Nick Chan
|
||||||
.\" SPDX-License-Identifier: MIT
|
.\" SPDX-License-Identifier: MIT
|
||||||
.\"
|
.\"
|
||||||
.Dd "26 October 2023"
|
.Dd "20 March 2023"
|
||||||
.Dt palera1n 1
|
.Dt palera1n 1
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm palera1n
|
.Nm palera1n
|
||||||
.Nd iOS 15.0-17.1 arm64 iOS/iPadOS jailbreaking tool
|
.Nd iOS 15.0-16.5 arm64 iOS/iPadOS jailbreaking tool
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl dDEhILnpRsSvV
|
.Op Fl cCdDEfhIlLnpRsSvV
|
||||||
.Op Fl e Ar Boot arguments
|
.Op Fl e Ar Boot arguments
|
||||||
.Op Fl k Ar Pongo image
|
.Op Fl k Ar Pongo image
|
||||||
.Op Fl o Ar overlay file
|
.Op Fl o Ar overlay file
|
||||||
@@ -20,11 +20,15 @@
|
|||||||
.Op Fl -force-revert
|
.Op Fl -force-revert
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
jailbreaks any iOS/iPadOS device with an arm64 (arm64e excluded) on iOS 15.0-16.5.1,
|
jailbreaks any iOS/iPadOS device with an arm64 (arm64e excluded) on iOS 15.0-16.5,
|
||||||
utilizing the
|
utilizing the
|
||||||
.Em checkm8
|
.Em checkm8
|
||||||
bootROM exploit.
|
bootROM exploit.
|
||||||
.Pp
|
.Pp
|
||||||
|
.Nm
|
||||||
|
is able to jailbreak the device in fakefs-rootful mode, where /
|
||||||
|
is writable, as well as rootless mode, where / cannot be written to.
|
||||||
|
.Pp
|
||||||
Due to the nature of the
|
Due to the nature of the
|
||||||
.Em checkm8
|
.Em checkm8
|
||||||
exploit,
|
exploit,
|
||||||
@@ -48,7 +52,7 @@ In the remainder of this document, the term "iOS" and "iPadOS" will be used inte
|
|||||||
as the difference is negligible as far as the jailbreak is concerened.
|
as the difference is negligible as far as the jailbreak is concerened.
|
||||||
.Pp
|
.Pp
|
||||||
.Sh SUPPORTED DEVICES
|
.Sh SUPPORTED DEVICES
|
||||||
As described above, arm64 iOS 15.0-16.5.1 devices are supported, here is an explicit
|
As described above, arm64 iOS 15.0-16.5 devices are supported, here is an explicit
|
||||||
list of supported devicecs:
|
list of supported devicecs:
|
||||||
|
|
||||||
.Bl -tag -compact
|
.Bl -tag -compact
|
||||||
@@ -91,7 +95,36 @@ Prints the program version and exit.
|
|||||||
Remove the jailbreak while keeping user data. Some jailbreak files may remain
|
Remove the jailbreak while keeping user data. Some jailbreak files may remain
|
||||||
after running this command. Additionally, jailbreak apps will remain on the
|
after running this command. Additionally, jailbreak apps will remain on the
|
||||||
home screen on for a while even when the files are deleted as the icon cache
|
home screen on for a while even when the files are deleted as the icon cache
|
||||||
still has their icons.
|
still has their icons. When used with
|
||||||
|
.Fl f , -fakefs ,
|
||||||
|
this will actually boot the device in rootless mode then delete the jailbreak
|
||||||
|
files. As a result, using the loader app to install the jailbreak environment
|
||||||
|
is not supported when this option is used together with
|
||||||
|
.Fl f , -fakefs
|
||||||
|
\[char46]
|
||||||
|
.It Fl B , -setup-fakefs-partial
|
||||||
|
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.
|
||||||
|
.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.
|
||||||
|
.It Fl C , -clean-fakefs
|
||||||
|
This reverts the fakefs to the
|
||||||
|
.Em orig-fs
|
||||||
|
snapshot that is created when the fakefs
|
||||||
|
is first created, then the device will continue to boot jailbroken. This option
|
||||||
|
allows resetting the rootful environment without deleting the entire fakefs.
|
||||||
|
Note that this option will not work if the fakefs is created in an older version
|
||||||
|
of palera1n that does not create the
|
||||||
|
.Em orig-fs
|
||||||
|
snapshot on the fakefs. This option will also remove some jailbreak files inside
|
||||||
|
of /var. The files in /var will not be deleted when a userspace reboot is done
|
||||||
|
with this flag set.
|
||||||
.It Fl d , -demote
|
.It Fl d , -demote
|
||||||
Set the effective production fuse to 0, so as to enable hardware debugging features.
|
Set the effective production fuse to 0, so as to enable hardware debugging features.
|
||||||
.It Fl D , -dfuhelper
|
.It Fl D , -dfuhelper
|
||||||
@@ -102,9 +135,13 @@ Specify custom XNU kernel command line. The
|
|||||||
.Em rootdev=md0
|
.Em rootdev=md0
|
||||||
argument is used by
|
argument is used by
|
||||||
.Nm
|
.Nm
|
||||||
and cannot be overriden.
|
and cannot be overriden. Additionally, the
|
||||||
|
.Em wdt=-1
|
||||||
|
argument is used during fakefs setup.
|
||||||
.It Fl E , -enter-recovery
|
.It Fl E , -enter-recovery
|
||||||
Exit after entering recovery mode.
|
Exit after entering recovery mode.
|
||||||
|
.It Fl f , -fakefs
|
||||||
|
Proceed in rootful mode. This applies to both full fakefs and partial fakefs.
|
||||||
.It Fl h , -help
|
.It Fl h , -help
|
||||||
Prints help text.
|
Prints help text.
|
||||||
.It Fl i , -checkra1n-file Ar checkra1n file
|
.It Fl i , -checkra1n-file Ar checkra1n file
|
||||||
@@ -120,6 +157,12 @@ root filesystem in paleinfo with
|
|||||||
command. If in doubt, use
|
command. If in doubt, use
|
||||||
.Sy https://github.com/palera1n/PongoOS
|
.Sy https://github.com/palera1n/PongoOS
|
||||||
iOS15 branch or your own fork of it.
|
iOS15 branch or your own fork of it.
|
||||||
|
.It Fl l , -rootless
|
||||||
|
Proceed in rootless mode, this is the default when neither
|
||||||
|
.Fl l , -rootless
|
||||||
|
and
|
||||||
|
.Fl f , -fakefs
|
||||||
|
is specified.
|
||||||
.Fl L , -jbinit-log-to-file
|
.Fl L , -jbinit-log-to-file
|
||||||
Makes jbinit log to
|
Makes jbinit log to
|
||||||
.Em /cores/jbinit.log
|
.Em /cores/jbinit.log
|
||||||
@@ -178,10 +221,32 @@ To (re-)jailbreak in rootless mode:
|
|||||||
.Pp
|
.Pp
|
||||||
.Dl "palera1n"
|
.Dl "palera1n"
|
||||||
.Pp
|
.Pp
|
||||||
|
To setup fakefs for rootful mode:
|
||||||
|
.Pp
|
||||||
|
.Dl "palera1n -fc"
|
||||||
|
.Pp
|
||||||
|
After the device has rebooted, follow the following example.
|
||||||
|
.Pp
|
||||||
|
To re-jailbreak in rootful mode:
|
||||||
|
.Pp
|
||||||
|
.Dl "palera1n -f"
|
||||||
|
.Pp
|
||||||
|
To remove the jailbreak in rootful mode:
|
||||||
|
.Pp
|
||||||
|
.Dl "palera1n --force-revert -f"
|
||||||
|
.Pp
|
||||||
To remove the jailbreak in rootless mode:
|
To remove the jailbreak in rootless mode:
|
||||||
.Pp
|
.Pp
|
||||||
.Dl "palera1n --force-revert"
|
.Dl "palera1n --force-revert"
|
||||||
.Pp
|
.Pp
|
||||||
|
To verbose boot in rootful mode:
|
||||||
|
.Pp
|
||||||
|
.Dl "palera1n -Vf"
|
||||||
|
.Pp
|
||||||
|
To create a partial fakefs with bind mounts:
|
||||||
|
.Pp
|
||||||
|
.Dl "palera1n -Bf"
|
||||||
|
.Pp
|
||||||
To exit recovery mode:
|
To exit recovery mode:
|
||||||
.Pp
|
.Pp
|
||||||
.Dl "palera1n -n"
|
.Dl "palera1n -n"
|
||||||
@@ -195,6 +260,8 @@ To verbose boot, use the
|
|||||||
.Fl V , -verbose-boot
|
.Fl V , -verbose-boot
|
||||||
option when jailbreaking.
|
option when jailbreaking.
|
||||||
.Pp
|
.Pp
|
||||||
|
Fakefs takes up around 5-10 GB of storage, and take up to 10 minutes to setup.
|
||||||
|
.Pp
|
||||||
iOS 15.0 requires DER entitlements, and iOS 15.1 requires hash agility in code signatures.
|
iOS 15.0 requires DER entitlements, and iOS 15.1 requires hash agility in code signatures.
|
||||||
As a result, binaries with the old code signature format need to be resigned with a recent
|
As a result, binaries with the old code signature format need to be resigned with a recent
|
||||||
version of the Procursus fork of
|
version of the Procursus fork of
|
||||||
@@ -202,6 +269,11 @@ version of the Procursus fork of
|
|||||||
before they can be ran on a device jailbroken with
|
before they can be ran on a device jailbroken with
|
||||||
.Nm
|
.Nm
|
||||||
\[char46]
|
\[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 INSTALLATION
|
||||||
The palera1n loader app will take up to 30 seconds to appear on the homescreen after the
|
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:
|
device has booted. If it does not appear, you can try using the shortcut:
|
||||||
@@ -226,11 +298,18 @@ The location of the temporary filesystem where jailbreak files are stash during
|
|||||||
When
|
When
|
||||||
.Fl L
|
.Fl L
|
||||||
is used, the log file of jbinit.
|
is used, the log file of jbinit.
|
||||||
The log file of jbinit.
|
.It Pa /Library/LaunchDaemons
|
||||||
|
The directory where jailbreak-specific
|
||||||
|
.Xr launchd.plist 5
|
||||||
|
property list files should be placed on rootful.
|
||||||
.It Pa /var/jb/Library/LaunchDaemons
|
.It Pa /var/jb/Library/LaunchDaemons
|
||||||
The directory where jailbreak-specific
|
The directory where jailbreak-specific
|
||||||
.Xr launchd.plist 5
|
.Xr launchd.plist 5
|
||||||
property list files should be placed on rootless.
|
property list files should be placed on rootless.
|
||||||
|
.It Pa /etc/rc.d
|
||||||
|
The directory where executable filse that needs to be executed during boot, before
|
||||||
|
daemons are launched, are placed rootful. They are executed after all filesystems
|
||||||
|
has been mounted.
|
||||||
.It Pa /var/jb/etc/rc.d
|
.It Pa /var/jb/etc/rc.d
|
||||||
The directory where executable files that needs to be executed during boot, before
|
The directory where executable files that needs to be executed during boot, before
|
||||||
daemons are launched, are placed on rootless. They are executed after all filesystems
|
daemons are launched, are placed on rootless. They are executed after all filesystems
|
||||||
@@ -251,8 +330,15 @@ injects a dylib into launchd to allow the
|
|||||||
.Sy launchctl runstats
|
.Sy launchctl runstats
|
||||||
command to be used on the device.
|
command to be used on the device.
|
||||||
.Sh DEPRECATED AND REMOVED FUNCTIONALITY
|
.Sh DEPRECATED AND REMOVED FUNCTIONALITY
|
||||||
.Pp
|
There was an option in
|
||||||
The fakefs functionality was removed.
|
.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
|
.Sh SEE ALSO
|
||||||
.Xr launchd 8
|
.Xr launchd 8
|
||||||
.Xr launchd.plist 5
|
.Xr launchd.plist 5
|
||||||
@@ -267,5 +353,4 @@ December 13, 2022. Later, the first attempt to rewrite palera1n into C begins on
|
|||||||
01 2023. The
|
01 2023. The
|
||||||
.Nm
|
.Nm
|
||||||
utility described here is the second attempt, which first started on January 16, 2023,
|
utility described here is the second attempt, which first started on January 16, 2023,
|
||||||
using checkra1n 1337 and a custom KPF.
|
using checkra1n 1337 and the plush KPF.
|
||||||
Something happened on August 15, 2023.
|
|
||||||
Executable
+20
@@ -0,0 +1,20 @@
|
|||||||
|
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
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef COMMON_H
|
||||||
|
#define COMMON_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
extern "C" {
|
||||||
|
#include <palerain.h>
|
||||||
|
#include <gui.h>
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DISCONNECTED 0
|
||||||
|
#define NORMAL 1
|
||||||
|
#define RECOVERY 2
|
||||||
|
#define DFU 3
|
||||||
|
#define rest(a) std::this_thread::sleep_for(std::chrono::seconds(a))
|
||||||
|
#define FLOAT_TO_INT(x) ((x)>=0?(int)((x)+0.5):(int)((x)-0.5))
|
||||||
|
|
||||||
|
void guifree(void);
|
||||||
|
void dfuhelper();
|
||||||
|
void send_alert(const char *title, const char *msg);
|
||||||
|
|
||||||
|
extern devinfo_t dev;
|
||||||
|
extern bool waiting_for_device;
|
||||||
|
extern bool unsupported_device;
|
||||||
|
extern bool supported_device;
|
||||||
|
extern bool recovery_wait;
|
||||||
|
extern bool jailbreak;
|
||||||
|
extern bool enter_dfu;
|
||||||
|
extern bool dfu_helper;
|
||||||
|
extern int device_status;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
#ifndef DESIGN_H
|
||||||
|
#define DESIGN_H
|
||||||
|
|
||||||
|
#define set_pos(a,b) ImGui::SetCursorPos(ImVec2(a,b))
|
||||||
|
#define font(a) ImGui::PushFont(io.Fonts->Fonts[a])
|
||||||
|
#define btn_text_on colors[ImGuiCol_Text] = ImVec4{.05f, .05f, .05f, 1.0f}
|
||||||
|
#define btn_text_off colors[ImGuiCol_Text] = ImVec4{1.0f, 1.0f, 1.0f, 1.0f}
|
||||||
|
#define dfu_text_light colors[ImGuiCol_Text] = ImVec4{1.0f, 1.0f, 1.0f, 1.0f}
|
||||||
|
#define dfu_text_dark colors[ImGuiCol_Text] = ImVec4{1.0f, 1.0f, 1.0f, 0.3f}
|
||||||
|
#define size(x,y) ImVec2(x,y)
|
||||||
|
#define pos(x,y) ImVec2(x,y)
|
||||||
|
|
||||||
|
/* Fonts we have loaded into memory */
|
||||||
|
#define SF_Reg 0
|
||||||
|
#define SF_Med 2
|
||||||
|
#define SF_Bold 1
|
||||||
|
#define SF_Sm_Bold 3
|
||||||
|
#define Hack 4
|
||||||
|
#define SF_RoundBold 5
|
||||||
|
#define SF_RegMed 6
|
||||||
|
#define SF_BoldLarge 7
|
||||||
|
#define WHITE ImVec4{1.0f, 1.0f, 1.0f, 1.0f}
|
||||||
|
|
||||||
|
void ImageRotated(ImTextureID tex_id, ImVec2 center, ImVec2 size, float angle);
|
||||||
|
void draw_box(ImVec2 location, ImVec2 size, ImVec4 color, float radius);
|
||||||
|
void reset_design(void);
|
||||||
|
void reset_views(void);
|
||||||
|
bool is_hovered(const char* id, int w, int h);
|
||||||
|
bool is_pressed(const char* id, int w, int h);
|
||||||
|
void anim_btn(const char* id, ImVec2 size, ImVec2 size_to, ImVec2 pos, ImVec2 pos_to);
|
||||||
|
void anim_box(const char* id, ImVec2 size, ImVec2 size_to, ImVec2 pos, ImVec2 pos_to);
|
||||||
|
void label(const char *text, ImVec2 location, ImVec4 color, int font);
|
||||||
|
void rotate_image(const char *image, ImVec2 pos, ImVec2 size, float angle, float speed);
|
||||||
|
std::string addstr2(const char *str1, const char *str2);
|
||||||
|
std::string addstr3(const char *str1, const char *str2, const char *str3);
|
||||||
|
std::string addstr4(const char *str1, const char *str2, const char *str3, const char *str4);
|
||||||
|
|
||||||
|
void image_btn_style_alt(void);
|
||||||
|
void init_style(void);
|
||||||
|
void init_colors(void);
|
||||||
|
ImVec4 hex_color(int hex, float alpha);
|
||||||
|
ImColor hex_imcolor(int hex, float alpha);
|
||||||
|
void image_btn_style();
|
||||||
|
|
||||||
|
extern float btn_w;
|
||||||
|
extern float btn_h;
|
||||||
|
extern float btn_x;
|
||||||
|
extern float btn_y;
|
||||||
|
|
||||||
|
extern float box_w;
|
||||||
|
extern float box_h;
|
||||||
|
extern float box_x;
|
||||||
|
extern float box_y;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#ifndef GUI_H
|
||||||
|
#define GUI_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define WINDOW_X 0
|
||||||
|
#define WINDOW_Y 0
|
||||||
|
#define WINDOW_SIZE_X 550
|
||||||
|
#define WINDOW_SIZE_Y 300
|
||||||
|
|
||||||
|
#define WINDOW_TITLE "palera1n"
|
||||||
|
#define WINDOW_RESIZE false
|
||||||
|
#define WINDOW_RESTORE true
|
||||||
|
#define WINDOW_ALLOW_FULLSCREEN false
|
||||||
|
#define WINDOW_BORDERLESS false
|
||||||
|
#define WINDOW_DECORATIONS true
|
||||||
|
|
||||||
|
#define IDLE false
|
||||||
|
#define TARGET_FPS 60
|
||||||
|
#define CONFIG_FILE "palera1n.ini"
|
||||||
|
#define EMBED_ASSETS true
|
||||||
|
#define ASSETS_DIRECTORY "assets"
|
||||||
|
|
||||||
|
#define NORMAL_MODE 1
|
||||||
|
#define RECOVERY_MODE 2
|
||||||
|
#define DFU_MODE 3
|
||||||
|
#define NONE 4
|
||||||
|
#define PONGO_MODE 5
|
||||||
|
|
||||||
|
int palera1n(int argc, char *argv[]);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* pongoOS - https://checkra.in
|
||||||
|
*
|
||||||
|
* Copyright (C) 2019-2022 checkra1n team
|
||||||
|
*
|
||||||
|
* This file is part of pongoOS.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef _KERNINFO_H
|
||||||
|
#define _KERNINFO_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define MAX_BOOTARGS_LEN 256
|
||||||
|
|
||||||
|
#define checkrain_option_none 0x00000000
|
||||||
|
#define checkrain_option_all 0x7fffffff
|
||||||
|
#define checkrain_option_failure 0x80000000
|
||||||
|
|
||||||
|
// Host options
|
||||||
|
#define checkrain_option_verbose_logging (1 << 0)
|
||||||
|
#define checkrain_option_demote (1 << 1)
|
||||||
|
#define checkrain_option_early_exit (1 << 2)
|
||||||
|
#define checkrain_option_quick_mode (1 << 3)
|
||||||
|
#define checkrain_option_pongo_shell (1 << 4)
|
||||||
|
#define checkrain_option_pongo_full (1 << 5)
|
||||||
|
|
||||||
|
// KPF options
|
||||||
|
#define checkrain_option_verbose_boot (1 << 0)
|
||||||
|
|
||||||
|
// Global options
|
||||||
|
#define checkrain_option_safemode (1 << 0)
|
||||||
|
#define checkrain_option_bind_mount (1 << 1)
|
||||||
|
#define checkrain_option_overlay (1 << 2)
|
||||||
|
#define checkrain_option_force_revert (1 << 7) /* keep this at 7 */
|
||||||
|
|
||||||
|
// palera1n option
|
||||||
|
#define palerain_option_rootful (1 << 0) /* rootful jailbreak */
|
||||||
|
#define palerain_option_jbinit_log_to_file (1 << 1) /* log to /cores/jbinit.log */
|
||||||
|
#define palerain_option_setup_rootful (1 << 2) /* create fakefs */
|
||||||
|
#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 */
|
||||||
|
/* reserved values */
|
||||||
|
// #define palerain_option_no_ssv (1 << 7) /* no signed system volume */
|
||||||
|
// #define palerain_option_force_fakefs (1 << 8) /* force fakefs, even without SSV */
|
||||||
|
// #define palerain_option_rootless (1 << 9) /* rootless jailbreak */
|
||||||
|
#define palerain_option_clean_fakefs (1 << 10) /* clean fakefs, but does not delete it */
|
||||||
|
|
||||||
|
#ifdef DEV_BUILD
|
||||||
|
#define palerain_option_test1 (1 << 29)
|
||||||
|
#define palerain_option_test2 (1 << 30)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 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
|
||||||
|
#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_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'
|
||||||
|
|
||||||
|
typedef uint32_t checkrain_option_t, *checkrain_option_p;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
jailbreak_capability_tfp0 = 1 << 0,
|
||||||
|
jailbreak_capability_userspace_reboot = 1 << 1,
|
||||||
|
jailbreak_capability_dyld_ignore_os = 1 << 2, // TODO: This needs a better name
|
||||||
|
} jailbreak_capability_t, *jailbreak_capability_p;
|
||||||
|
|
||||||
|
#define DEFAULT_CAPABILITIES (jailbreak_capability_tfp0|jailbreak_capability_userspace_reboot)
|
||||||
|
struct kerninfo {
|
||||||
|
uint64_t size;
|
||||||
|
uint64_t base;
|
||||||
|
uint64_t slide;
|
||||||
|
checkrain_option_t flags;
|
||||||
|
};
|
||||||
|
struct paleinfo {
|
||||||
|
uint32_t magic; // 'PLSH' / 0x504c5348
|
||||||
|
uint32_t version; // 1
|
||||||
|
checkrain_option_t flags;
|
||||||
|
char rootdev[0x10];
|
||||||
|
};
|
||||||
|
struct kpfinfo {
|
||||||
|
struct kerninfo k;
|
||||||
|
checkrain_option_t kpf_flags;
|
||||||
|
char bootargs[MAX_BOOTARGS_LEN];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define checkrain_set_option(options, option, enabled) do { \
|
||||||
|
if (enabled) \
|
||||||
|
options = (checkrain_option_t)(options | option); \
|
||||||
|
else \
|
||||||
|
options = (checkrain_option_t)(options & ~option); \
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
static inline bool checkrain_options_enabled(checkrain_option_t flags, checkrain_option_t opt)
|
||||||
|
{
|
||||||
|
return (flags & opt) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* jbinit - https://github.com/palera1n/jbinit
|
|
||||||
*
|
|
||||||
* This file is part of jbinit
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PALEINFO_H
|
|
||||||
#define PALEINFO_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define PALEINFO_VERSION 2U
|
|
||||||
typedef uint64_t palerain_option_t;
|
|
||||||
|
|
||||||
// unified palera1n options
|
|
||||||
#define palerain_option_rootful (UINT64_C(1) << 0) /* rootful jailbreak */
|
|
||||||
#define palerain_option_rootless (UINT64_C(1) << 1) /* rootless jailbreak */
|
|
||||||
#define palerain_option_setup_rootful (UINT64_C(1) << 2) /* create fakefs */
|
|
||||||
// (UINT64_C(1) << 3) /* Deprecated and removed */
|
|
||||||
#define palerain_option_setup_partial_root (UINT64_C(1) << 4) /* fakefs creating should be partial */
|
|
||||||
#define palerain_option_checkrain_is_clone (UINT64_C(1) << 5) /* supplied checkra1n is checkra1n clone */
|
|
||||||
#define palerain_option_rootless_livefs (UINT64_C(1) << 6) /* mount root livefs on rootless */
|
|
||||||
#define palerain_option_ssv (UINT64_C(1) << 7) /* has signed system volume */
|
|
||||||
// (UINT64_C(1) << 8) /* reserved */
|
|
||||||
#define palerain_option_clean_fakefs (UINT64_C(1) << 9) /* clean fakefs, but does not delete it */
|
|
||||||
#define palerain_option_tui (UINT64_C(1) << 10) /* terminal user interface */
|
|
||||||
// #define palerain_option_gui (UINT64_C(1) << 11) /* graphical user interface*/
|
|
||||||
#define palerain_option_dfuhelper_only (UINT64_C(1) << 12) /* dfuhelper only */
|
|
||||||
#define palerain_option_pongo_exit (UINT64_C(1) << 13) /* boot to clean pongo shell */
|
|
||||||
#define palerain_option_demote (UINT64_C(1) << 14) /* Demote effective production fuse status */
|
|
||||||
#define palerain_option_pongo_full (UINT64_C(1) << 15) /* Boot to pongo with default images and options */
|
|
||||||
#define palerain_option_palerain_version (UINT64_C(1) << 16) /* Print version */
|
|
||||||
#define palerain_option_exit_recovery (UINT64_C(1) << 17) /* Exit recovery mode */
|
|
||||||
#define palerain_option_reboot_device (UINT64_C(1) << 18) /* Reboot device in normal mode */
|
|
||||||
#define palerain_option_enter_recovery (UINT64_C(1) << 19) /* Enter recovery mode */
|
|
||||||
#define palerain_option_device_info (UINT64_C(1) << 20) /* Print device info */
|
|
||||||
#define palerain_option_no_colors (UINT64_C(1) << 21) /* no colors */
|
|
||||||
#define palerain_option_bind_mount (UINT64_C(1) << 22) /* bind mounts should be used (always true iOS 15+)*/
|
|
||||||
#define palerain_option_overlay (UINT64_C(1) << 23) /* there is an overlay (should always be true) */
|
|
||||||
#define palerain_option_force_revert (UINT64_C(1) << 24) /* Unjailbreak */
|
|
||||||
#define palerain_option_safemode (UINT64_C(1) << 25) /* Enter safe mode */
|
|
||||||
#define palerain_option_verbose_boot (UINT64_C(1) << 26) /* verbose boot */
|
|
||||||
// #define palerain_option_sf_ssh (UINT64_C(1) << 27) /* safe mode with bootstrap ssh */
|
|
||||||
// #define palerain_option_sf_launchdaemons (UINT64_C(1) << 28) /* safe mode with launchdaemons */
|
|
||||||
// #define palerain_option_emerg_mode (UINT64_C(1) << 29) /* emergency mode (early boot usb shell) */
|
|
||||||
#define palerain_option_jbinit_log_to_file (UINT64_C(1) << 30) /* deprecated (kept for compatibility) */
|
|
||||||
|
|
||||||
#define palerain_option_flower_chain (UINT64_C(1) << 61) /* Flower chain */
|
|
||||||
#define palerain_option_test1 (UINT64_C(1) << 62) /* Developer test option 1 */
|
|
||||||
#define palerain_option_test2 (UINT64_C(1) << 63) /* Developer test option 2 */
|
|
||||||
|
|
||||||
#define PALEINFO_MAGIC 'PLSH'
|
|
||||||
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic warning "-Wpadded"
|
|
||||||
|
|
||||||
/* paleinfo version 2, appended to ramdisk */
|
|
||||||
struct paleinfo {
|
|
||||||
uint32_t magic; /* 'PLSH' */
|
|
||||||
uint32_t version; /* 2 */
|
|
||||||
uint64_t kbase; /* kernel base */
|
|
||||||
uint64_t kslide; /* kernel slide */
|
|
||||||
uint64_t flags; /* unified palera1n flags */
|
|
||||||
char rootdev[0x10]; /* ex. disk0s1s8 */
|
|
||||||
};
|
|
||||||
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
||||||
#endif
|
|
||||||
+16
-12
@@ -6,7 +6,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "xxd-embedded.h"
|
#include "xxd-embedded.h"
|
||||||
#include "paleinfo.h"
|
#include "kerninfo.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
#define USB_RET_NOT_RESPONDING LIBUSB_ERROR_OTHER
|
#define USB_RET_NOT_RESPONDING LIBUSB_ERROR_OTHER
|
||||||
#define USB_RET_IO LIBUSB_ERROR_IO
|
#define USB_RET_IO LIBUSB_ERROR_IO
|
||||||
#define USB_RET_NO_DEVICE LIBUSB_ERROR_NO_DEVICE
|
#define USB_RET_NO_DEVICE LIBUSB_ERROR_NO_DEVICE
|
||||||
typedef int32_t usb_ret_t;
|
typedef int usb_ret_t;
|
||||||
typedef libusb_device_handle *usb_device_handle_t;
|
typedef libusb_device_handle *usb_device_handle_t;
|
||||||
|
|
||||||
typedef struct stuff
|
typedef struct stuff
|
||||||
@@ -80,8 +80,8 @@ usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, uint32_t len);
|
|||||||
#define MH_CIGAM_64 0xcffaedfe
|
#define MH_CIGAM_64 0xcffaedfe
|
||||||
#define MH_KEXT_BUNDLE 0xb
|
#define MH_KEXT_BUNDLE 0xb
|
||||||
|
|
||||||
typedef int32_t cpu_type_t;
|
typedef int cpu_type_t;
|
||||||
typedef int32_t cpu_subtype_t;
|
typedef int cpu_subtype_t;
|
||||||
|
|
||||||
#define CPU_ARCH_ABI64 0x01000000
|
#define CPU_ARCH_ABI64 0x01000000
|
||||||
#define CPU_TYPE_ARM ((cpu_type_t) 12)
|
#define CPU_TYPE_ARM ((cpu_type_t) 12)
|
||||||
@@ -131,7 +131,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int mode;
|
int mode;
|
||||||
int cpid;
|
unsigned int cpid;
|
||||||
char product_type[0x20];
|
char product_type[0x20];
|
||||||
char display_name[0x20];
|
char display_name[0x20];
|
||||||
char iboot_ver[0x20];
|
char iboot_ver[0x20];
|
||||||
@@ -140,9 +140,9 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t magic; /* 0xd803b376*/
|
uint32_t magic; /* 0xd803b376*/
|
||||||
unsigned char* ptr; /* pointer to the override file in memory */
|
unsigned char* ptr; /* pointer to the override file in memory */
|
||||||
uint32_t len; /* length of override file */
|
unsigned int len; /* length of override file */
|
||||||
unsigned char* orig_ptr; /* pointer to the overriden file */
|
unsigned char* orig_ptr; /* pointer to the overriden file */
|
||||||
uint32_t orig_len; /* length of the overriden file */
|
unsigned int orig_len; /* length of the overriden file */
|
||||||
int fd; /* file descriptor of the override file */
|
int fd; /* file descriptor of the override file */
|
||||||
} override_file_t;
|
} override_file_t;
|
||||||
|
|
||||||
@@ -155,8 +155,8 @@ extern char* pongo_path;
|
|||||||
extern bool tui_started;
|
extern bool tui_started;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern uint64_t palerain_flags;
|
extern checkrain_option_t host_flags;
|
||||||
extern uint64_t* palerain_flags_p;
|
extern checkrain_option_p host_flags_p;
|
||||||
|
|
||||||
extern pthread_t dfuhelper_thread, pongo_thread;
|
extern pthread_t dfuhelper_thread, pongo_thread;
|
||||||
extern int pongo_thr_running, dfuhelper_thr_running;
|
extern int pongo_thr_running, dfuhelper_thr_running;
|
||||||
@@ -165,7 +165,7 @@ extern niarelap_file_t *kpf_to_upload_1, *ramdisk_to_upload_1, *overlay_to_uploa
|
|||||||
extern niarelap_file_t **kpf_to_upload, **ramdisk_to_upload, **overlay_to_upload;
|
extern niarelap_file_t **kpf_to_upload, **ramdisk_to_upload, **overlay_to_upload;
|
||||||
extern override_file_t override_ramdisk, override_kpf, override_overlay;
|
extern override_file_t override_ramdisk, override_kpf, override_overlay;
|
||||||
|
|
||||||
extern uint64_t palerain_flags;
|
extern uint32_t checkrain_flags, palerain_flags, kpf_flags;
|
||||||
extern pthread_mutex_t log_mutex;
|
extern pthread_mutex_t log_mutex;
|
||||||
|
|
||||||
extern pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
|
extern pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
|
||||||
@@ -173,7 +173,11 @@ extern pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
|
|||||||
extern int pongo_thr_running, dfuhelper_thr_running;
|
extern int pongo_thr_running, dfuhelper_thr_running;
|
||||||
extern bool device_has_booted;
|
extern bool device_has_booted;
|
||||||
extern char xargs_cmd[0x270];
|
extern char xargs_cmd[0x270];
|
||||||
extern char palerain_flags_cmd[0x30];
|
extern char checkrain_flags_cmd[0x20];
|
||||||
|
extern char palerain_flags_cmd[0x20];
|
||||||
|
extern char kpf_flags_cmd[0x20];
|
||||||
|
extern char dtpatch_cmd[0x20];
|
||||||
|
extern char rootfs_cmd[512];
|
||||||
extern char* ext_checkra1n;
|
extern char* ext_checkra1n;
|
||||||
|
|
||||||
void thr_cleanup(void* ptr);
|
void thr_cleanup(void* ptr);
|
||||||
@@ -226,7 +230,7 @@ void print_credits(void);
|
|||||||
|
|
||||||
#ifdef TUI
|
#ifdef TUI
|
||||||
#include <newt.h>
|
#include <newt.h>
|
||||||
newtComponent get_tui_log(void);
|
newtComponent get_tui_log();
|
||||||
newtComponent set_tui_log(newtComponent co);
|
newtComponent set_tui_log(newtComponent co);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
+10
-10
@@ -11,7 +11,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <newt.h>
|
#include <newt.h>
|
||||||
#include <paleinfo.h>
|
#include <kerninfo.h>
|
||||||
|
|
||||||
#define WIDTH 76
|
#define WIDTH 76
|
||||||
#define HEIGHT 19
|
#define HEIGHT 19
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#define PI_STEP_CURRENT NEWT_COLORSET_CUSTOM(1)
|
#define PI_STEP_CURRENT NEWT_COLORSET_CUSTOM(1)
|
||||||
#define PI_STEP_OTHER NEWT_COLORSET_CUSTOM(2)
|
#define PI_STEP_OTHER NEWT_COLORSET_CUSTOM(2)
|
||||||
|
|
||||||
#define CHECKBOX_STATE(flags, opt) (flags & opt) != 0 ? '*' : ' '
|
#define CHECKBOX_STATE(flags, opt) checkrain_options_enabled(flags, opt) ? '*' : ' '
|
||||||
|
|
||||||
typedef enum tui_screens {
|
typedef enum tui_screens {
|
||||||
ERROR_SCREEN = -1,
|
ERROR_SCREEN = -1,
|
||||||
@@ -33,17 +33,17 @@ typedef enum tui_screens {
|
|||||||
} tui_screen_t;
|
} tui_screen_t;
|
||||||
|
|
||||||
typedef struct bitfield_checkbox_info {
|
typedef struct bitfield_checkbox_info {
|
||||||
uint64_t* flags_p;
|
checkrain_option_p flags_p;
|
||||||
uint64_t opt;
|
checkrain_option_t opt;
|
||||||
} tui_bit_info_t;
|
} tui_bit_info_t;
|
||||||
|
|
||||||
tui_screen_t tui_screen_main(void);
|
tui_screen_t tui_screen_main();
|
||||||
tui_screen_t tui_screen_options(void);
|
tui_screen_t tui_screen_options();
|
||||||
tui_screen_t tui_screen_enter_recovery(void);
|
tui_screen_t tui_screen_enter_recovery();
|
||||||
tui_screen_t tui_screen_enter_dfu(void);
|
tui_screen_t tui_screen_enter_dfu();
|
||||||
tui_screen_t tui_screen_jailbreak(void);
|
tui_screen_t tui_screen_jailbreak();
|
||||||
|
|
||||||
int redraw_screen(void);
|
int redraw_screen();
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+13
-15
@@ -5,26 +5,24 @@
|
|||||||
#include <TargetConditionals.h>
|
#include <TargetConditionals.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
extern unsigned char checkra1n[];
|
||||||
|
extern unsigned int checkra1n_len;
|
||||||
|
|
||||||
extern uint8_t checkra1n[];
|
extern unsigned char checkra1n_kpf_pongo[];
|
||||||
extern uint32_t checkra1n_len;
|
extern unsigned int checkra1n_kpf_pongo_len;
|
||||||
|
|
||||||
extern uint8_t checkra1n_kpf_pongo_lzma[];
|
extern unsigned char ramdisk_dmg[];
|
||||||
extern uint32_t checkra1n_kpf_pongo_lzma_len;
|
extern unsigned int ramdisk_dmg_len;
|
||||||
|
|
||||||
extern uint8_t ramdisk_dmg_lzma[];
|
extern unsigned char binpack_dmg[];
|
||||||
extern uint32_t ramdisk_dmg_lzma_len;
|
extern unsigned int binpack_dmg_len;
|
||||||
|
|
||||||
extern uint8_t binpack_dmg[];
|
extern unsigned char Pongo_bin[];
|
||||||
extern uint32_t binpack_dmg_len;
|
extern unsigned int Pongo_bin_len;
|
||||||
|
|
||||||
extern uint8_t Pongo_bin[];
|
#if defined(__APPLE__) && (TARGET_OS_IPHONE || defined(DEV_BUILD))
|
||||||
extern uint32_t Pongo_bin_len;
|
extern unsigned char libcheckra1nhelper_dylib[];
|
||||||
|
extern unsigned int libcheckra1nhelper_dylib_len;
|
||||||
#if defined(__APPLE__) && (TARGET_OS_IPHONE || defined(DEV_BUILD) || defined(FORCE_HELPER))
|
|
||||||
extern uint8_t libcheckra1nhelper_dylib[];
|
|
||||||
extern uint32_t libcheckra1nhelper_dylib_len;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+2
-7
@@ -8,15 +8,10 @@ Depends: usbmuxd
|
|||||||
Section: Utilities
|
Section: Utilities
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Homepage: https://palera.in
|
Homepage: https://palera.in
|
||||||
Description: iOS 15.0-16.5.1 semi-tethered checkm8 jailbreak
|
Description: iOS 15.0-16.5 semi-tethered checkm8 jailbreak
|
||||||
palera1n is an iOS/iPadOS 15.0-16.5.1 semi tethered jailbreak
|
palera1n is an iOS/iPadOS 15.0-16.5 semi tethered jailbreak
|
||||||
based on the checkm8 exploit.
|
based on the checkm8 exploit.
|
||||||
.
|
.
|
||||||
palera1n is able to jailbreak the device in fakefs-rootful mode,
|
palera1n is able to jailbreak the device in fakefs-rootful mode,
|
||||||
where / is writable, as well as rootless mode, where / cannot be
|
where / is writable, as well as rootless mode, where / cannot be
|
||||||
written to.
|
written to.
|
||||||
.
|
|
||||||
IMPORTANT: This does NOT make palera1n untethered or allow you to
|
|
||||||
jailbreak your current device without a computer. It just allows
|
|
||||||
you to jailbreak another iDevice using this device, given you have
|
|
||||||
an appropriate cable. Also, the success rate is likely to be bad.
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
class Palera1n < Formula
|
||||||
|
desc "iOS 15.0-16.3.1 semi-tethered checkm8 jailbreak"
|
||||||
|
homepage "https://palera.in/"
|
||||||
|
url ""
|
||||||
|
version "2.0.0"
|
||||||
|
sha256 ""
|
||||||
|
license "MIT"
|
||||||
|
|
||||||
|
depends_on "cmake" => :build
|
||||||
|
depends_on "libimobiledevice" => :build
|
||||||
|
depends_on "libirecovery" => :build
|
||||||
|
depends_on "libusb" => :build
|
||||||
|
depends_on "libusbmuxd" => :build
|
||||||
|
depends_on "mbedtls" => :build
|
||||||
|
depends_on "pkg-config" => :build
|
||||||
|
depends_on "readline" => :build
|
||||||
|
|
||||||
|
def install
|
||||||
|
system "cmake", "."
|
||||||
|
system "make"
|
||||||
|
bin.install "output/palera1n" => "palera1n"
|
||||||
|
end
|
||||||
|
|
||||||
|
test do
|
||||||
|
system "false"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Name=palera1n
|
||||||
|
Exec=~/usr/local/bin
|
||||||
|
Icon=~/.palera1n/icon.ico
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
+61
-79
@@ -1,84 +1,92 @@
|
|||||||
all: palera1n
|
all: palera1n
|
||||||
|
|
||||||
OBJDIR = obj
|
OBJECTS = main.o dfuhelper.o devhelper.o lockdown_helper.o
|
||||||
GENDIR = gen
|
OBJECTS += optparse.o override_file.o log.o lock_vars.o credits.o
|
||||||
RESOURCES_DIR = resources
|
OBJECTS += fake_embedded.o exec_checkra1n.o pongo_helper.o
|
||||||
|
OBJECTS += boyermoore_memmem.o
|
||||||
C_SRC = $(wildcard *.c)
|
|
||||||
OBJS = $(patsubst %,$(OBJDIR)/%,$(C_SRC:.c=.c.o))
|
|
||||||
|
|
||||||
ifeq (,$(findstring macosx, $(CFLAGS)))
|
ifeq (,$(findstring macosx, $(CFLAGS)))
|
||||||
ifneq (,$(findstring version-min=, $(CFLAGS)))
|
ifneq (,$(findstring version-min=, $(CFLAGS)))
|
||||||
C_SRC += $(GENDIR)/gen-libcheckra1nhelper.dylib.c
|
OBJECTS += xxd-libcheckra1nhelper.dylib.o
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(FORCE_HELPER),1)
|
ifeq ($(FORCE_HELPER),1)
|
||||||
C_SRC += $(GENDIR)/gen-libcheckra1nhelper.dylib.c
|
OBJECTS += xxd-libcheckra1nhelper.dylib.o
|
||||||
CFLAGS += -DFORCE_HELPER
|
CFLAGS += -DFORCE_HELPER
|
||||||
BUILD_OPTIONS += FORCE_HELPER
|
BUILD_OPTIONS += FORCE_HELPER
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(NO_RAMDISK),1)
|
ifneq ($(NO_RAMDISK),1)
|
||||||
C_SRC += $(GENDIR)/gen-ramdisk.dmg.lzma.c
|
OBJECTS += xxd-ramdisk.dmg.o
|
||||||
else
|
else
|
||||||
CFLAGS += -DNO_RAMDISK -DRAMDISK_COMPRESSED_SIZE=\"0\"
|
CFLAGS += -DNO_RAMDISK
|
||||||
BUILD_OPTIONS += NO_RAMDISK
|
BUILD_OPTIONS += NO_RAMDISK
|
||||||
endif
|
endif
|
||||||
ifneq ($(NO_KPF),1)
|
ifneq ($(NO_KPF),1)
|
||||||
C_SRC += $(GENDIR)/gen-checkra1n-kpf-pongo.lzma.c
|
OBJECTS += xxd-checkra1n-kpf-pongo.o
|
||||||
else
|
else
|
||||||
CFLAGS += -DNO_KPF
|
CFLAGS += -DNO_KPF
|
||||||
BUILD_OPTIONS += NO_KPF
|
BUILD_OPTIONS += NO_KPF
|
||||||
endif
|
endif
|
||||||
ifneq ($(NO_OVERLAY),1)
|
ifneq ($(NO_OVERLAY),1)
|
||||||
C_SRC += $(GENDIR)/gen-binpack.dmg.c
|
OBJECTS += xxd-binpack.dmg.o
|
||||||
else
|
else
|
||||||
CFLAGS += -DNO_OVERLAY
|
CFLAGS += -DNO_OVERLAY
|
||||||
BUILD_OPTIONS += NO_OVERLAY
|
BUILD_OPTIONS += NO_OVERLAY
|
||||||
endif
|
endif
|
||||||
ifneq ($(NO_CHECKRAIN),1)
|
ifneq ($(NO_CHECKRAIN),1)
|
||||||
C_SRC += $(GENDIR)/gen-checkra1n.c
|
OBJECTS += xxd-checkra1n.o
|
||||||
else
|
else
|
||||||
CFLAGS += -DNO_CHECKRAIN
|
CFLAGS += -DNO_CHECKRAIN
|
||||||
BUILD_OPTIONS += NO_CHECKRAIN
|
BUILD_OPTIONS += NO_CHECKRAIN
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(NO_CUSTOM_PONGO),1)
|
ifneq ($(NO_CUSTOM_PONGO),1)
|
||||||
C_SRC += $(GENDIR)/gen-Pongo.bin.c
|
OBJECTS += xxd-Pongo.bin.o
|
||||||
else
|
else
|
||||||
CFLAGS += -DNO_CUSTOM_PONGO
|
CFLAGS += -DNO_CUSTOM_PONGO
|
||||||
BUILD_OPTIONS += NO_CUSTOM_PONGO
|
BUILD_OPTIONS += NO_CUSTOM_PONGO
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TUI),1)
|
ifeq ($(TUI),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
|
BUILD_OPTIONS += TUI
|
||||||
CFLAGS += -DTUI
|
CFLAGS += -DTUI
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CHECKRA1N_VERSION ?= 0.1337.2
|
ifeq ($(GUI),1)
|
||||||
|
CXXOBJECTS = gui_alerts.o gui_design.o gui_device.o gui_main.o
|
||||||
|
BUILD_OPTIONS += GUI
|
||||||
|
CFLAGS += -DGUI
|
||||||
|
endif
|
||||||
|
|
||||||
|
CHECKRA1N_VERSION ?= 0.1337.1
|
||||||
LIPO = lipo
|
LIPO = lipo
|
||||||
LDID = ldid
|
LDID = ldid
|
||||||
|
|
||||||
ifeq ($(TARGET_OS),Darwin)
|
ifeq ($(TARGET_OS),Darwin)
|
||||||
ifneq ($(USE_LIBUSB),1)
|
ifneq ($(USE_LIBUSB),1)
|
||||||
|
OBJECTS += usb_iokit.o
|
||||||
else
|
else
|
||||||
LIBS += -framework SystemConfiguration -framework Security
|
LIBS += -framework SystemConfiguration -framework Security
|
||||||
BUILD_OPTIONS += USE_LIBUSB
|
BUILD_OPTIONS += USE_LIBUSB
|
||||||
endif
|
endif
|
||||||
# add lto and debug symbols for lto
|
# add lto and debug symbols for lto
|
||||||
CFLAGS += -flto=full -g
|
CFLAGS += -flto=full -g
|
||||||
LDFLAGS += -Wl,-object_path_lto,obj/lto.o
|
LDFLAGS += -Wl,-object_path_lto,lto.o
|
||||||
else
|
else
|
||||||
USE_LIBUSB = 1
|
USE_LIBUSB = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(USE_LIBUSB),1)
|
ifeq ($(USE_LIBUSB),1)
|
||||||
|
OBJECTS += usb_libusb.o
|
||||||
CFLAGS += -DUSE_LIBUSB=1
|
CFLAGS += -DUSE_LIBUSB=1
|
||||||
LIBS += $(DEP)/lib/libusb-1.0.a
|
LIBS += $(DEP)/lib/libusb-1.0.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ROOTFUL),1)
|
ifneq ($(ROOTFUL),0)
|
||||||
CFLAGS += -DROOTFUL=1
|
CFLAGS += -DROOTFUL=1
|
||||||
BUILD_OPTIONS += ROOTFUL
|
BUILD_OPTIONS += ROOTFUL
|
||||||
endif
|
endif
|
||||||
@@ -89,97 +97,71 @@ endif
|
|||||||
|
|
||||||
CFLAGS += -DBUILD_OPTIONS=\""$(BUILD_OPTIONS)"\"
|
CFLAGS += -DBUILD_OPTIONS=\""$(BUILD_OPTIONS)"\"
|
||||||
|
|
||||||
ifeq ($(TARGET_OS),Linux)
|
checkra1n-%:
|
||||||
ifeq ($(UNAME),Linux)
|
curl -LO https://assets.checkra.in/downloads/preview/$(CHECKRA1N_VERSION)/$@
|
||||||
ifeq ($(CHECKRA1N_NAME),)
|
|
||||||
ifeq ($(shell arch),x86_64)
|
|
||||||
CHECKRA1N_NAME := linux-x86_64
|
|
||||||
else ifeq ($(shell arch | grep -q 'i[3-7]86' && echo 1),1)
|
|
||||||
CHECKRA1N_NAME := linux-x86
|
|
||||||
else ifeq ($(shell arch | grep -v '\(arm\|aarch\)[a-z]\?\+64' | grep -q arm && echo 1),1)
|
|
||||||
CHECKRA1N_NAME := linux-armel
|
|
||||||
else ifeq ($(shell arch | grep -q '\(arm\|aarch\)[a-z]\?\+64' && echo 1),1)
|
|
||||||
CHECKRA1N_NAME := linux-arm64
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(RESOURCES_DIR)/checkra1n-%:
|
|
||||||
curl -Lfo $@ https://assets.checkra.in/downloads/preview/$(CHECKRA1N_VERSION)/$$(echo $@ | cut -d/ -f2)
|
|
||||||
chmod 755 $@
|
chmod 755 $@
|
||||||
|
|
||||||
$(RESOURCES_DIR)/checkra1n: $(RESOURCES_DIR)/checkra1n-macos usb.xml
|
checkra1n: checkra1n-macos usb.xml
|
||||||
ifeq ($(TARGET_OS),Darwin)
|
ifeq ($(TARGET_OS),Darwin)
|
||||||
ifneq (,$(findstring arm64, $(CFLAGS)))
|
ifneq (,$(findstring arm64, $(CFLAGS)))
|
||||||
$(LIPO) -thin arm64 -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
|
$(LIPO) -thin arm64 -output checkra1n checkra1n-macos
|
||||||
else ifneq (,$(findstring x86_64, $(CFLAGS)))
|
else ifneq (,$(findstring x86_64, $(CFLAGS)))
|
||||||
$(LIPO) -thin x86_64 -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
|
$(LIPO) -thin x86_64 -output checkra1n checkra1n-macos
|
||||||
else ifeq ($(shell arch),i386)
|
else ifeq ($(shell arch),i386)
|
||||||
$(LIPO) -thin x86_64 -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
|
$(LIPO) -thin x86_64 -output checkra1n checkra1n-macos
|
||||||
else
|
else
|
||||||
$(LIPO) -thin $(shell arch) -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
|
$(LIPO) -thin $(shell arch) -output checkra1n checkra1n-macos
|
||||||
endif
|
endif
|
||||||
ifeq (,$(findstring macosx, $(CFLAGS)))
|
ifeq (,$(findstring macosx, $(CFLAGS)))
|
||||||
ifneq (,$(findstring version-min=, $(CFLAGS)))
|
ifneq (,$(findstring version-min=, $(CFLAGS)))
|
||||||
vtool -remove-build-version 1 -replace -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n
|
vtool -remove-build-version 1 -replace -output checkra1n checkra1n
|
||||||
vtool -set-build-version $(FAKE_PLATFORM) $(FAKE_MINOS) $(FAKE_SDK) -replace -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n
|
vtool -set-build-version $(FAKE_PLATFORM) $(FAKE_MINOS) $(FAKE_SDK) -replace -output checkra1n checkra1n
|
||||||
install_name_tool -change /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit /System/Library/Frameworks/IOKit.framework/IOKit $(RESOURCES_DIR)/checkra1n
|
install_name_tool -change /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit /System/Library/Frameworks/IOKit.framework/IOKit checkra1n
|
||||||
install_name_tool -change /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation $(RESOURCES_DIR)/checkra1n
|
install_name_tool -change /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation checkra1n
|
||||||
$(LDID) -Susb.xml $(RESOURCES_DIR)/checkra1n
|
$(LDID) -Susb.xml checkra1n
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
cp $(RESOURCES_DIR)/checkra1n-$(CHECKRA1N_NAME) $(RESOURCES_DIR)/checkra1n
|
cp checkra1n-$(CHECKRA1N_NAME) checkra1n
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(GENDIR)/gen-%.c: $(RESOURCES_DIR)/%
|
xxd-%.c: %
|
||||||
echo '#include <stdint.h>' > $(RESOURCES_DIR)/../$@
|
xxd -iC $< > $@
|
||||||
cd $(RESOURCES_DIR) && xxd -iC $$(echo $< | cut -d/ -f2) | sed -e 's/unsigned int/uint32_t/' -e 's/unsigned char/uint8_t/' >> ../$@
|
|
||||||
|
|
||||||
|
%.o: %.c $(wildcard ../include/*.h)
|
||||||
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
$(OBJDIR)/pongo_helper.c.o: pongo_helper.c $(wildcard ../include/*.h) $(RESOURCES_DIR)/ramdisk.dmg $(RESOURCES_DIR)/checkra1n-kpf-pongo
|
%.o: %.cpp $(wildcard ../include/*.h)
|
||||||
$(CC) -c -o $@ $(CFLAGS) -DRAMDISK_UNCOMPRESSED_SIZE="\"$$(wc -c < $(RESOURCES_DIR)/ramdisk.dmg | tr -d ' ')\"" -DKPF_UNCOMPRESSED_SIZE="\"$$(wc -c < $(RESOURCES_DIR)/checkra1n-kpf-pongo | tr -d ' ')\"" $<
|
$(CXX) -c $(CXXFLAGS) $<
|
||||||
|
|
||||||
$(OBJDIR)/%.c.o: $(GENDIR)/gen-%.c $(wildcard ../include/*.h)
|
palera1n: $(OBJECTS)
|
||||||
$(CC) $(CFLAGS) -c -o $<
|
ifeq ($(GUI),1)
|
||||||
|
$(CXX) $(LDFLAGS) $(OBJECTS) $(CXXOBJECTS) $(LIBS) -o palera1n
|
||||||
$(OBJDIR)/%.c.o: %.c $(wildcard ../include/*.h)
|
else
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o palera1n
|
||||||
|
endif
|
||||||
palera1n: $(OBJS)
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o palera1n
|
|
||||||
ifeq (,$(findstring macosx, $(CFLAGS)))
|
ifeq (,$(findstring macosx, $(CFLAGS)))
|
||||||
ifneq (,$(findstring version-min=, $(CFLAGS)))
|
ifneq (,$(findstring version-min=, $(CFLAGS)))
|
||||||
$(LDID) -Susb.xml palera1n
|
$(LDID) -Susb.xml palera1n
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(RESOURCES_DIR)/libcheckra1nhelper.dylib: chkstk.S
|
libcheckra1nhelper.dylib: chkstk.S
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -shared chkstk.S -o $@
|
$(CC) $(CFLAGS) $(LDFLAGS) -shared chkstk.S -o libcheckra1nhelper.dylib
|
||||||
|
|
||||||
$(RESOURCES_DIR)/checkra1n-kpf-pongo:
|
checkra1n-kpf-pongo:
|
||||||
curl -Lfo $@ https://cdn.nickchan.lol/palera1n/artifacts/kpf/iOS15/checkra1n-kpf-pongo
|
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/checkra1n-kpf-pongo
|
||||||
|
|
||||||
$(RESOURCES_DIR)/ramdisk.dmg.lzma: $(RESOURCES_DIR)/ramdisk.dmg
|
ramdisk.dmg:
|
||||||
xz --format=lzma -vfc6ekT 0 $< > $@
|
curl -LO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/ramdisk.dmg
|
||||||
|
|
||||||
$(RESOURCES_DIR)/checkra1n-kpf-pongo.lzma: $(RESOURCES_DIR)/checkra1n-kpf-pongo
|
binpack.dmg:
|
||||||
xz --format=lzma -vfc6ekT 0 $< > $@
|
curl -LO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg
|
||||||
|
|
||||||
$(RESOURCES_DIR)/ramdisk.dmg:
|
Pongo.bin:
|
||||||
curl -Lfo $@ https://cdn.nickchan.lol/palera1n/c-rewrite/deps/ramdisk.dmg
|
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/Pongo.bin
|
||||||
|
|
||||||
$(RESOURCES_DIR)/binpack.dmg:
|
|
||||||
curl -Lfo $@ https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg
|
|
||||||
|
|
||||||
$(RESOURCES_DIR)/Pongo.bin:
|
|
||||||
curl -Lfo $@ https://cdn.nickchan.lol/palera1n/artifacts/kpf/iOS15/Pongo.bin
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(OBJDIR)/*.o $(GENDIR)/*.c $(GENDIR)/*.o palera1n palera1n.dSYM libcheckra1nhelper.dylib
|
rm -rf *.o palera1n checkra1n checkra1n.c palera1n.dSYM libcheckra1nhelper.dylib
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
rm -rf $(RESOURCES_DIR)/*
|
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
+16
-15
@@ -28,6 +28,8 @@
|
|||||||
#include <libimobiledevice/diagnostics_relay.h>
|
#include <libimobiledevice/diagnostics_relay.h>
|
||||||
#include <plist/plist.h>
|
#include <plist/plist.h>
|
||||||
|
|
||||||
|
#include "lockdown_helper.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIB_TV_CONTROL
|
#ifdef HAVE_LIB_TV_CONTROL
|
||||||
#include <libtvcontrol.h>
|
#include <libtvcontrol.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -102,7 +104,6 @@ int unsubscribe_cmd(void)
|
|||||||
|
|
||||||
int devinfo_cmd(devinfo_t *dev, const char *udid)
|
int devinfo_cmd(devinfo_t *dev, const char *udid)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
uint64_t this_ecid = 0;
|
uint64_t this_ecid = 0;
|
||||||
char *productType = NULL;
|
char *productType = NULL;
|
||||||
char *productVersion = NULL;
|
char *productVersion = NULL;
|
||||||
@@ -111,67 +112,67 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
|
|||||||
char *CPUArchitecture = NULL;
|
char *CPUArchitecture = NULL;
|
||||||
idevice_t device = NULL;
|
idevice_t device = NULL;
|
||||||
lockdownd_client_t lockdown = NULL;
|
lockdownd_client_t lockdown = NULL;
|
||||||
if ((ret = idevice_new_with_options(&device, udid, IDEVICE_LOOKUP_USBMUX)) != IDEVICE_E_SUCCESS)
|
if (idevice_new(&device, udid) != IDEVICE_E_SUCCESS)
|
||||||
{
|
{
|
||||||
LOG(LOG_ERROR, "Error connecting to device: %d (%s)", ret, lockdownd_strerror(ret));
|
LOG(LOG_ERROR, "Error connecting to device.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((ret = lockdownd_client_new_with_handshake(device, &lockdown, "palera1n")) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_client_new(device, &lockdown, "palera1n") != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
(void)idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Device is not in normal mode: %d (%s)", ret, lockdownd_strerror(ret));
|
LOG(LOG_ERROR, "Device is not in normal mode.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
plist_t node = NULL;
|
plist_t node = NULL;
|
||||||
if ((ret = lockdownd_get_value(lockdown, NULL, "UniqueChipID", &node)) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_get_value(lockdown, NULL, "UniqueChipID", &node) != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
(void)lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
(void)idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Error getting ECID: %d (%s)", ret, lockdownd_strerror(ret));
|
LOG(LOG_ERROR, "Error getting ECID");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
plist_get_uint_val(node, &this_ecid);
|
plist_get_uint_val(node, &this_ecid);
|
||||||
plist_free(node);
|
plist_free(node);
|
||||||
|
|
||||||
node = NULL;
|
node = NULL;
|
||||||
if ((ret = lockdownd_get_value(lockdown, NULL, "ProductType", &node)) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_get_value(lockdown, NULL, "ProductType", &node) != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
(void)lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
(void)idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Error getting product type: %d (%s)", ret, lockdownd_strerror(ret));
|
LOG(LOG_ERROR, "Error getting product type");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
plist_get_string_val(node, &productType);
|
plist_get_string_val(node, &productType);
|
||||||
plist_free(node);
|
plist_free(node);
|
||||||
|
|
||||||
node = NULL;
|
node = NULL;
|
||||||
if ((ret = lockdownd_get_value(lockdown, NULL, "CPUArchitecture", &node)) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_get_value(lockdown, NULL, "CPUArchitecture", &node) != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
(void)lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
(void)idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Error getting CPU type: %d (%s)", ret, lockdownd_strerror(ret));
|
LOG(LOG_ERROR, "Error getting CPU type");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
plist_get_string_val(node, &CPUArchitecture);
|
plist_get_string_val(node, &CPUArchitecture);
|
||||||
plist_free(node);
|
plist_free(node);
|
||||||
|
|
||||||
node = NULL;
|
node = NULL;
|
||||||
if ((ret = lockdownd_get_value(lockdown, NULL, "ProductVersion", &node)) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_get_value(lockdown, NULL, "ProductVersion", &node) != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
(void)lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
(void)idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Error getting product version: %d (%s)", ret, lockdownd_strerror(ret));
|
LOG(LOG_ERROR, "Error getting product version");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
plist_get_string_val(node, &productVersion);
|
plist_get_string_val(node, &productVersion);
|
||||||
plist_free(node);
|
plist_free(node);
|
||||||
|
|
||||||
node = NULL;
|
node = NULL;
|
||||||
if ((ret = lockdownd_get_value(lockdown, NULL, "BuildVersion", &node)) != LOCKDOWN_E_SUCCESS)
|
if (lockdownd_get_value(lockdown, NULL, "BuildVersion", &node) != LOCKDOWN_E_SUCCESS)
|
||||||
{
|
{
|
||||||
(void)lockdownd_client_free(lockdown);
|
(void)lockdownd_client_free(lockdown);
|
||||||
(void)idevice_free(device);
|
(void)idevice_free(device);
|
||||||
LOG(LOG_ERROR, "Error getting build version: %d (%s)", ret, lockdownd_strerror(ret));
|
LOG(LOG_ERROR, "Error getting build version");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
plist_get_string_val(node, &buildVersion);
|
plist_get_string_val(node, &buildVersion);
|
||||||
|
|||||||
+21
-27
@@ -37,7 +37,7 @@ int dfuhelper_thr_running = false;
|
|||||||
void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) {
|
void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) {
|
||||||
for (int i = time2; i < time; i++) {
|
for (int i = time2; i < time; i++) {
|
||||||
printf(
|
printf(
|
||||||
(palerain_flags & palerain_option_no_colors)
|
checkrain_options_enabled(host_flags, host_option_no_colors)
|
||||||
? "\r\033[K%s (%d)"
|
? "\r\033[K%s (%d)"
|
||||||
: BCYN "\r\033[K%s (%d)" CRESET, text, time - i + time2
|
: BCYN "\r\033[K%s (%d)" CRESET, text, time - i + time2
|
||||||
);
|
);
|
||||||
@@ -46,7 +46,7 @@ void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond
|
|||||||
if (cond != NULL && cond(cond_arg)) pthread_exit(NULL);
|
if (cond != NULL && cond(cond_arg)) pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
printf(
|
printf(
|
||||||
(palerain_flags & palerain_option_no_colors)
|
checkrain_options_enabled(host_flags, host_option_no_colors)
|
||||||
? "\r%s (%d)"
|
? "\r%s (%d)"
|
||||||
: CYN "\r%s (%d)" CRESET, text, time2
|
: CYN "\r%s (%d)" CRESET, text, time2
|
||||||
);
|
);
|
||||||
@@ -68,7 +68,7 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
|
if (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
|
||||||
if (!(palerain_flags & palerain_option_device_info))
|
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||||
LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled", dev.productType);
|
LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled", dev.productType);
|
||||||
unsigned char passcode_state = 0;
|
unsigned char passcode_state = 0;
|
||||||
ret = passstat_cmd(&passcode_state, usbmuxd_device->udid);
|
ret = passstat_cmd(&passcode_state, usbmuxd_device->udid);
|
||||||
@@ -79,14 +79,14 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
|||||||
}
|
}
|
||||||
if (passcode_state) {
|
if (passcode_state) {
|
||||||
LOG(LOG_ERROR, "Passcode must be disabled on this device");
|
LOG(LOG_ERROR, "Passcode must be disabled on this device");
|
||||||
if (!(palerain_flags & palerain_option_device_info))
|
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+");
|
LOG(LOG_ERROR, "Additionally, passcode must never be set since a restore on iOS 16+");
|
||||||
devinfo_free(&dev);
|
devinfo_free(&dev);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((palerain_flags & palerain_option_device_info)) {
|
if (checkrain_options_enabled(host_flags, host_option_device_info)) {
|
||||||
printf("Mode: normal\n");
|
printf("Mode: normal\n");
|
||||||
printf("ProductType: %s\n", dev.productType);
|
printf("ProductType: %s\n", dev.productType);
|
||||||
printf("Architecture: %s\n", dev.CPUArchitecture);
|
printf("Architecture: %s\n", dev.CPUArchitecture);
|
||||||
@@ -98,16 +98,10 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
|
|||||||
unsubscribe_cmd();
|
unsubscribe_cmd();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (verbose > 1) {
|
LOG(LOG_INFO, "Telling device with udid %s to enter recovery mode immediately", usbmuxd_device->udid);
|
||||||
/* (LOG_VERBOSE - 3) or below*/
|
|
||||||
LOG(LOG_INFO, "Telling device with udid %s to enter recovery mode immediately", usbmuxd_device->udid);
|
|
||||||
} else {
|
|
||||||
/* At least (LOG_VERBOSE2 - 3) */
|
|
||||||
LOG(LOG_INFO, "Entering recovery mode");
|
|
||||||
}
|
|
||||||
enter_recovery_cmd(usbmuxd_device->udid);
|
enter_recovery_cmd(usbmuxd_device->udid);
|
||||||
devinfo_free(&dev);
|
devinfo_free(&dev);
|
||||||
if ((palerain_flags & palerain_option_enter_recovery)) {
|
if (checkrain_options_enabled(host_flags, host_option_enter_recovery)) {
|
||||||
device_has_booted = true;
|
device_has_booted = true;
|
||||||
set_spin(0);
|
set_spin(0);
|
||||||
unsubscribe_cmd();
|
unsubscribe_cmd();
|
||||||
@@ -187,9 +181,9 @@ void device_event_cb(const usbmuxd_event_t *event, void* userdata) {
|
|||||||
switch (event->event) {
|
switch (event->event) {
|
||||||
case UE_DEVICE_ADD:
|
case UE_DEVICE_ADD:
|
||||||
LOG(LOG_VERBOSE, "Normal mode device connected");
|
LOG(LOG_VERBOSE, "Normal mode device connected");
|
||||||
if ((palerain_flags & palerain_option_exit_recovery)) {
|
if (checkrain_options_enabled(host_flags, host_option_exit_recovery)) {
|
||||||
break;
|
break;
|
||||||
} else if ((palerain_flags & palerain_option_reboot_device)) {
|
} else if (checkrain_options_enabled(host_flags, host_option_reboot_device)) {
|
||||||
int ret = reboot_cmd(event->device.udid);
|
int ret = reboot_cmd(event->device.udid);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
LOG(LOG_INFO, "Restarted device");
|
LOG(LOG_INFO, "Restarted device");
|
||||||
@@ -217,9 +211,9 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
|
|||||||
event->mode == IRECV_K_RECOVERY_MODE_2 ||
|
event->mode == IRECV_K_RECOVERY_MODE_2 ||
|
||||||
event->mode == IRECV_K_RECOVERY_MODE_3 ||
|
event->mode == IRECV_K_RECOVERY_MODE_3 ||
|
||||||
event->mode == IRECV_K_RECOVERY_MODE_4) {
|
event->mode == IRECV_K_RECOVERY_MODE_4) {
|
||||||
if (!(palerain_flags & palerain_option_device_info))
|
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||||
LOG(LOG_VERBOSE, "Recovery mode device %" PRIu64 " connected", event->device_info->ecid);
|
LOG(LOG_VERBOSE, "Recovery mode device %ld connected", event->device_info->ecid);
|
||||||
if ((palerain_flags & palerain_option_exit_recovery)) {
|
if (checkrain_options_enabled(host_flags, host_option_exit_recovery)) {
|
||||||
ret = exitrecv_cmd(event->device_info->ecid);
|
ret = exitrecv_cmd(event->device_info->ecid);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
LOG(LOG_INFO, "Exited recovery mode");
|
LOG(LOG_INFO, "Exited recovery mode");
|
||||||
@@ -234,7 +228,7 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((palerain_flags & palerain_option_device_info)) {
|
if (checkrain_options_enabled(host_flags, host_option_device_info)) {
|
||||||
recvinfo_t info;
|
recvinfo_t info;
|
||||||
ret = recvinfo_cmd(&info, event->device_info->ecid);
|
ret = recvinfo_cmd(&info, event->device_info->ecid);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -253,14 +247,14 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((palerain_flags & palerain_option_enter_recovery) ||
|
if (checkrain_options_enabled(host_flags, host_option_enter_recovery) ||
|
||||||
(palerain_flags & palerain_option_reboot_device)) return;
|
checkrain_options_enabled(host_flags, host_option_reboot_device)) return;
|
||||||
pthread_create(&recovery_thread, NULL, (pthread_start_t)connected_recovery_mode, event->device_info);
|
pthread_create(&recovery_thread, NULL, (pthread_start_t)connected_recovery_mode, event->device_info);
|
||||||
} else if (event->mode == IRECV_K_DFU_MODE) {
|
} else if (event->mode == IRECV_K_DFU_MODE) {
|
||||||
if (!(palerain_flags & palerain_option_device_info))
|
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||||
LOG(LOG_VERBOSE, "DFU mode device %" PRIu64 " connected", event->device_info->ecid);
|
LOG(LOG_VERBOSE, "DFU mode device %ld connected", event->device_info->ecid);
|
||||||
|
|
||||||
if ((palerain_flags & palerain_option_device_info)) {
|
if (checkrain_options_enabled(host_flags, host_option_device_info)) {
|
||||||
recvinfo_t info;
|
recvinfo_t info;
|
||||||
ret = recvinfo_cmd(&info, event->device_info->ecid);
|
ret = recvinfo_cmd(&info, event->device_info->ecid);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -280,9 +274,9 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(palerain_flags & palerain_option_exit_recovery) ||
|
checkrain_options_enabled(host_flags, host_option_exit_recovery) ||
|
||||||
(palerain_flags & palerain_option_enter_recovery) ||
|
checkrain_options_enabled(host_flags, host_option_enter_recovery) ||
|
||||||
(palerain_flags & palerain_option_reboot_device)) {
|
checkrain_options_enabled(host_flags, host_option_reboot_device)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pthread_create(&dfu_thread, NULL, (pthread_start_t)connected_dfu_mode, event->device_info);
|
pthread_create(&dfu_thread, NULL, (pthread_start_t)connected_dfu_mode, event->device_info);
|
||||||
|
|||||||
+6
-19
@@ -15,7 +15,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
@@ -43,10 +42,6 @@ int exec_checkra1n(void) {
|
|||||||
#ifndef NO_CUSTOM_PONGO
|
#ifndef NO_CUSTOM_PONGO
|
||||||
if (pongo_path == NULL) {
|
if (pongo_path == NULL) {
|
||||||
pongo_path = malloc(strlen(tmpdir) + 20);
|
pongo_path = malloc(strlen(tmpdir) + 20);
|
||||||
if (pongo_path == NULL) {
|
|
||||||
LOG(LOG_FATAL, "memory allocation failed\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
snprintf(pongo_path, strlen(tmpdir) + 20, "%s/Pongo.bin.XXXXXX", tmpdir);
|
snprintf(pongo_path, strlen(tmpdir) + 20, "%s/Pongo.bin.XXXXXX", tmpdir);
|
||||||
fd_pongo = mkstemp(pongo_path);
|
fd_pongo = mkstemp(pongo_path);
|
||||||
if (fd_pongo == -1) {
|
if (fd_pongo == -1) {
|
||||||
@@ -56,7 +51,7 @@ int exec_checkra1n(void) {
|
|||||||
}
|
}
|
||||||
ssize_t didWrite_Pongo_bin = write(fd_pongo, Pongo_bin, Pongo_bin_len);
|
ssize_t didWrite_Pongo_bin = write(fd_pongo, Pongo_bin, Pongo_bin_len);
|
||||||
if (didWrite_Pongo_bin != (ssize_t)Pongo_bin_len) {
|
if (didWrite_Pongo_bin != (ssize_t)Pongo_bin_len) {
|
||||||
LOG(LOG_FATAL, "Size written to %s does not match expected: %zd != %" PRIu32 ": %d (%s)", pongo_path, didWrite_Pongo_bin, Pongo_bin_len, errno, strerror(errno));
|
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);
|
close(fd_pongo);
|
||||||
unlink(pongo_path);
|
unlink(pongo_path);
|
||||||
free(pongo_path);
|
free(pongo_path);
|
||||||
@@ -66,10 +61,6 @@ int exec_checkra1n(void) {
|
|||||||
} else external_pongo = true;
|
} else external_pongo = true;
|
||||||
#endif
|
#endif
|
||||||
checkra1n_path = malloc(strlen(tmpdir) + 20);
|
checkra1n_path = malloc(strlen(tmpdir) + 20);
|
||||||
if (checkra1n_path == NULL) {
|
|
||||||
LOG(LOG_FATAL, "memory allocation failed\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
snprintf(checkra1n_path, strlen(tmpdir) + 20, "%s/checkra1n.XXXXXX", tmpdir);
|
snprintf(checkra1n_path, strlen(tmpdir) + 20, "%s/checkra1n.XXXXXX", tmpdir);
|
||||||
fd_checkra1n = mkstemp(checkra1n_path);
|
fd_checkra1n = mkstemp(checkra1n_path);
|
||||||
if (fd_checkra1n == -1) {
|
if (fd_checkra1n == -1) {
|
||||||
@@ -80,7 +71,7 @@ int exec_checkra1n(void) {
|
|||||||
}
|
}
|
||||||
ssize_t didWrite_checkra1n = write(fd_checkra1n, checkra1n, checkra1n_len);
|
ssize_t didWrite_checkra1n = write(fd_checkra1n, checkra1n, checkra1n_len);
|
||||||
if (didWrite_checkra1n != (ssize_t)checkra1n_len) {
|
if (didWrite_checkra1n != (ssize_t)checkra1n_len) {
|
||||||
LOG(LOG_FATAL, "Size written to %s does not match expected: %zd != %" PRIu32 ": %d (%s)", checkra1n_path, didWrite_checkra1n, checkra1n_len, errno, strerror(errno));
|
LOG(LOG_FATAL, "Size written to %s does not match expected: %lld != %d: %d (%s)", checkra1n_path, didWrite_checkra1n, checkra1n_len, errno, strerror(errno));
|
||||||
close(fd_checkra1n);
|
close(fd_checkra1n);
|
||||||
unlink(checkra1n_path);
|
unlink(checkra1n_path);
|
||||||
free(checkra1n_path);
|
free(checkra1n_path);
|
||||||
@@ -107,10 +98,6 @@ int exec_checkra1n(void) {
|
|||||||
if (darwinMajor < 20) {
|
if (darwinMajor < 20) {
|
||||||
#endif
|
#endif
|
||||||
libcheckra1nhelper_dylib_path = malloc(strlen(tmpdir) + 40);
|
libcheckra1nhelper_dylib_path = malloc(strlen(tmpdir) + 40);
|
||||||
if (libcheckra1nhelper_dylib_path == NULL) {
|
|
||||||
LOG(LOG_FATAL, "memory allocation failed\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
snprintf(libcheckra1nhelper_dylib_path, strlen(tmpdir) + 40, "%s/libcheckra1nhelper.dylib.XXXXXX", tmpdir);
|
snprintf(libcheckra1nhelper_dylib_path, strlen(tmpdir) + 40, "%s/libcheckra1nhelper.dylib.XXXXXX", tmpdir);
|
||||||
int helper_fd = mkstemp(libcheckra1nhelper_dylib_path);
|
int helper_fd = mkstemp(libcheckra1nhelper_dylib_path);
|
||||||
if (helper_fd == -1) {
|
if (helper_fd == -1) {
|
||||||
@@ -119,7 +106,7 @@ int exec_checkra1n(void) {
|
|||||||
}
|
}
|
||||||
ssize_t didWrite_libcheckra1nhelper = write(helper_fd, libcheckra1nhelper_dylib, libcheckra1nhelper_dylib_len);
|
ssize_t didWrite_libcheckra1nhelper = write(helper_fd, libcheckra1nhelper_dylib, libcheckra1nhelper_dylib_len);
|
||||||
if ((unsigned int)didWrite_libcheckra1nhelper != libcheckra1nhelper_dylib_len) {
|
if ((unsigned int)didWrite_libcheckra1nhelper != libcheckra1nhelper_dylib_len) {
|
||||||
LOG(LOG_FATAL, "Size written does not match expected: %zd != %" PRIu32 ": %d (%s)", didWrite_libcheckra1nhelper, libcheckra1nhelper_dylib_len, errno, strerror(errno));
|
LOG(LOG_FATAL, "Size written does not match expected: %lld != %d: %d (%s)", didWrite_libcheckra1nhelper, libcheckra1nhelper_dylib_len, errno, strerror(errno));
|
||||||
close(helper_fd);
|
close(helper_fd);
|
||||||
unlink(libcheckra1nhelper_dylib_path);
|
unlink(libcheckra1nhelper_dylib_path);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -139,11 +126,11 @@ int exec_checkra1n(void) {
|
|||||||
#endif
|
#endif
|
||||||
checkra1n_exec: {};
|
checkra1n_exec: {};
|
||||||
char args[0x10] = "-E";
|
char args[0x10] = "-E";
|
||||||
if ((palerain_flags & palerain_option_demote)) strncat(args, "d", 0xf);
|
if (checkrain_options_enabled(host_flags, host_option_demote)) strncat(args, "d", 0xf);
|
||||||
if (!(palerain_flags & palerain_option_checkrain_is_clone)) {
|
if (!checkrain_options_enabled(host_flags, palerain_option_checkrain_is_clone)) {
|
||||||
strncat(args, "p", 0xf);
|
strncat(args, "p", 0xf);
|
||||||
if (verbose >= 2) strncat(args, "v", 0xf);
|
if (verbose >= 2) strncat(args, "v", 0xf);
|
||||||
if ((palerain_flags & palerain_option_no_colors)) strncat(args, "n", 0xf);
|
if (checkrain_options_enabled(host_flags, host_option_no_colors)) strncat(args, "n", 0xf);
|
||||||
} else {
|
} else {
|
||||||
strncat(args, "R", 0xf);
|
strncat(args, "R", 0xf);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -1,13 +1,13 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef NO_KPF
|
#ifdef NO_KPF
|
||||||
unsigned char* checkra1n_kpf_pongo_lzma = NULL;
|
unsigned char* checkra1n_kpf_pongo = NULL;
|
||||||
unsigned int checkra1n_kpf_pongo_lzma_len = 0;
|
unsigned int checkra1n_kpf_pongo_len = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NO_RAMDISK
|
#ifdef NO_RAMDISK
|
||||||
unsigned char* ramdisk_dmg_lzma = NULL;
|
unsigned char* ramdisk_dmg = NULL;
|
||||||
unsigned int ramdisk_dmg_lzma_len = 0;
|
unsigned int ramdisk_dmg_len = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NO_CHECKRAIN
|
#ifdef NO_CHECKRAIN
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
*.o
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
.
|
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <gui.h>
|
||||||
|
|
||||||
|
// 50/50 chance this will be removed for in-window alerts
|
||||||
|
#if __APPLE__
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#define IDOK 1
|
||||||
|
#define IDCANCEL 2
|
||||||
|
#define AL kCFUserNotificationNoteAlertLevel
|
||||||
|
#elif _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#include <winuser.h>
|
||||||
|
#elif __linux__
|
||||||
|
// #include <gtk/gtk.h>
|
||||||
|
#elif BSD
|
||||||
|
#elif __ANDROID__
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void send_alert(const char *title, const char *msg) {
|
||||||
|
#if __APPLE__
|
||||||
|
CFStringRef header_ref = CFStringCreateWithCString(NULL, title, strlen(title));
|
||||||
|
CFStringRef message_ref = CFStringCreateWithCString(NULL, msg, strlen(msg));
|
||||||
|
// CFStringRef url_ref = CFStringCreateWithCString( NULL, "", strlen("") );
|
||||||
|
CFURLRef icon_ref = CFURLCreateWithString(kCFAllocatorDefault, NULL, NULL);
|
||||||
|
CFOptionFlags result;
|
||||||
|
|
||||||
|
CFUserNotificationDisplayAlert(0, AL, icon_ref, NULL, NULL, header_ref, message_ref, NULL, NULL, NULL, &result);
|
||||||
|
CFRelease(header_ref);
|
||||||
|
CFRelease(message_ref);
|
||||||
|
#elif _WIN32
|
||||||
|
MessageBox(0, msg, title, MB_OK);
|
||||||
|
#elif __linux__
|
||||||
|
char line[256];
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
fp=popen("zenity --version","r");
|
||||||
|
if (fp==NULL) {
|
||||||
|
perror("Pipe returned a error");
|
||||||
|
} else {
|
||||||
|
while (fgets(line,sizeof(line),fp)) printf("%s",line);
|
||||||
|
pclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *str_msg = (char*)malloc(40+strlen(title)+strlen(msg)+1);
|
||||||
|
sprintf(str_msg, "zenity --info --title '%s' --text '%s'", title, msg);
|
||||||
|
fp=popen(str_msg, "r");
|
||||||
|
|
||||||
|
if (fp==NULL) {
|
||||||
|
perror("Pipe returned a error");
|
||||||
|
} else {
|
||||||
|
printf("Exit code: %i\n",WEXITSTATUS(pclose(fp)));
|
||||||
|
}
|
||||||
|
#elif BSD
|
||||||
|
#elif __ANDROID__
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -0,0 +1,372 @@
|
|||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <hello_imgui/hello_imgui.h>
|
||||||
|
#include <imgui/imgui_internal.h>
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <design.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------- [ Animation Varibles ] ----------------- */
|
||||||
|
|
||||||
|
float btn_w = 0.0f;
|
||||||
|
float btn_h = 0.0f;
|
||||||
|
float btn_x = 0.0f;
|
||||||
|
float btn_y = 0.0f;
|
||||||
|
float box_w = 0.0f;
|
||||||
|
float box_h = 0.0f;
|
||||||
|
float box_x = 0.0f;
|
||||||
|
float box_y = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------- [ UI Init/Reset ] ----------------- */
|
||||||
|
|
||||||
|
void init_colors() {
|
||||||
|
auto &colors = ImGui::GetStyle().Colors;
|
||||||
|
colors[ImGuiCol_WindowBg] = ImVec4{0.21f, 0.23f, 0.31f, 1.0f};
|
||||||
|
colors[ImGuiCol_MenuBarBg] = ImVec4{0.16f, 0.16f, 0.21f, 1.0f};
|
||||||
|
|
||||||
|
// Border
|
||||||
|
colors[ImGuiCol_Border] = ImVec4{0.44f, 0.37f, 0.61f, 0.0f};
|
||||||
|
colors[ImGuiCol_BorderShadow] = ImVec4{0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
|
|
||||||
|
// Text
|
||||||
|
colors[ImGuiCol_Text] = ImVec4{1.0f, 1.0f, 1.0f, 1.0f};
|
||||||
|
colors[ImGuiCol_TextDisabled] = ImVec4{0.5f, 0.5f, 0.5f, 1.0f};
|
||||||
|
|
||||||
|
// Headers
|
||||||
|
colors[ImGuiCol_Header] = ImVec4{0.13f, 0.13f, 0.17, 1.0f};
|
||||||
|
colors[ImGuiCol_HeaderHovered] = ImVec4{0.19f, 0.2f, 0.25f, 1.0f};
|
||||||
|
colors[ImGuiCol_HeaderActive] = ImVec4{0.16f, 0.16f, 0.21f, 1.0f};
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
colors[ImGuiCol_Button] = ImVec4{0.9f, 0.9f, 0.9f, 1.0f};
|
||||||
|
colors[ImGuiCol_ButtonHovered] = ImVec4{0.9f, 0.9f, 0.9f, 1.0f};
|
||||||
|
colors[ImGuiCol_ButtonActive] = ImVec4{0.9f, 0.9f, 0.9f, 1.0f};
|
||||||
|
colors[ImGuiCol_CheckMark] = ImVec4{0.9f, 0.9f, 0.9f, 1.0f};
|
||||||
|
|
||||||
|
// Popups
|
||||||
|
colors[ImGuiCol_PopupBg] = ImVec4{0.1f, 0.1f, 0.13f, 0.92f};
|
||||||
|
|
||||||
|
// Slider
|
||||||
|
colors[ImGuiCol_SliderGrab] = ImVec4{0.44f, 0.37f, 0.61f, 0.54f};
|
||||||
|
colors[ImGuiCol_SliderGrabActive] = ImVec4{0.74f, 0.58f, 0.98f, 0.54f};
|
||||||
|
|
||||||
|
// Frame BG
|
||||||
|
colors[ImGuiCol_FrameBg] = ImVec4{0.13f, 0.13f, 0.15f, 0.7f};
|
||||||
|
colors[ImGuiCol_FrameBgHovered] = ImVec4{0.13f, 0.13f, 0.15f, 0.7f};
|
||||||
|
colors[ImGuiCol_FrameBgActive] = ImVec4{0.13f, 0.13f, 0.15f, 0.7f};
|
||||||
|
|
||||||
|
// Tabs
|
||||||
|
colors[ImGuiCol_Tab] = ImVec4{0.16f, 0.16f, 0.21f, 1.0f};
|
||||||
|
colors[ImGuiCol_TabHovered] = ImVec4{0.24, 0.24f, 0.32f, 1.0f};
|
||||||
|
colors[ImGuiCol_TabActive] = ImVec4{0.2f, 0.22f, 0.27f, 1.0f};
|
||||||
|
colors[ImGuiCol_TabUnfocused] = ImVec4{0.16f, 0.16f, 0.21f, 1.0f};
|
||||||
|
colors[ImGuiCol_TabUnfocusedActive] = ImVec4{0.16f, 0.16f, 0.21f, 1.0f};
|
||||||
|
|
||||||
|
// Title
|
||||||
|
colors[ImGuiCol_TitleBg] = ImVec4{0.16f, 0.16f, 0.21f, 1.0f};
|
||||||
|
colors[ImGuiCol_TitleBgActive] = ImVec4{0.16f, 0.16f, 0.21f, 1.0f};
|
||||||
|
colors[ImGuiCol_TitleBgCollapsed] = ImVec4{0.16f, 0.16f, 0.21f, 1.0f};
|
||||||
|
|
||||||
|
// Scrollbar
|
||||||
|
colors[ImGuiCol_ScrollbarBg] = ImVec4{0.1f, 0.1f, 0.13f, 1.0f};
|
||||||
|
colors[ImGuiCol_ScrollbarGrab] = ImVec4{0.16f, 0.16f, 0.21f, 1.0f};
|
||||||
|
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4{0.19f, 0.2f, 0.25f, 1.0f};
|
||||||
|
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4{0.24f, 0.24f, 0.32f, 1.0f};
|
||||||
|
|
||||||
|
// Seperator
|
||||||
|
colors[ImGuiCol_Separator] = ImVec4{0.44f, 0.37f, 0.61f, 1.0f};
|
||||||
|
colors[ImGuiCol_SeparatorHovered] = ImVec4{0.74f, 0.58f, 0.98f, 1.0f};
|
||||||
|
colors[ImGuiCol_SeparatorActive] = ImVec4{0.84f, 0.58f, 1.0f, 1.0f};
|
||||||
|
|
||||||
|
// Resize Grip
|
||||||
|
colors[ImGuiCol_ResizeGrip] = ImVec4{0.44f, 0.37f, 0.61f, 0.29f};
|
||||||
|
colors[ImGuiCol_ResizeGripHovered] = ImVec4{0.74f, 0.58f, 0.98f, 0.29f};
|
||||||
|
colors[ImGuiCol_ResizeGripActive] = ImVec4{0.84f, 0.58f, 1.0f, 0.29f};
|
||||||
|
|
||||||
|
// Docking
|
||||||
|
colors[ImGuiCol_DockingPreview] = ImVec4{0.44f, 0.37f, 0.61f, 1.0f};
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_style() {
|
||||||
|
auto &style = ImGui::GetStyle();
|
||||||
|
style.TabRounding = 0;
|
||||||
|
style.ScrollbarRounding = 0;
|
||||||
|
style.WindowRounding = 0;
|
||||||
|
style.GrabRounding = 0;
|
||||||
|
style.FrameRounding = 20;
|
||||||
|
style.PopupRounding = 0;
|
||||||
|
style.ChildRounding = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_design() {
|
||||||
|
ImGui::SetCursorPos(ImVec2(0, 0));
|
||||||
|
init_colors();
|
||||||
|
init_style();
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_views() {
|
||||||
|
waiting_for_device = false;
|
||||||
|
unsupported_device = false;
|
||||||
|
supported_device = false;
|
||||||
|
recovery_wait = false;
|
||||||
|
jailbreak = false;
|
||||||
|
enter_dfu = false;
|
||||||
|
dfu_helper = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------- [ UI Element Styles ] ----------------- */
|
||||||
|
|
||||||
|
void image_btn_style() {
|
||||||
|
auto &colors = ImGui::GetStyle().Colors;
|
||||||
|
colors[ImGuiCol_Button] = ImVec4{1.0f, 1.0f, 1.0f, 1.0f};
|
||||||
|
colors[ImGuiCol_ButtonHovered] = ImVec4{0.95f, 0.95f, 0.95f, 1.0f};
|
||||||
|
colors[ImGuiCol_ButtonActive] = ImVec4{0.95f, 0.95f, 0.95f, 1.0f};
|
||||||
|
colors[ImGuiCol_CheckMark] = ImVec4{0.95f, 0.95f, 0.95f, 1.0f};
|
||||||
|
colors[ImGuiCol_Text] = ImVec4{0.1f, 0.1f, 0.1f, 1.0f};
|
||||||
|
}
|
||||||
|
|
||||||
|
void image_btn_style_alt() {
|
||||||
|
auto &colors = ImGui::GetStyle().Colors;
|
||||||
|
colors[ImGuiCol_Button] = ImVec4{0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
|
colors[ImGuiCol_ButtonHovered] = ImVec4{0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
|
colors[ImGuiCol_ButtonActive] = ImVec4{0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
|
colors[ImGuiCol_CheckMark] = ImVec4{0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
|
colors[ImGuiCol_Text] = ImVec4{0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------- [ IDK Anymore ] ----------------- */
|
||||||
|
|
||||||
|
std::string addstr2(const char *str1, const char *str2) {
|
||||||
|
size_t str1_len = strlen(str1);
|
||||||
|
size_t str2_len = strlen(str2);
|
||||||
|
int buf_size = (int)str1_len + (int)str2_len + 1;
|
||||||
|
char buffer[buf_size];
|
||||||
|
sprintf(buffer, str1, str2);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string addstr3(const char *str1, const char *str2, const char *str3) {
|
||||||
|
size_t str1_len = strlen(str1);
|
||||||
|
size_t str2_len = strlen(str2);
|
||||||
|
size_t str3_len = strlen(str3);
|
||||||
|
int buf_size = (int)str1_len + (int)str2_len + (int)str3_len + 1;
|
||||||
|
char buffer[buf_size];
|
||||||
|
sprintf(buffer, str1, str2, str3);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string addstr4(const char *str1, const char *str2, const char *str3, const char *str4) {
|
||||||
|
size_t str1_len = strlen(str1);
|
||||||
|
size_t str2_len = strlen(str2);
|
||||||
|
size_t str3_len = strlen(str3);
|
||||||
|
size_t str4_len = strlen(str4);
|
||||||
|
int buf_size = (int)str1_len + (int)str2_len + (int)str3_len + (int)str4_len + 1;
|
||||||
|
char buffer[buf_size];
|
||||||
|
sprintf(buffer, str1, str2, str3, str4);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------- [ UI Colors ] ----------------- */
|
||||||
|
|
||||||
|
ImVec4 hex_color(int hex, float alpha) {
|
||||||
|
float r = ((hex >> 16) & 0xFF) / 255.0f;
|
||||||
|
float g = ((hex >> 8) & 0xFF) / 255.0f;
|
||||||
|
float b = ((hex) & 0xFF) / 255.0f;
|
||||||
|
|
||||||
|
return ImVec4{r, g, b, alpha};
|
||||||
|
}
|
||||||
|
|
||||||
|
ImColor hex_imcolor(int hex, float alpha) {
|
||||||
|
float r = ((hex >> 16) & 0xFF) / 255.0f;
|
||||||
|
float g = ((hex >> 8) & 0xFF) / 255.0f;
|
||||||
|
float b = ((hex) & 0xFF) / 255.0f;
|
||||||
|
|
||||||
|
return ImColor{r, g, b, alpha};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------- [ UI Element States ] ----------------- */
|
||||||
|
|
||||||
|
bool is_hovered(const char* id, int w, int h) {
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
|
ImGuiID btn_id = window->GetID(id);
|
||||||
|
const ImRect bb(window->DC.CursorPos, ImVec2(window->DC.CursorPos.x + w, window->DC.CursorPos.x + h));
|
||||||
|
bool hovered = false;
|
||||||
|
ImGui::ButtonBehavior(bb,btn_id,&hovered,NULL);
|
||||||
|
return hovered;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_pressed(const char* id, int w, int h) {
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
|
ImGuiID btn_id = window->GetID(id);
|
||||||
|
const ImRect bb(window->DC.CursorPos, ImVec2(window->DC.CursorPos.x + w, window->DC.CursorPos.x + h));
|
||||||
|
bool pressed = false;
|
||||||
|
ImGui::ButtonBehavior(bb,btn_id,NULL,&pressed);
|
||||||
|
return pressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------- [ Common UI Types ] ----------------- */
|
||||||
|
|
||||||
|
void label(const char *text, ImVec2 location, ImVec4 color, int font) {
|
||||||
|
auto &style = ImGui::GetStyle();
|
||||||
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
|
|
||||||
|
ImGui::SetCursorPos(location);
|
||||||
|
ImGui::PushFont(io.Fonts->Fonts[font]);
|
||||||
|
|
||||||
|
auto &colors = ImGui::GetStyle().Colors;
|
||||||
|
colors[ImGuiCol_Text] = color;
|
||||||
|
|
||||||
|
|
||||||
|
ImGui::Text(text);
|
||||||
|
ImGui::PopFont();
|
||||||
|
reset_design();
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw_box(ImVec2 location, ImVec2 size, ImVec4 color, float radius) {
|
||||||
|
auto &colors = ImGui::GetStyle().Colors;
|
||||||
|
auto &style = ImGui::GetStyle();
|
||||||
|
|
||||||
|
float temp_rounding = style.FrameRounding;
|
||||||
|
ImVec4 temp_color_idle = colors[ImGuiCol_FrameBg];
|
||||||
|
ImVec4 temp_color_hover = colors[ImGuiCol_FrameBgHovered];
|
||||||
|
ImVec4 temp_color_active = colors[ImGuiCol_FrameBgActive];
|
||||||
|
|
||||||
|
style.FrameRounding = radius;
|
||||||
|
colors[ImGuiCol_FrameBg] = color;
|
||||||
|
colors[ImGuiCol_FrameBgHovered] = color;
|
||||||
|
colors[ImGuiCol_FrameBgActive] = color;
|
||||||
|
|
||||||
|
ImGui::SetCursorPos(location);
|
||||||
|
ImGui::ProgressBar(0.0f, size, "");
|
||||||
|
|
||||||
|
style.FrameRounding = temp_rounding;
|
||||||
|
colors[ImGuiCol_FrameBg] = temp_color_idle;
|
||||||
|
colors[ImGuiCol_FrameBgHovered] = temp_color_hover;
|
||||||
|
colors[ImGuiCol_FrameBgActive] = temp_color_active;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------- [ Animation Systems ] ----------------- */
|
||||||
|
|
||||||
|
void anim_btn(const char* id, ImVec2 size, ImVec2 size_to, ImVec2 pos, ImVec2 pos_to) {
|
||||||
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
|
float global = 25.0f;
|
||||||
|
bool new_w_positive,new_h_positive,new_x_positive,new_y_positive = false;
|
||||||
|
float new_w,new_h,new_x,new_y = 0.0f;
|
||||||
|
float lrg_size,lrg_pos,lrg = 0.0f;
|
||||||
|
|
||||||
|
if (size.x > size_to.x) {new_w = size.x - size_to.x; new_w_positive = false;}
|
||||||
|
else {new_w = size_to.x - size.x; new_w_positive = true;}
|
||||||
|
if (size.y > size_to.y) {new_h = size.y - size_to.y; new_h_positive = false;}
|
||||||
|
else {new_h = size_to.y - size.y;new_h_positive = true;}
|
||||||
|
if (pos.x > pos_to.x) {new_x = pos.x - pos_to.x; new_x_positive = false;}
|
||||||
|
else {new_x = pos_to.x - pos.x;new_x_positive = true;}
|
||||||
|
if (pos.y > pos_to.y) {new_y = pos.y - pos_to.y; new_y_positive = false;}
|
||||||
|
else {new_y = pos_to.y - pos.y;new_y_positive = true;}
|
||||||
|
|
||||||
|
if (new_w > new_h) lrg_size = new_w;
|
||||||
|
else lrg_size = new_h;
|
||||||
|
if (new_x > new_y) lrg_pos = new_x;
|
||||||
|
else lrg_pos = new_y;
|
||||||
|
if (lrg_size > lrg_pos) lrg = lrg_size;
|
||||||
|
else lrg = lrg_pos;
|
||||||
|
|
||||||
|
if (new_w_positive) {if (btn_w < size_to.x) btn_w += (new_w / lrg) * global * io.DeltaTime;}
|
||||||
|
else {if (btn_w > size_to.x) btn_w -= (new_w / lrg) * global * io.DeltaTime;}
|
||||||
|
if (new_h_positive) {if (btn_h < size_to.y) btn_h += (new_h / lrg) * global * io.DeltaTime;}
|
||||||
|
else {if (btn_h > size_to.y) btn_h -= (new_h / lrg) * global * io.DeltaTime;}
|
||||||
|
if (new_x_positive) {if (btn_x < pos_to.x) btn_x += (new_x / lrg) * global * io.DeltaTime;}
|
||||||
|
else {if (btn_x > pos_to.x) btn_x -= (new_x / lrg) * global * io.DeltaTime;}
|
||||||
|
if (new_y_positive) {if (btn_y < pos_to.y) btn_y += (new_y / lrg) * global * io.DeltaTime;}
|
||||||
|
else {if (btn_y > pos_to.y) btn_y -= (new_y / lrg) * global * io.DeltaTime;}
|
||||||
|
}
|
||||||
|
|
||||||
|
void anim_box(const char* id, ImVec2 size, ImVec2 size_to, ImVec2 pos, ImVec2 pos_to) {
|
||||||
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
|
float global = 500.0f;
|
||||||
|
bool new_w_positive,new_h_positive,new_x_positive,new_y_positive = false;
|
||||||
|
float new_w,new_h,new_x,new_y = 0.0f;
|
||||||
|
float lrg_size,lrg_pos,lrg = 0.0f;
|
||||||
|
|
||||||
|
if (size.x > size_to.x) {new_w = size.x - size_to.x; new_w_positive = false;}
|
||||||
|
else {new_w = size_to.x - size.x; new_w_positive = true;}
|
||||||
|
if (size.y > size_to.y) {new_h = size.y - size_to.y; new_h_positive = false;}
|
||||||
|
else {new_h = size_to.y - size.y;new_h_positive = true;}
|
||||||
|
if (pos.x > pos_to.x) {new_x = pos.x - pos_to.x; new_x_positive = false;}
|
||||||
|
else {new_x = pos_to.x - pos.x;new_x_positive = true;}
|
||||||
|
if (pos.y > pos_to.y) {new_y = pos.y - pos_to.y; new_y_positive = false;}
|
||||||
|
else {new_y = pos_to.y - pos.y;new_y_positive = true;}
|
||||||
|
|
||||||
|
if (new_w > new_h) lrg_size = new_w;
|
||||||
|
else lrg_size = new_h;
|
||||||
|
if (new_x > new_y) lrg_pos = new_x;
|
||||||
|
else lrg_pos = new_y;
|
||||||
|
if (lrg_size > lrg_pos) lrg = lrg_size;
|
||||||
|
else lrg = lrg_pos;
|
||||||
|
|
||||||
|
if (new_w_positive) {if (box_w < size_to.x) box_w += (new_w / lrg) * global * io.DeltaTime;}
|
||||||
|
else {if (box_w > size_to.x) box_w -= (new_w / lrg) * global * io.DeltaTime;}
|
||||||
|
if (new_h_positive) {if (box_h < size_to.y) box_h += (new_h / lrg) * global * io.DeltaTime;}
|
||||||
|
else {if (box_h > size_to.y) box_h -= (new_h / lrg) * global * io.DeltaTime;}
|
||||||
|
if (new_x_positive) {if (box_x < pos_to.x) box_x += (new_x / lrg) * global * io.DeltaTime;}
|
||||||
|
else {if (box_x > pos_to.x) box_x -= (new_x / lrg) * global * io.DeltaTime;}
|
||||||
|
if (new_y_positive) {if (box_y < pos_to.y) box_y += (new_y / lrg) * global * io.DeltaTime;}
|
||||||
|
else {if (box_y > pos_to.y) box_y -= (new_y / lrg) * global * io.DeltaTime;}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline ImVec2 operator+(const ImVec2 &lhs, const ImVec2 &rhs) {
|
||||||
|
return ImVec2(lhs.x + rhs.x, lhs.y + rhs.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageRotated(ImTextureID tex_id, ImVec2 center, ImVec2 size, float angle) {
|
||||||
|
ImDrawList *draw_list = ImGui::GetWindowDrawList();
|
||||||
|
float cos_a = cosf(angle);
|
||||||
|
float sin_a = sinf(angle);
|
||||||
|
|
||||||
|
ImVec2 pos[4] = {
|
||||||
|
center + ImRotate(ImVec2(-size.x * 0.5f, -size.y * 0.5f), cos_a, sin_a),
|
||||||
|
center + ImRotate(ImVec2(+size.x * 0.5f, -size.y * 0.5f), cos_a, sin_a),
|
||||||
|
center + ImRotate(ImVec2(+size.x * 0.5f, +size.y * 0.5f), cos_a, sin_a),
|
||||||
|
center + ImRotate(ImVec2(-size.x * 0.5f, +size.y * 0.5f), cos_a, sin_a)};
|
||||||
|
|
||||||
|
ImVec2 uvs[4] = {
|
||||||
|
ImVec2(0.0f, 0.0f),
|
||||||
|
ImVec2(1.0f, 0.0f),
|
||||||
|
ImVec2(1.0f, 1.0f),
|
||||||
|
ImVec2(0.0f, 1.0f)};
|
||||||
|
|
||||||
|
draw_list->AddImageQuad(tex_id, pos[0], pos[1], pos[2], pos[3], uvs[0], uvs[1], uvs[2], uvs[3], IM_COL32_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rotate_image(const char *image, ImVec2 pos, ImVec2 size, float angle, float speed) {
|
||||||
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
|
ImTextureID image_texture = HelloImGui::ImTextureIdFromAsset(image);
|
||||||
|
|
||||||
|
static float image_angle = angle;
|
||||||
|
image_angle += io.DeltaTime * speed;
|
||||||
|
ImVec2 image_center = ImVec2(pos.x, pos.y);
|
||||||
|
|
||||||
|
ImGui::SetCursorPos(pos);
|
||||||
|
ImageRotated(image_texture, image_center, size, image_angle);
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include <libimobiledevice/libimobiledevice.h>
|
||||||
|
#include <libimobiledevice/lockdown.h>
|
||||||
|
#include <libimobiledevice/diagnostics_relay.h>
|
||||||
|
#include <plist/plist.h>
|
||||||
|
#include <libirecovery.h>
|
||||||
|
#include <usbmuxd.h>
|
||||||
|
#include <common.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include <palerain.h>
|
||||||
|
#include <gui.h>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
This will all be removed and merged
|
||||||
|
into devhelper.c and dfuhelper.c
|
||||||
|
later on, so for now it stays ig
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
irecv_device_event_context_t irecvctx_gui = NULL;
|
||||||
|
usbmuxd_subscription_context_t usbmuxdctx_gui = NULL;
|
||||||
|
int device_status = DISCONNECTED;
|
||||||
|
devinfo_t dev;
|
||||||
|
char const *udid_gui;
|
||||||
|
|
||||||
|
int connected_normal_mode_gui(const usbmuxd_device_info_t *usbmuxd_device) {
|
||||||
|
int ret;
|
||||||
|
ret = devinfo_cmd(&dev, usbmuxd_device->udid);
|
||||||
|
if (ret != 0) {
|
||||||
|
LOG(LOG_ERROR, "Unable to get device information");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
udid_gui = usbmuxd_device->udid;
|
||||||
|
device_status = NORMAL;
|
||||||
|
if (strcmp(dev.CPUArchitecture, "arm64")) {
|
||||||
|
LOG(LOG_WARNING, "Ignoring non-arm64 device...");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
|
||||||
|
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);
|
||||||
|
if (ret != 0) {
|
||||||
|
LOG(LOG_ERROR, "Failed to get passcode state");
|
||||||
|
devinfo_free(&dev);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (passcode_state) {
|
||||||
|
LOG(LOG_ERROR, "Passcode must be disabled on this device");
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void device_event_cb_gui(const usbmuxd_event_t *event, void* userdata) {
|
||||||
|
if (event->device.conn_type != CONNECTION_TYPE_USB) return;
|
||||||
|
switch (event->event) {
|
||||||
|
case UE_DEVICE_ADD:
|
||||||
|
fprintf(stderr, "Normal mode device connected\n");
|
||||||
|
connected_normal_mode_gui(&event->device);
|
||||||
|
break;
|
||||||
|
case UE_DEVICE_REMOVE:
|
||||||
|
fprintf(stderr, "Normal mode device disconnected\n");
|
||||||
|
device_status = DISCONNECTED;
|
||||||
|
devinfo_free(&dev);
|
||||||
|
if (supported_device || unsupported_device) {
|
||||||
|
supported_device = false;
|
||||||
|
unsupported_device = false;
|
||||||
|
waiting_for_device = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void irecv_device_event_cb_gui(const irecv_device_event_t *event, void* userdata) {
|
||||||
|
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) {
|
||||||
|
fprintf(stderr, "Recovery mode device %llu connected\n", event->device_info->ecid);
|
||||||
|
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_status = RECOVERY;
|
||||||
|
|
||||||
|
if (waiting_for_device) {
|
||||||
|
device_status = RECOVERY;
|
||||||
|
exitrecv_cmd(event->device_info->ecid);
|
||||||
|
send_alert("Device in Recovery", "Exiting recovery, device must start from normal mode.");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (event->mode == IRECV_K_DFU_MODE) {
|
||||||
|
device_status == DFU;
|
||||||
|
fprintf(stderr, "DFU mode device %llu connected\n", event->device_info->ecid);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IRECV_DEVICE_REMOVE:
|
||||||
|
fprintf(stderr, "Recovery mode device disconnected\n");
|
||||||
|
device_status = DISCONNECTED;
|
||||||
|
if (enter_dfu) {
|
||||||
|
device_status = DISCONNECTED;
|
||||||
|
enter_dfu = false;
|
||||||
|
waiting_for_device = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dfuhelper() {
|
||||||
|
subscribe_cmd(device_event_cb_gui, irecv_device_event_cb_gui);
|
||||||
|
}
|
||||||
|
|
||||||
|
void guifree() {
|
||||||
|
devinfo_free(&dev);
|
||||||
|
unsubscribe_cmd();
|
||||||
|
}
|
||||||
@@ -0,0 +1,350 @@
|
|||||||
|
#include <thread>
|
||||||
|
#include <iostream>
|
||||||
|
#include <math.h>
|
||||||
|
#include<unistd.h>
|
||||||
|
|
||||||
|
#include <imgui/imgui_internal.h>
|
||||||
|
#include <hello_imgui/hello_imgui.h>
|
||||||
|
#include <hello_imgui/app_window_params.h>
|
||||||
|
|
||||||
|
#include <design.h>
|
||||||
|
#include <common.h>
|
||||||
|
extern "C" {
|
||||||
|
#include <gui.h>
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bools for which view to show */
|
||||||
|
bool waiting_for_device = true;
|
||||||
|
bool unsupported_device = false;
|
||||||
|
bool supported_device = false;
|
||||||
|
bool recovery_wait = false;
|
||||||
|
bool jailbreak = false;
|
||||||
|
bool enter_dfu = false;
|
||||||
|
bool dfu_helper = false;
|
||||||
|
bool settings = false;
|
||||||
|
bool execjb = false;
|
||||||
|
|
||||||
|
uint64_t ms() {
|
||||||
|
using namespace std::chrono;
|
||||||
|
return duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------- [ Main Function ] ----------------- */
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
if (argc >= 2) {
|
||||||
|
// temp for testing
|
||||||
|
return palera1n(argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
dfuhelper();
|
||||||
|
|
||||||
|
/* Vars for DFU Healper */
|
||||||
|
int dfu_step1 = 3;
|
||||||
|
int dfu_step2 = 5;
|
||||||
|
int dfu_step3 = 10;
|
||||||
|
bool dfu_done = false;
|
||||||
|
bool set_ms = true;
|
||||||
|
auto desired = ms() + 1000;
|
||||||
|
|
||||||
|
/* HelloImGui Stuff */
|
||||||
|
HelloImGui::RunnerParams params;
|
||||||
|
params.fpsIdling.fpsIdle = 60.f;
|
||||||
|
params.appWindowParams.borderless = false;
|
||||||
|
params.appWindowParams.resizable = false;
|
||||||
|
params.appWindowParams.windowGeometry.size = {550, 300};
|
||||||
|
params.appWindowParams.windowTitle = "palera1n";
|
||||||
|
params.appWindowParams.restorePreviousGeometry = false;
|
||||||
|
params.imGuiWindowParams.defaultImGuiWindowType = HelloImGui::DefaultImGuiWindowType::NoDefaultWindow;
|
||||||
|
|
||||||
|
/* Color & Size Stuff */
|
||||||
|
bool open = true;
|
||||||
|
ImColor grad_color_left = ImColor(255, 177, 35);
|
||||||
|
ImColor grad_color_right = ImColor(4, 121, 168);
|
||||||
|
|
||||||
|
int grad_color_left_r = 255;
|
||||||
|
float text_alpha = 0.0f;
|
||||||
|
bool reverse_gradient = false;
|
||||||
|
|
||||||
|
|
||||||
|
/* ImGui Loop */
|
||||||
|
params.callbacks.ShowGui = [&]() {
|
||||||
|
{
|
||||||
|
/* Init colors, style, and fonts */
|
||||||
|
auto &colors = ImGui::GetStyle().Colors;
|
||||||
|
auto &style = ImGui::GetStyle();
|
||||||
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
|
init_colors();
|
||||||
|
init_style();
|
||||||
|
|
||||||
|
/* Init window size and start ImGui */
|
||||||
|
ImGui::SetNextWindowSize(ImVec2(560, 300));
|
||||||
|
ImGui::SetNextWindowPos(ImVec2(-5, 0));
|
||||||
|
ImGui::Begin("palera1n", &open, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar);
|
||||||
|
|
||||||
|
/* Set our background gradient */
|
||||||
|
ImGui::SetCursorPos(ImVec2(0, 0));
|
||||||
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
|
if (!reverse_gradient) grad_color_left_r -= FLOAT_TO_INT(io.DeltaTime * 100.f) /2;
|
||||||
|
else grad_color_left_r += FLOAT_TO_INT(io.DeltaTime * 100.f) /2;
|
||||||
|
if (grad_color_left_r <= 140) reverse_gradient = true;
|
||||||
|
if (grad_color_left_r >= 255) reverse_gradient = false;
|
||||||
|
grad_color_left = ImColor(135, 63, grad_color_left_r) ;
|
||||||
|
grad_color_right = ImColor(4, 160, grad_color_left_r) ;
|
||||||
|
|
||||||
|
auto dl(ImGui::GetWindowDrawList());
|
||||||
|
dl->AddRectFilledMultiColor(ImVec2(0, 0), // pos - x y
|
||||||
|
ImVec2(560, 300), // size - width height
|
||||||
|
grad_color_left, // color top left
|
||||||
|
hex_imcolor(0x2390b4, 1.0f), // color
|
||||||
|
hex_imcolor(0x04c2a8, 1.0f), // color
|
||||||
|
grad_color_right); // color
|
||||||
|
|
||||||
|
|
||||||
|
if (!recovery_wait && !dfu_helper && !jailbreak) {
|
||||||
|
ImTextureID settings_icon = HelloImGui::ImTextureIdFromAsset("s60.png"); // pngs will be embedded soon
|
||||||
|
ImTextureID about_icon = HelloImGui::ImTextureIdFromAsset("i60.png"); // pngs will be embedded soon
|
||||||
|
image_btn_style_alt();
|
||||||
|
ImGui::SetCursorPos(ImVec2(455, 245));
|
||||||
|
ImGui::ImageButton(about_icon, ImVec2(33.0f, 33.0f));
|
||||||
|
ImGui::SetCursorPos(ImVec2(500, 245));
|
||||||
|
ImGui::ImageButton(settings_icon, ImVec2(33.0f, 33.0f));
|
||||||
|
reset_design();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Waiting for device view */
|
||||||
|
if (waiting_for_device) {
|
||||||
|
if (device_status == NORMAL) {
|
||||||
|
const char *name = dev.displayName;
|
||||||
|
char *arch = dev.CPUArchitecture;
|
||||||
|
char *type = dev.productType;
|
||||||
|
char *version = dev.productVersion;
|
||||||
|
if (strcmp("arm64", arch) != 0) {
|
||||||
|
waiting_for_device = false;
|
||||||
|
unsupported_device = true;
|
||||||
|
btn_x = 213.0f;
|
||||||
|
btn_y = 190.0f;
|
||||||
|
btn_w = 125.0f;
|
||||||
|
btn_h = 35.0f;
|
||||||
|
} else if (strstr(version, "15") != 0 || strstr(version, "16") != 0) {
|
||||||
|
waiting_for_device = false;
|
||||||
|
supported_device = true;
|
||||||
|
btn_x = 213.0f;
|
||||||
|
btn_y = 190.0f;
|
||||||
|
btn_w = 125.0f;
|
||||||
|
btn_h = 35.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
box_x = 55.0f; box_y = 75.0f; box_w = 450.0f; box_h = 150.0f;
|
||||||
|
|
||||||
|
draw_box(pos(55, 75), size(450, 150), hex_color(0x000000, 0.25f), 20.0f); // box in center
|
||||||
|
rotate_image("spinner.png", pos(95, 150), size(40, 40), 0.0f, 4.0f); // loading anim in box
|
||||||
|
label("Waiting for connection...", pos(135,122), WHITE, SF_BoldLarge); // Large title
|
||||||
|
label("Connect your device in normal mode to get started!", pos(138, 157), WHITE, SF_Reg); // Sub title
|
||||||
|
|
||||||
|
|
||||||
|
/* Unsupported device view */
|
||||||
|
} else if (unsupported_device) {
|
||||||
|
|
||||||
|
anim_box("Jailbreak", ImVec2(450,150),ImVec2(300,200),ImVec2(54,75),ImVec2(129,50));
|
||||||
|
draw_box(ImVec2(box_x, box_y),ImVec2(box_w, box_h), hex_color(0x000000, 0.25f), 20.0f);
|
||||||
|
|
||||||
|
set_pos(167, 90); font(SF_Bold);
|
||||||
|
ImGui::Text("%s", dev.displayName);
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
set_pos(167, 120); font(SF_RegMed);
|
||||||
|
ImGui::Text("%s running iOS %s (%s)", dev.productType, dev.productVersion, dev.CPUArchitecture);
|
||||||
|
|
||||||
|
colors[ImGuiCol_Text] = hex_color(0xEB5160, 1.0f);
|
||||||
|
set_pos(167, 147); ImGui::Text(ICON_FA_BAN);
|
||||||
|
colors[ImGuiCol_Text] = hex_color(0xFFFFFF, 1.0f);
|
||||||
|
|
||||||
|
ImGui::SameLine(); ImGui::Text("Unsupported device connected");
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
set_pos(213, 190); font(SF_RoundBold); btn_text_on;
|
||||||
|
bool hovered = is_hovered("Exit", 125, 35);
|
||||||
|
bool pressed = is_pressed("Exit", 125, 35);
|
||||||
|
ImVec2 btn_size = ImVec2(120, 30);
|
||||||
|
|
||||||
|
if (hovered) {
|
||||||
|
anim_btn("Exit", ImVec2(125,35),ImVec2(127,37),ImVec2(213,190),ImVec2(212,189));
|
||||||
|
btn_size = ImVec2(btn_w, btn_h);
|
||||||
|
ImGui::SetCursorPos(ImVec2(btn_x,btn_y));
|
||||||
|
} else {
|
||||||
|
anim_btn("Exit", ImVec2(127,37),ImVec2(125,35),ImVec2(212,189),ImVec2(213,190));
|
||||||
|
btn_size = ImVec2(btn_w, btn_h);
|
||||||
|
ImGui::SetCursorPos(ImVec2(btn_x,btn_y));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Button("Exit", btn_size);
|
||||||
|
if (pressed) {
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Supported device view */
|
||||||
|
} else if (supported_device) {
|
||||||
|
anim_box("Jailbreak", ImVec2(450,150),ImVec2(300,200),ImVec2(54,75),ImVec2(129,50));
|
||||||
|
draw_box(ImVec2(box_x, box_y),ImVec2(box_w, box_h), hex_color(0x000000, 0.25f), 20.0f);
|
||||||
|
|
||||||
|
set_pos(167, 90); font(SF_Bold);
|
||||||
|
ImGui::Text("%s", dev.displayName);
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
set_pos(167, 120); font(SF_RegMed);
|
||||||
|
ImGui::Text("%s running iOS %s (%s)", dev.productType, dev.productVersion, dev.CPUArchitecture);
|
||||||
|
|
||||||
|
colors[ImGuiCol_Text] = hex_color(0x3CFF55, 1.0f);
|
||||||
|
set_pos(167, 147); ImGui::Text(ICON_FA_CHECK_CIRCLE);
|
||||||
|
colors[ImGuiCol_Text] = hex_color(0xFFFFFF, 1.0f);
|
||||||
|
|
||||||
|
ImGui::SameLine(); ImGui::Text("Connected and ready.");
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
set_pos(213, 190); font(SF_RoundBold); btn_text_on;
|
||||||
|
bool hovered = is_hovered("Jailbreak", 125, 35);
|
||||||
|
bool pressed = is_pressed("Jailbreak", 125, 35);
|
||||||
|
ImVec2 btn_size = ImVec2(120, 30);
|
||||||
|
|
||||||
|
if (hovered) {
|
||||||
|
anim_btn("Jailbreak", ImVec2(125,35),ImVec2(127,37),ImVec2(213,190),ImVec2(212,189));
|
||||||
|
btn_size = ImVec2(btn_w, btn_h);
|
||||||
|
ImGui::SetCursorPos(ImVec2(btn_x,btn_y));
|
||||||
|
} else {
|
||||||
|
anim_btn("Jailbreak", ImVec2(127,37),ImVec2(125,35),ImVec2(212,189),ImVec2(213,190));
|
||||||
|
btn_size = ImVec2(btn_w, btn_h);
|
||||||
|
ImGui::SetCursorPos(ImVec2(btn_x,btn_y));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Button("Jailbreak", btn_size);
|
||||||
|
if (pressed) {
|
||||||
|
enter_recovery_cmd(0);
|
||||||
|
box_x = 140.0f; box_y = 55.0f; box_w = 320.0f; box_h = 240.0f;
|
||||||
|
supported_device = false;
|
||||||
|
recovery_wait = true;
|
||||||
|
btn_text_off;
|
||||||
|
ImGui::PopFont();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Waiting for recovery view */
|
||||||
|
} else if (recovery_wait) {
|
||||||
|
|
||||||
|
draw_box(ImVec2(125, 105),ImVec2(300, 90), hex_color(0x000000, 0.25f), 20.0f);
|
||||||
|
//ImageRotated(loader, ImVec2(160, 150), ImVec2(40.0f, 40.0f), angle);
|
||||||
|
|
||||||
|
set_pos(210, 138); font(SF_Bold);
|
||||||
|
ImGui::Text("Entering recovery...");
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
if (device_status == RECOVERY) {
|
||||||
|
recovery_wait = false;
|
||||||
|
enter_dfu = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ready for DFU view */
|
||||||
|
} else if (enter_dfu) {
|
||||||
|
|
||||||
|
draw_box(ImVec2(65, 105),ImVec2(450, 90), hex_color(0x000000, 0.25f), 20.0f);
|
||||||
|
|
||||||
|
set_pos(110, 128); font(SF_Bold);
|
||||||
|
ImGui::Text("Time to enter DFU mode!");
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
set_pos(110, 153); font(SF_Reg);
|
||||||
|
ImGui::Text("Locate the power and volume down button before you proceed.");
|
||||||
|
|
||||||
|
set_pos(108, 210); font(SF_Sm_Bold); btn_text_on;
|
||||||
|
if (ImGui::Button("Start", ImVec2(125, 35))) {
|
||||||
|
enter_dfu = false;
|
||||||
|
dfu_helper = true;
|
||||||
|
btn_text_off;
|
||||||
|
ImGui::PopFont();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DFU helper view */
|
||||||
|
} else if (dfu_helper) {
|
||||||
|
draw_box(ImVec2(75, 65),ImVec2(450, 220), hex_color(0x000000, 0.5f), 20.0f);
|
||||||
|
|
||||||
|
if (dfu_step1 > 0) dfu_text_light;
|
||||||
|
else dfu_text_dark;
|
||||||
|
set_pos(110, 110); font(SF_Reg);
|
||||||
|
ImGui::Text("1. Get Ready! %d", dfu_step1);
|
||||||
|
|
||||||
|
if (dfu_step2 > 0 && dfu_step1 == 0) dfu_text_light;
|
||||||
|
else dfu_text_dark;
|
||||||
|
set_pos(110, 160); ImGui::Text("2. Hold volume down + side button %d", dfu_step2);
|
||||||
|
|
||||||
|
if (dfu_step3 > 0 && dfu_step2 == 0) dfu_text_light;
|
||||||
|
else dfu_text_dark;;
|
||||||
|
set_pos(110, 210);ImGui::Text("3. Release side button, but keep holding volume down %d", dfu_step3);
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
if (!dfu_done) {
|
||||||
|
if (set_ms) {
|
||||||
|
desired = ms() + 1000;
|
||||||
|
set_ms = false;
|
||||||
|
}
|
||||||
|
if (ms() >= desired) {
|
||||||
|
set_ms = true;
|
||||||
|
if (dfu_step1 > 0) dfu_step1 -= 1;
|
||||||
|
else if (dfu_step2 > 0) dfu_step2 -= 1;
|
||||||
|
else if (dfu_step3 > 0) dfu_step3 -= 1;
|
||||||
|
else dfu_done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dfu_step2 == 2) exitrecv_cmd(dev.ecid);
|
||||||
|
if (dfu_done) {
|
||||||
|
if (device_status == DFU) {
|
||||||
|
guifree();
|
||||||
|
dfu_helper = false;
|
||||||
|
jailbreak = true;
|
||||||
|
} else {
|
||||||
|
send_alert("Failed to enter DFU", "Device failed to enter DFU mode, please try again.");
|
||||||
|
dfu_step1 = 3; dfu_step2 = 5; dfu_step3 = 10;
|
||||||
|
dfu_done = false;
|
||||||
|
dfu_helper = false;
|
||||||
|
waiting_for_device = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Jailbreak view */
|
||||||
|
} else if (jailbreak) {
|
||||||
|
pthread_t jb;
|
||||||
|
|
||||||
|
draw_box(ImVec2(25, 70),ImVec2(500, 200), hex_color(0x000000, 0.25f), 20.0f);
|
||||||
|
|
||||||
|
set_pos(20, 15); font(SF_Bold);
|
||||||
|
ImGui::Text("Installing jailbreak...");
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
set_pos(20, 40); font(SF_Reg);
|
||||||
|
ImGui::Text("This will take a moment to jailbreak, hang tight!");
|
||||||
|
|
||||||
|
set_pos(50, 100); font(Hack);
|
||||||
|
if (!execjb) {
|
||||||
|
execjb = true;
|
||||||
|
palera1n(1, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// redirect logs here...
|
||||||
|
ImGui::Text("[*] Running...");
|
||||||
|
set_pos(50, 125); ImGui::Text("[*] Some epic log stuff will go here :3");
|
||||||
|
set_pos(50, 150); ImGui::Text("[*] lorem ipsum :frcoal:");
|
||||||
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
if (settings) {
|
||||||
|
draw_box(ImVec2(50.0f, 65.0f),ImVec2(230.0f, 230.0f), hex_color(0x000000, 0.5f), 20.0f);
|
||||||
|
draw_box(ImVec2(320.0f, 65.0f),ImVec2(230.0f, 230.0f), hex_color(0x000000, 0.5f), 20.0f);
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
HelloImGui::Run(params);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+2
-2
@@ -27,7 +27,7 @@
|
|||||||
#include <ANSI-color-codes.h>
|
#include <ANSI-color-codes.h>
|
||||||
#include <palerain.h>
|
#include <palerain.h>
|
||||||
#include <xxd-embedded.h>
|
#include <xxd-embedded.h>
|
||||||
#include <paleinfo.h>
|
#include <kerninfo.h>
|
||||||
|
|
||||||
pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
|
pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
|
||||||
#ifdef TUI
|
#ifdef TUI
|
||||||
@@ -90,7 +90,7 @@ uint64_t set_ecid_wait_for_dfu(uint64_t ecid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TUI
|
#ifdef TUI
|
||||||
newtComponent get_tui_log(void) {
|
newtComponent get_tui_log() {
|
||||||
pthread_mutex_lock(&tui_log_mutex);
|
pthread_mutex_lock(&tui_log_mutex);
|
||||||
newtComponent ret = tui_log_output;
|
newtComponent ret = tui_log_output;
|
||||||
pthread_mutex_unlock(&tui_log_mutex);
|
pthread_mutex_unlock(&tui_log_mutex);
|
||||||
|
|||||||
@@ -0,0 +1,245 @@
|
|||||||
|
#ifndef HAVE_LIBIMOBILEDEVICE
|
||||||
|
#include "lockdown_helper.h"
|
||||||
|
#include <usbmuxd.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define log_debug(...) fprintf(stderr, __VA_ARGS__); fputc('\n', stderr)
|
||||||
|
#else
|
||||||
|
#define log_debug(...) do {} while (0)
|
||||||
|
#endif
|
||||||
|
#define log_error(...) fprintf(stderr, __VA_ARGS__); fputc('\n', stderr)
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
return lockdown_connect_handle(device.handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lockdown_disconnect(int fd) {
|
||||||
|
usbmuxd_disconnect(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
int lockdown_check_type(int fd, const char* type_match);
|
||||||
|
|
||||||
|
static const char QUERY_TYPE_REQUEST[] = "____<plist version=\"1.0\"><dict><key>Label</key><string>palera1n</string><key>Request</key><string>QueryType</string></dict></plist>";
|
||||||
|
static const char GET_VALUE_DOMAIN_REQUEST_FMT[] = "____<plist version=\"1.0\"><dict><key>Label</key><string>palera1n</string><key>Domain</key><string>%s</string><key>Key</key><string>%s</string><key>Request</key><string>GetValue</string></dict></plist>";
|
||||||
|
static const char GET_VALUE_REQUEST_FMT[] = "____<plist version=\"1.0\"><dict><key>Label</key><string>palera1n</string><key>Key</key><string>%s</string><key>Request</key><string>GetValue</string></dict></plist>";
|
||||||
|
static const char VALUE_KEY_NODE[] = "<key>Value</key>";
|
||||||
|
static const char INTEGER_NODE[] = "<integer>";
|
||||||
|
static const char STRING_NODE[] = "<string>";
|
||||||
|
static const char ENTER_RECOVERY_REQUEST[] = "____<plist version=\"1.0\"><dict><key>Label</key><string>palera1n</string><key>Request</key><string>EnterRecovery</string></dict></plist>";
|
||||||
|
static const char ERROR_KEY_NODE[] = "<key>Error</key>";
|
||||||
|
static const char ENTER_RECOVERY_STRING_NODE[] = "<string>EnterRecovery</string>";
|
||||||
|
static const int VALUE_KEY_NODE_SIZE = sizeof(VALUE_KEY_NODE)-1;
|
||||||
|
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) {
|
||||||
|
char* p = *cur;
|
||||||
|
while (p < end && ((*p == ' ') || (*p == '\t') || (*p == '\r') || (*p == '\n'))) {
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
*cur = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
usbmuxd_disconnect(fd);
|
||||||
|
log_error("Failed to send data payload");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t recv_bytes = 0;
|
||||||
|
uint32_t besize = 0;
|
||||||
|
int r = usbmuxd_recv(fd, (char*)&besize, sizeof(besize), &recv_bytes);
|
||||||
|
if (recv_bytes != sizeof(besize)) {
|
||||||
|
usbmuxd_disconnect(fd);
|
||||||
|
log_error("Failed to get size of packet (%d)", r);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t resp_size = ntohl(besize);
|
||||||
|
char* resp = (char*)malloc(resp_size+1);
|
||||||
|
|
||||||
|
recv_bytes = 0;
|
||||||
|
usbmuxd_recv(fd, resp, resp_size, &recv_bytes);
|
||||||
|
if (recv_bytes != resp_size) {
|
||||||
|
usbmuxd_disconnect(fd);
|
||||||
|
free(resp);
|
||||||
|
log_error("Failed to receive payload");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
resp[resp_size] = '\0';
|
||||||
|
*received = resp_size;
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
*(uint32_t*)tmp = belen;
|
||||||
|
uint32_t resp_size = 0;
|
||||||
|
char* resp = _send_request_and_get_reply(fd, (char*)tmp, len, &resp_size);
|
||||||
|
if (!resp) {
|
||||||
|
log_error("Failed to get lockdown type");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = (strstr(resp, type_match) == NULL) ? -1 : 0;
|
||||||
|
free(resp);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lockdown_get_uint_value(int fd, const char* domain, const char* key, uint64_t* value) {
|
||||||
|
char tmp[1024];
|
||||||
|
uint32_t len;
|
||||||
|
if (domain) {
|
||||||
|
len = snprintf(tmp, 1024, GET_VALUE_DOMAIN_REQUEST_FMT, domain, key);
|
||||||
|
} else {
|
||||||
|
len = snprintf(tmp, 1024, GET_VALUE_REQUEST_FMT, key);
|
||||||
|
}
|
||||||
|
*(uint32_t*)&tmp = htonl(len-4);
|
||||||
|
|
||||||
|
uint32_t resp_size = 0;
|
||||||
|
char* resp = _send_request_and_get_reply(fd, tmp, len, &resp_size);
|
||||||
|
if (!resp) {
|
||||||
|
log_error("Failed to get value for key %s", key);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* p = strstr(resp, VALUE_KEY_NODE);
|
||||||
|
if (!p) {
|
||||||
|
log_debug("Failed to get Value key node?!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
p += VALUE_KEY_NODE_SIZE;
|
||||||
|
skip_ws(&p, resp+resp_size);
|
||||||
|
if (p >= resp+resp_size) {
|
||||||
|
log_debug("Failed to get value node");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (strncmp(p, INTEGER_NODE, INTEGER_NODE_SIZE) != 0) {
|
||||||
|
log_debug("Failed to parse value node");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
p += INTEGER_NODE_SIZE;
|
||||||
|
*value = (uint64_t)strtoll(p, NULL, 10);
|
||||||
|
free(resp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lockdown_get_string_value(int fd, const char* domain, const char* key, char** value) {
|
||||||
|
char tmp[1024];
|
||||||
|
uint32_t len;
|
||||||
|
if (domain) {
|
||||||
|
len = snprintf(tmp, 1024, GET_VALUE_DOMAIN_REQUEST_FMT, domain, key);
|
||||||
|
} else {
|
||||||
|
len = snprintf(tmp, 1024, GET_VALUE_REQUEST_FMT, key);
|
||||||
|
}
|
||||||
|
*(uint32_t*)&tmp = htonl(len-4);
|
||||||
|
|
||||||
|
uint32_t resp_size = 0;
|
||||||
|
char* resp = _send_request_and_get_reply(fd, tmp, len, &resp_size);
|
||||||
|
if (!resp) {
|
||||||
|
log_error("Failed to get value for key %s", key);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* p = strstr(resp, VALUE_KEY_NODE);
|
||||||
|
if (!p) {
|
||||||
|
log_debug("Failed to get Value key node?!");
|
||||||
|
free(resp);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
p += VALUE_KEY_NODE_SIZE;
|
||||||
|
skip_ws(&p, resp+resp_size);
|
||||||
|
if (p >= resp+resp_size) {
|
||||||
|
log_debug("Failed to get value node");
|
||||||
|
free(resp);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (strncmp(p, STRING_NODE, STRING_NODE_SIZE) != 0) {
|
||||||
|
log_debug("Failed to parse value node");
|
||||||
|
free(resp);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
p += STRING_NODE_SIZE;
|
||||||
|
char* str_start = p;
|
||||||
|
while (*p != '<' && *p != '\0') p++;
|
||||||
|
if (*p == '\0') {
|
||||||
|
log_debug("Failed to parse string value node");
|
||||||
|
free(resp);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
size_t str_len = p - str_start;
|
||||||
|
*value = (char*)malloc(str_len + 1);
|
||||||
|
snprintf(*value, str_len, "%s", str_start);
|
||||||
|
(*value)[str_len] = '\0';
|
||||||
|
free(resp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
uint32_t resp_size = 0;
|
||||||
|
char* resp = _send_request_and_get_reply(fd, tmp, len, &resp_size);
|
||||||
|
if (!resp) {
|
||||||
|
log_error("Failed to enter recover?");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = -1;
|
||||||
|
char* p = strstr(resp, ERROR_KEY_NODE);
|
||||||
|
if (p) {
|
||||||
|
char* str_start = NULL;
|
||||||
|
size_t str_len = 0;
|
||||||
|
p += ERROR_KEY_NODE_SIZE;
|
||||||
|
skip_ws(&p, resp+resp_size);
|
||||||
|
if (*p && !strncmp(p, STRING_NODE, STRING_NODE_SIZE)) {
|
||||||
|
p += STRING_NODE_SIZE;
|
||||||
|
str_start = p;
|
||||||
|
while (*p != '<' && *p != '\0') p++;
|
||||||
|
if (*p == '<') {
|
||||||
|
str_len = p - str_start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (str_start && str_len > 0) {
|
||||||
|
log_error("ERROR: Failed to make device enter recovery mode: %.*s", (int)str_len, str_start);
|
||||||
|
} else {
|
||||||
|
log_error("ERROR: Failed to make device enter recovery mode: (unknown error)");
|
||||||
|
}
|
||||||
|
result = -2;
|
||||||
|
} else {
|
||||||
|
result = (strstr(resp, ENTER_RECOVERY_STRING_NODE) == NULL) ? -1 : 0;
|
||||||
|
}
|
||||||
|
free(resp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef __LOCKDOWN_HELPER_H
|
||||||
|
#define __LOCKDOWN_HELPER_H
|
||||||
|
|
||||||
|
#ifndef HAVE_LIBIMOBILEDEVICE
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int lockdown_connect_udid(const char* udid);
|
||||||
|
int lockdown_connect_handle(uint32_t handle);
|
||||||
|
|
||||||
|
void lockdown_disconnect(int fd);
|
||||||
|
|
||||||
|
int lockdown_check_type(int fd, const char* type_match);
|
||||||
|
|
||||||
|
int lockdown_get_uint_value(int fd, const char* domain, const char* key, uint64_t* value);
|
||||||
|
int lockdown_get_string_value(int fd, const char* domain, const char* key, char** value);
|
||||||
|
|
||||||
|
int lockdown_enter_recovery(int fd);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -12,7 +12,7 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
|
|||||||
{
|
{
|
||||||
if (verbose >= 5
|
if (verbose >= 5
|
||||||
#ifdef TUI
|
#ifdef TUI
|
||||||
&& !(palerain_flags & palerain_option_tui)
|
&& !checkrain_options_enabled(host_flags, host_option_tui)
|
||||||
#endif
|
#endif
|
||||||
) fprintf(stderr, "p1_log: loglevel %d from %s:%d:%s()\n", loglevel, fname, lineno, fxname);
|
) fprintf(stderr, "p1_log: loglevel %d from %s:%d:%s()\n", loglevel, fname, lineno, fxname);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -57,12 +57,12 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
|
|||||||
snprintf(colour_bold, 0x10, "%s", BWHT);
|
snprintf(colour_bold, 0x10, "%s", BWHT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((palerain_flags & palerain_option_no_colors)) {
|
if (checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||||
colour[0] = '\0';
|
colour[0] = '\0';
|
||||||
colour_bold[0] = '\0';
|
colour_bold[0] = '\0';
|
||||||
}
|
}
|
||||||
#ifdef TUI
|
#ifdef TUI
|
||||||
if ((palerain_flags & palerain_option_tui) && tui_started) {
|
if (checkrain_options_enabled(host_flags, host_option_tui) && tui_started) {
|
||||||
newtComponent co = get_tui_log();
|
newtComponent co = get_tui_log();
|
||||||
if (co == NULL) {
|
if (co == NULL) {
|
||||||
return 0; /* 0 bytes printed */
|
return 0; /* 0 bytes printed */
|
||||||
@@ -79,26 +79,26 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
|
|||||||
time_t curtime;
|
time_t curtime;
|
||||||
time(&curtime);
|
time(&curtime);
|
||||||
struct tm* timeinfo = localtime(&curtime);
|
struct tm* timeinfo = localtime(&curtime);
|
||||||
if (!(palerain_flags & palerain_option_no_colors))
|
if (!checkrain_options_enabled(host_flags, host_option_no_colors))
|
||||||
snprintf(timestring, 0x80, "%s[%s%02d/%02d/%d %02d:%02d:%02d%s]", CRESET, HBLK, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, CRESET);
|
snprintf(timestring, 0x80, "%s[%s%02d/%02d/%d %02d:%02d:%02d%s]", CRESET, HBLK, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, CRESET);
|
||||||
else
|
else
|
||||||
snprintf(timestring, 0x80, "[%02d/%02d/%d %02d:%02d:%02d]", timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
|
snprintf(timestring, 0x80, "[%02d/%02d/%d %02d:%02d:%02d]", timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
|
||||||
if (verbose >= 2 && !(palerain_flags & palerain_option_no_colors)) {
|
if (verbose >= 2 && !checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||||
printf("%s| - %s%s <%s> " CRESET "%s" HBLU "%s" CRESET ":" BLU "%d" CRESET ":" BMAG "%s()" CRESET ": \n%s| ----> ", colour_bold, timestring, colour_bold, type, WHT, fname, lineno, fxname, colour_bold);
|
printf("%s| - %s%s <%s> " CRESET "%s" HBLU "%s" CRESET ":" BLU "%d" CRESET ":" BMAG "%s()" CRESET ": \n%s| ----> ", colour_bold, timestring, colour_bold, type, WHT, fname, lineno, fxname, colour_bold);
|
||||||
} else if (!(palerain_flags & palerain_option_no_colors)) {
|
} else if (!checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||||
printf(" - %s %s<%s>%s: ", timestring, colour_bold, type, CRESET);
|
printf(" - %s %s<%s>%s: ", timestring, colour_bold, type, CRESET);
|
||||||
} else if (verbose >= 2 && (palerain_flags & palerain_option_no_colors)) {
|
} else if (verbose >= 2 && checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||||
printf("%s| - %s%s <%s> %s:%d:%s(): \n%s| ----> ", colour_bold, timestring, colour_bold, type, fname, lineno, fxname, colour_bold);
|
printf("%s| - %s%s <%s> %s:%d:%s(): \n%s| ----> ", colour_bold, timestring, colour_bold, type, fname, lineno, fxname, colour_bold);
|
||||||
} else if ((palerain_flags & palerain_option_no_colors)) {
|
} else if (checkrain_options_enabled(host_flags, host_option_no_colors)) {
|
||||||
printf(" - %s %s<%s>: ", timestring, colour_bold, type);
|
printf(" - %s %s<%s>: ", timestring, colour_bold, type);
|
||||||
}
|
}
|
||||||
printf("%s", colour);
|
printf("%s", colour);
|
||||||
ret = vprintf(format, args);
|
ret = vprintf(format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (verbose < 2 && !(palerain_flags & palerain_option_no_colors))
|
if (verbose < 2 && !checkrain_options_enabled(host_flags, host_option_no_colors))
|
||||||
printf(CRESET "\n");
|
printf(CRESET "\n");
|
||||||
else if (!(palerain_flags & palerain_option_no_colors))
|
else if (!checkrain_options_enabled(host_flags, host_option_no_colors))
|
||||||
printf("\n%s-%s\n", colour, CRESET);
|
printf("\n%s-%s\n", colour, CRESET);
|
||||||
else if (verbose < 2)
|
else if (verbose < 2)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|||||||
+33
-18
@@ -27,19 +27,19 @@
|
|||||||
#include <ANSI-color-codes.h>
|
#include <ANSI-color-codes.h>
|
||||||
#include <palerain.h>
|
#include <palerain.h>
|
||||||
#include <xxd-embedded.h>
|
#include <xxd-embedded.h>
|
||||||
#include <paleinfo.h>
|
#include <kerninfo.h>
|
||||||
|
#include <gui.h>
|
||||||
|
|
||||||
#define CMD_LEN_MAX 512
|
#define CMD_LEN_MAX 512
|
||||||
#define OVERRIDE_MAGIC 0xd803b376
|
#define OVERRIDE_MAGIC 0xd803b376
|
||||||
|
|
||||||
unsigned int verbose = 0;
|
unsigned int verbose = 0;
|
||||||
/* we want to write to them so don't use string literals */
|
char xargs_cmd[0x270] = "xargs ", checkrain_flags_cmd[0x20] = "deadbeef", palerain_flags_cmd[0x20] = "deadbeef";
|
||||||
char xargs_cmd[0x270] = { 'x', 'a', 'r', 'g', 's', '\0' },
|
char kpf_flags_cmd[0x20] = "deadbeef", dtpatch_cmd[0x20] = "deadbeef", rootfs_cmd[512] = "deadbeef";
|
||||||
palerain_flags_cmd[0x30] = { 'd', 'e', 'a', 'd', 'b', 'e', 'e', 'f', '\0' };
|
|
||||||
extern char** environ;
|
extern char** environ;
|
||||||
|
|
||||||
niarelap_file_t* kpf_to_upload_1 = &checkra1n_kpf_pongo_lzma;
|
niarelap_file_t* kpf_to_upload_1 = &checkra1n_kpf_pongo;
|
||||||
niarelap_file_t* ramdisk_to_upload_1 = &ramdisk_dmg_lzma;
|
niarelap_file_t* ramdisk_to_upload_1 = &ramdisk_dmg;
|
||||||
niarelap_file_t* overlay_to_upload_1 = &binpack_dmg;
|
niarelap_file_t* overlay_to_upload_1 = &binpack_dmg;
|
||||||
|
|
||||||
niarelap_file_t** kpf_to_upload = &kpf_to_upload_1;
|
niarelap_file_t** kpf_to_upload = &kpf_to_upload_1;
|
||||||
@@ -48,7 +48,7 @@ niarelap_file_t** overlay_to_upload = &overlay_to_upload_1;
|
|||||||
|
|
||||||
override_file_t override_ramdisk, override_kpf, override_overlay;
|
override_file_t override_ramdisk, override_kpf, override_overlay;
|
||||||
|
|
||||||
uint64_t palerain_flags = 0;
|
uint32_t checkrain_flags = 0, palerain_flags = 0, kpf_flags = 0;
|
||||||
|
|
||||||
pthread_mutex_t log_mutex;
|
pthread_mutex_t log_mutex;
|
||||||
pthread_t dfuhelper_thread, pongo_thread;
|
pthread_t dfuhelper_thread, pongo_thread;
|
||||||
@@ -74,7 +74,20 @@ int build_checks(void) {
|
|||||||
LOG(LOG_FATAL, "checkra1n too small");
|
LOG(LOG_FATAL, "checkra1n too small");
|
||||||
}
|
}
|
||||||
if (boyermoore_horspool_memmem(&checkra1n[0], checkra1n_len, (const unsigned char *)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL) {
|
if (boyermoore_horspool_memmem(&checkra1n[0], checkra1n_len, (const unsigned char *)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL) {
|
||||||
palerain_flags |= palerain_option_checkrain_is_clone;
|
host_flags |= palerain_option_checkrain_is_clone;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifndef NO_KPF
|
||||||
|
struct mach_header_64 *kpf_hdr = (struct mach_header_64 *)checkra1n_kpf_pongo;
|
||||||
|
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) {
|
||||||
|
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: Not a kext bundle");
|
||||||
|
return -1;
|
||||||
|
} else if (kpf_hdr->cputype != CPU_TYPE_ARM64) {
|
||||||
|
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: CPU type is not arm64");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
@@ -99,9 +112,9 @@ int palera1n(int argc, char *argv[]) {
|
|||||||
pthread_mutex_init(&ecid_dfu_wait_mutex, NULL);
|
pthread_mutex_init(&ecid_dfu_wait_mutex, NULL);
|
||||||
if ((ret = build_checks())) return ret;
|
if ((ret = build_checks())) return ret;
|
||||||
if ((ret = optparse(argc, argv))) goto cleanup;
|
if ((ret = optparse(argc, argv))) goto cleanup;
|
||||||
if (!(palerain_flags & palerain_option_device_info) && (palerain_flags & palerain_option_palerain_version)) goto normal_exit;
|
if (!checkrain_options_enabled(host_flags, host_option_device_info) && checkrain_options_enabled(host_flags, host_option_palerain_version)) goto normal_exit;
|
||||||
#ifdef TUI
|
#ifdef TUI
|
||||||
if ((palerain_flags & palerain_option_tui)) {
|
if (checkrain_options_enabled(host_flags, host_option_tui)) {
|
||||||
ret = tui();
|
ret = tui();
|
||||||
if (ret) goto cleanup;
|
if (ret) goto cleanup;
|
||||||
else goto normal_exit;
|
else goto normal_exit;
|
||||||
@@ -121,26 +134,26 @@ int palera1n(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(palerain_flags & palerain_option_device_info))
|
if (!checkrain_options_enabled(host_flags, host_option_device_info))
|
||||||
LOG(LOG_INFO, "Waiting for devices");
|
LOG(LOG_INFO, "Waiting for devices");
|
||||||
|
|
||||||
if (getenv("USBMUXD_SOCKET_ADDRESS") == NULL && access("/var/run/usbmuxd", F_OK) != 0)
|
if (access("/var/run/usbmuxd", F_OK) != 0)
|
||||||
LOG(LOG_WARNING, "/var/run/usbmuxd not found, normal mode device detection will not work.");
|
LOG(LOG_WARNING, "/var/run/usbmuxd not found, normal mode device detection will not work.");
|
||||||
|
|
||||||
pthread_create(&pongo_thread, NULL, pongo_helper, NULL);
|
pthread_create(&pongo_thread, NULL, pongo_helper, NULL);
|
||||||
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
|
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
|
||||||
pthread_join(dfuhelper_thread, NULL);
|
pthread_join(dfuhelper_thread, NULL);
|
||||||
set_spin(0);
|
set_spin(0);
|
||||||
if ((palerain_flags & (palerain_option_dfuhelper_only |
|
if (checkrain_options_enabled(host_flags, host_option_dfuhelper_only |
|
||||||
palerain_option_reboot_device |
|
host_option_reboot_device |
|
||||||
palerain_option_exit_recovery |
|
host_option_exit_recovery |
|
||||||
palerain_option_enter_recovery |
|
host_option_enter_recovery |
|
||||||
palerain_option_device_info)
|
host_option_device_info
|
||||||
) || device_has_booted)
|
) || device_has_booted)
|
||||||
goto normal_exit;
|
goto normal_exit;
|
||||||
if (exec_checkra1n()) goto cleanup;
|
if (exec_checkra1n()) goto cleanup;
|
||||||
|
|
||||||
if ((palerain_flags & (palerain_option_pongo_exit | palerain_option_demote)))
|
if (checkrain_options_enabled(host_flags, host_option_pongo_exit | host_option_demote))
|
||||||
goto normal_exit;
|
goto normal_exit;
|
||||||
set_spin(1);
|
set_spin(1);
|
||||||
sleep(2);
|
sleep(2);
|
||||||
@@ -173,6 +186,8 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GUI
|
||||||
int main (int argc, char* argv[]) {
|
int main (int argc, char* argv[]) {
|
||||||
return palera1n(argc, argv);
|
return palera1n(argc, argv);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@@ -1 +0,0 @@
|
|||||||
*.o
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
.
|
|
||||||
+50
-55
@@ -13,9 +13,9 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <palerain.h>
|
#include <palerain.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
uint64_t* palerain_flags_p = &palerain_flags;
|
checkrain_option_t host_flags = 0;
|
||||||
|
checkrain_option_p host_flags_p = &host_flags;
|
||||||
static bool force_use_verbose_boot = false;
|
static bool force_use_verbose_boot = false;
|
||||||
|
|
||||||
static struct option longopts[] = {
|
static struct option longopts[] = {
|
||||||
@@ -31,6 +31,7 @@ static struct option longopts[] = {
|
|||||||
{"boot-args", required_argument, NULL, 'e'},
|
{"boot-args", required_argument, NULL, 'e'},
|
||||||
{"fakefs", no_argument, NULL, 'f'},
|
{"fakefs", no_argument, NULL, 'f'},
|
||||||
{"rootless", no_argument, NULL, 'l'},
|
{"rootless", no_argument, NULL, 'l'},
|
||||||
|
{"jbinit-log-to-file", no_argument, NULL, 'L'},
|
||||||
{"demote", no_argument, NULL, 'd'},
|
{"demote", no_argument, NULL, 'd'},
|
||||||
{"force-revert", no_argument, NULL, palerain_option_case_force_revert},
|
{"force-revert", no_argument, NULL, palerain_option_case_force_revert},
|
||||||
{"no-colors", no_argument, NULL, 'S'},
|
{"no-colors", no_argument, NULL, 'S'},
|
||||||
@@ -59,19 +60,19 @@ static int usage(int e, char* prog_name)
|
|||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: %s [-"
|
"Usage: %s [-"
|
||||||
"DEhpvVdsSLRnPI"
|
"DEhpvVldsSLRnPI"
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
"12"
|
"12"
|
||||||
#endif
|
#endif
|
||||||
#ifdef ROOTFUL
|
#ifdef ROOTFUL
|
||||||
"cCfBl"
|
"cCfB"
|
||||||
#endif
|
#endif
|
||||||
#ifdef TUI
|
#ifdef TUI
|
||||||
"t"
|
"t"
|
||||||
#endif
|
#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"
|
"Copyright (C) 2023, palera1n team, All Rights Reserved.\n\n"
|
||||||
"iOS/iPadOS 15.0-16.5.1 arm64 jailbreaking tool\n\n"
|
"iOS/iPadOS 15.0-16.5 arm64 jailbreaking tool\n\n"
|
||||||
"\t--version\t\t\t\tPrint version\n"
|
"\t--version\t\t\t\tPrint version\n"
|
||||||
"\t--force-revert\t\t\t\tRemove jailbreak\n"
|
"\t--force-revert\t\t\t\tRemove jailbreak\n"
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
@@ -94,9 +95,7 @@ static int usage(int e, char* prog_name)
|
|||||||
"\t-i, --override-checkra1n <file>\t\tOverride checkra1n\n"
|
"\t-i, --override-checkra1n <file>\t\tOverride checkra1n\n"
|
||||||
"\t-k, --override-pongo <file>\t\tOverride Pongo image\n"
|
"\t-k, --override-pongo <file>\t\tOverride Pongo image\n"
|
||||||
"\t-K, --override-kpf <file>\t\tOverride kernel patchfinder\n"
|
"\t-K, --override-kpf <file>\t\tOverride kernel patchfinder\n"
|
||||||
#ifdef ROOTFUL
|
|
||||||
"\t-l, --rootless\t\t\t\tBoots rootless. This is the default\n"
|
"\t-l, --rootless\t\t\t\tBoots rootless. This is the default\n"
|
||||||
#endif
|
|
||||||
"\t-L, --jbinit-log-to-file\t\tMake jbinit log to /cores/jbinit.log (can be read from sandbox while jailbroken)\n"
|
"\t-L, --jbinit-log-to-file\t\tMake jbinit log to /cores/jbinit.log (can be read from sandbox while jailbroken)\n"
|
||||||
"\t-n, --exit-recovery\t\t\tExit recovery mode\n"
|
"\t-n, --exit-recovery\t\t\tExit recovery mode\n"
|
||||||
"\t-I, --device-info\t\t\tPrint info about the connected device\n"
|
"\t-I, --device-info\t\t\tPrint info about the connected device\n"
|
||||||
@@ -125,7 +124,7 @@ int optparse(int argc, char* argv[]) {
|
|||||||
int opt;
|
int opt;
|
||||||
int index;
|
int index;
|
||||||
while ((opt = getopt_long(argc, argv,
|
while ((opt = getopt_long(argc, argv,
|
||||||
"DEhpvVlLdsStRnPIe:o:r:K:k:i:"
|
"DEhpvVldsSLtRnPIe:o:r:K:k:i:"
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
"12"
|
"12"
|
||||||
#endif
|
#endif
|
||||||
@@ -136,23 +135,23 @@ int optparse(int argc, char* argv[]) {
|
|||||||
case 'B':
|
case 'B':
|
||||||
palerain_flags |= palerain_option_setup_partial_root;
|
palerain_flags |= palerain_option_setup_partial_root;
|
||||||
palerain_flags |= palerain_option_setup_rootful;
|
palerain_flags |= palerain_option_setup_rootful;
|
||||||
palerain_flags |= palerain_option_verbose_boot;
|
kpf_flags |= checkrain_option_verbose_boot;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
palerain_flags |= palerain_option_setup_rootful;
|
palerain_flags |= palerain_option_setup_rootful;
|
||||||
palerain_flags |= palerain_option_verbose_boot;
|
kpf_flags |= checkrain_option_verbose_boot;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
palerain_flags |= palerain_option_clean_fakefs;
|
palerain_flags |= palerain_option_clean_fakefs;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
palerain_flags |= palerain_option_pongo_exit;
|
host_flags |= host_option_pongo_exit;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
palerain_flags |= palerain_option_pongo_full;
|
host_flags |= host_option_pongo_full;
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
palerain_flags |= palerain_option_dfuhelper_only;
|
host_flags |= host_option_dfuhelper_only;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(0, argv[0]);
|
usage(0, argv[0]);
|
||||||
@@ -161,7 +160,7 @@ int optparse(int argc, char* argv[]) {
|
|||||||
verbose++;
|
verbose++;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
palerain_flags |= palerain_option_verbose_boot;
|
kpf_flags |= checkrain_option_verbose_boot;
|
||||||
force_use_verbose_boot = true;
|
force_use_verbose_boot = true;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
@@ -175,24 +174,24 @@ int optparse(int argc, char* argv[]) {
|
|||||||
snprintf(xargs_cmd, sizeof(xargs_cmd), "xargs %s", optarg);
|
snprintf(xargs_cmd, sizeof(xargs_cmd), "xargs %s", optarg);
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
|
snprintf(rootfs_cmd, sizeof(rootfs_cmd), "rootfs %s", optarg);
|
||||||
|
snprintf(dtpatch_cmd, 0x20, "dtpatch %s", optarg);
|
||||||
palerain_flags |= palerain_option_rootful;
|
palerain_flags |= palerain_option_rootful;
|
||||||
palerain_flags &= ~palerain_option_rootless;
|
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
palerain_flags &= ~palerain_option_rootful;
|
palerain_flags &= ~palerain_option_rootful;
|
||||||
palerain_flags |= palerain_option_rootless;
|
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
palerain_flags |= palerain_option_jbinit_log_to_file;
|
palerain_flags |= palerain_option_jbinit_log_to_file;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
palerain_flags |= palerain_option_demote;
|
host_flags |= host_option_demote;
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
palerain_flags |= palerain_option_enter_recovery;
|
host_flags |= host_option_enter_recovery;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
palerain_flags |= palerain_option_safemode;
|
checkrain_flags |= checkrain_option_safemode;
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
if (access(optarg, F_OK) != 0) {
|
if (access(optarg, F_OK) != 0) {
|
||||||
@@ -200,22 +199,18 @@ int optparse(int argc, char* argv[]) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pongo_path = malloc(strlen(optarg) + 1);
|
pongo_path = malloc(strlen(optarg) + 1);
|
||||||
if (pongo_path == NULL) {
|
strcpy(pongo_path, optarg);
|
||||||
LOG(LOG_FATAL, "memory allocation failed");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
snprintf(pongo_path, strlen(optarg) + 1, "%s", optarg);
|
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
if (override_file(&override_overlay, overlay_to_upload, &binpack_dmg_len, optarg))
|
if (override_file(&override_overlay, overlay_to_upload, &binpack_dmg_len, optarg))
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
if (override_file(&override_ramdisk, ramdisk_to_upload, &ramdisk_dmg_lzma_len, optarg))
|
if (override_file(&override_ramdisk, ramdisk_to_upload, &ramdisk_dmg_len, optarg))
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
case 'K':
|
case 'K':
|
||||||
if (override_file(&override_kpf, kpf_to_upload, &checkra1n_kpf_pongo_lzma_len, optarg))
|
if (override_file(&override_kpf, kpf_to_upload, &checkra1n_kpf_pongo_len, optarg))
|
||||||
return 1;
|
return 1;
|
||||||
struct mach_header_64* hdr = (struct mach_header_64*)override_kpf.ptr;
|
struct mach_header_64* hdr = (struct mach_header_64*)override_kpf.ptr;
|
||||||
if (hdr->magic != MH_MAGIC_64 && hdr->magic != MH_CIGAM_64) {
|
if (hdr->magic != MH_MAGIC_64 && hdr->magic != MH_CIGAM_64) {
|
||||||
@@ -257,12 +252,12 @@ int optparse(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
if (boyermoore_horspool_memmem(addr, st.st_size, (const unsigned char*)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL)
|
if (boyermoore_horspool_memmem(addr, st.st_size, (const unsigned char*)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL)
|
||||||
{
|
{
|
||||||
palerain_flags |= palerain_option_checkrain_is_clone;
|
host_flags |= palerain_option_checkrain_is_clone;
|
||||||
LOG(LOG_VERBOSE3, "%s is checkra1n clone", optarg);
|
LOG(LOG_VERBOSE3, "%s is checkra1n clone", optarg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
palerain_flags &= ~palerain_option_checkrain_is_clone;
|
host_flags &= ~palerain_option_checkrain_is_clone;
|
||||||
LOG(LOG_VERBOSE3, "%s is checkra1n", optarg);
|
LOG(LOG_VERBOSE3, "%s is checkra1n", optarg);
|
||||||
}
|
}
|
||||||
munmap(addr, st.st_size);
|
munmap(addr, st.st_size);
|
||||||
@@ -271,20 +266,20 @@ int optparse(int argc, char* argv[]) {
|
|||||||
snprintf(ext_checkra1n, strlen(optarg) + 1, "%s", optarg);
|
snprintf(ext_checkra1n, strlen(optarg) + 1, "%s", optarg);
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
palerain_flags |= palerain_option_reboot_device;
|
host_flags |= host_option_reboot_device;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
palerain_flags |= palerain_option_exit_recovery;
|
host_flags |= host_option_exit_recovery;
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
palerain_flags |= palerain_option_device_info;
|
host_flags |= host_option_device_info;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
palerain_flags |= palerain_option_no_colors;
|
host_flags |= host_option_no_colors;
|
||||||
break;
|
break;
|
||||||
#ifdef TUI
|
#ifdef TUI
|
||||||
case 't':
|
case 't':
|
||||||
palerain_flags |= palerain_option_tui;
|
host_flags |= host_option_tui;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
@@ -296,17 +291,17 @@ int optparse(int argc, char* argv[]) {
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case palerain_option_case_force_revert:
|
case palerain_option_case_force_revert:
|
||||||
palerain_flags |= palerain_option_force_revert;
|
checkrain_flags |= checkrain_option_force_revert;
|
||||||
break;
|
break;
|
||||||
case palerain_option_case_version:
|
case palerain_option_case_version:
|
||||||
palerain_flags |= palerain_option_palerain_version;
|
host_flags |= host_option_palerain_version;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(1, argv[0]);
|
usage(1, argv[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((palerain_flags & palerain_option_palerain_version)) {
|
if (checkrain_options_enabled(host_flags, host_option_palerain_version)) {
|
||||||
printf(
|
printf(
|
||||||
"palera1n " PALERAIN_VERSION "\n"
|
"palera1n " PALERAIN_VERSION "\n"
|
||||||
BUILD_COMMIT " " BUILD_NUMBER " (" BUILD_BRANCH ")\n\n"
|
BUILD_COMMIT " " BUILD_NUMBER " (" BUILD_BRANCH ")\n\n"
|
||||||
@@ -324,41 +319,41 @@ int optparse(int argc, char* argv[]) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strstr(xargs_cmd, "serial=") != NULL) && !force_use_verbose_boot && (palerain_flags & palerain_option_setup_rootful)) {
|
if ((strstr(xargs_cmd, "serial=") != NULL) && !force_use_verbose_boot && checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
||||||
palerain_flags &= ~palerain_option_verbose_boot;
|
kpf_flags &= ~checkrain_option_verbose_boot;
|
||||||
}
|
|
||||||
|
|
||||||
if ((palerain_flags & (palerain_option_rootless | palerain_option_rootful)) == 0) {
|
|
||||||
LOG(LOG_FATAL, "must specify -l option");
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(palerain_flags_cmd, 0x30, "palera1n_flags 0x%" PRIx64, palerain_flags);
|
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);
|
||||||
|
LOG(LOG_VERBOSE3, "checkrain_flags: %s", checkrain_flags_cmd);
|
||||||
LOG(LOG_VERBOSE3, "palerain_flags: %s", palerain_flags_cmd);
|
LOG(LOG_VERBOSE3, "palerain_flags: %s", palerain_flags_cmd);
|
||||||
|
LOG(LOG_VERBOSE3, "kpf_flags: %s", kpf_flags_cmd);
|
||||||
|
LOG(LOG_VERBOSE3, "host_flags: 0x%x", host_flags);
|
||||||
if (override_kpf.magic == OVERRIDE_MAGIC) {
|
if (override_kpf.magic == OVERRIDE_MAGIC) {
|
||||||
LOG(LOG_VERBOSE4, "kpf override length %" PRIu32 " -> %" PRIu32, override_kpf.orig_len, checkra1n_kpf_pongo_lzma_len);
|
LOG(LOG_VERBOSE4, "kpf override length %u -> %u", override_kpf.orig_len, checkra1n_kpf_pongo_len);
|
||||||
LOG(LOG_VERBOSE4, "kpf override ptr %p -> %p", override_kpf.orig_ptr, **kpf_to_upload);
|
LOG(LOG_VERBOSE4, "kpf override ptr %p -> %p", override_kpf.orig_ptr, **kpf_to_upload);
|
||||||
}
|
}
|
||||||
if (override_ramdisk.magic == OVERRIDE_MAGIC) {
|
if (override_ramdisk.magic == OVERRIDE_MAGIC) {
|
||||||
LOG(LOG_VERBOSE4, "ramdisk override length %" PRIu32 " -> %" PRIu32, override_ramdisk.orig_len, ramdisk_dmg_lzma_len);
|
LOG(LOG_VERBOSE4, "ramdisk override length %u -> %u", override_ramdisk.orig_len, ramdisk_dmg_len);
|
||||||
LOG(LOG_VERBOSE4, "ramdisk override ptr %p -> %p", override_ramdisk.orig_ptr, **ramdisk_to_upload);
|
LOG(LOG_VERBOSE4, "ramdisk override ptr %p -> %p", override_ramdisk.orig_ptr, **ramdisk_to_upload);
|
||||||
}
|
}
|
||||||
if (override_overlay.magic == OVERRIDE_MAGIC) {
|
if (override_overlay.magic == OVERRIDE_MAGIC) {
|
||||||
LOG(LOG_VERBOSE4, "overlay override length %" PRIu32 " -> %" PRIu32, override_overlay.orig_len, binpack_dmg_len);
|
LOG(LOG_VERBOSE4, "overlay override length %u -> %u", override_overlay.orig_len, binpack_dmg_len);
|
||||||
LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload);
|
LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(palerain_flags & palerain_option_rootful)) {
|
if (!checkrain_options_enabled(palerain_flags, palerain_option_rootful)) {
|
||||||
if ((palerain_flags & palerain_option_setup_rootful)) {
|
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful) || checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful_forced)) {
|
||||||
LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode.");
|
LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(
|
if (!(
|
||||||
(palerain_flags & palerain_option_dfuhelper_only) ||
|
checkrain_options_enabled(host_flags, host_option_dfuhelper_only) ||
|
||||||
(palerain_flags & palerain_option_enter_recovery) ||
|
checkrain_options_enabled(host_flags, host_option_enter_recovery) ||
|
||||||
(palerain_flags & palerain_option_exit_recovery) ||
|
checkrain_options_enabled(host_flags, host_option_exit_recovery) ||
|
||||||
(palerain_flags & palerain_option_reboot_device)))
|
checkrain_options_enabled(host_flags, host_option_reboot_device)))
|
||||||
{
|
{
|
||||||
#ifdef NO_CHECKRAIN
|
#ifdef NO_CHECKRAIN
|
||||||
if (checkra1n_len == 0 && ext_checkra1n == NULL)
|
if (checkra1n_len == 0 && ext_checkra1n == NULL)
|
||||||
@@ -366,10 +361,10 @@ int optparse(int argc, char* argv[]) {
|
|||||||
LOG(LOG_FATAL, "checkra1n omitted in build but no override specified");
|
LOG(LOG_FATAL, "checkra1n omitted in build but no override specified");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!((palerain_flags & palerain_option_pongo_exit) || (palerain_flags & palerain_option_pongo_exit)))
|
if (!(checkrain_options_enabled(host_flags, host_option_pongo_exit) || checkrain_options_enabled(host_flags, host_option_pongo_exit)))
|
||||||
{
|
{
|
||||||
#ifdef NO_KPF
|
#ifdef NO_KPF
|
||||||
if (checkra1n_kpf_pongo_lzma_len == 0)
|
if (checkra1n_kpf_pongo_len == 0)
|
||||||
{
|
{
|
||||||
LOG(LOG_FATAL, "kernel patchfinder omitted in build but no override specified");
|
LOG(LOG_FATAL, "kernel patchfinder omitted in build but no override specified");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
+17
-19
@@ -33,7 +33,7 @@ void *pongo_usb_callback(stuff_t *arg) {
|
|||||||
if (get_found_pongo())
|
if (get_found_pongo())
|
||||||
return NULL;
|
return NULL;
|
||||||
set_found_pongo(1);
|
set_found_pongo(1);
|
||||||
if ((palerain_flags & palerain_option_setup_rootful)) {
|
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
||||||
strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1);
|
strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1);
|
||||||
}
|
}
|
||||||
LOG(LOG_INFO, "Found PongoOS USB Device");
|
LOG(LOG_INFO, "Found PongoOS USB Device");
|
||||||
@@ -41,24 +41,22 @@ void *pongo_usb_callback(stuff_t *arg) {
|
|||||||
issue_pongo_command(handle, NULL);
|
issue_pongo_command(handle, NULL);
|
||||||
issue_pongo_command(handle, "fuse lock");
|
issue_pongo_command(handle, "fuse lock");
|
||||||
issue_pongo_command(handle, "sep auto");
|
issue_pongo_command(handle, "sep auto");
|
||||||
upload_pongo_file(handle, **kpf_to_upload, checkra1n_kpf_pongo_lzma_len);
|
upload_pongo_file(handle, **kpf_to_upload, checkra1n_kpf_pongo_len);
|
||||||
if (*kpf_to_upload == &checkra1n_kpf_pongo_lzma) {
|
issue_pongo_command(handle, "modload");
|
||||||
issue_pongo_command(handle, "modload " KPF_UNCOMPRESSED_SIZE);
|
issue_pongo_command(handle, kpf_flags_cmd);
|
||||||
} else {
|
issue_pongo_command(handle, checkrain_flags_cmd);
|
||||||
issue_pongo_command(handle, "modload");
|
|
||||||
}
|
|
||||||
issue_pongo_command(handle, palerain_flags_cmd);
|
issue_pongo_command(handle, palerain_flags_cmd);
|
||||||
|
if (checkrain_options_enabled(palerain_flags, palerain_option_rootful))
|
||||||
|
{
|
||||||
|
issue_pongo_command(handle, "rootfs");
|
||||||
|
}
|
||||||
#ifdef NO_RAMDISK
|
#ifdef NO_RAMDISK
|
||||||
if (ramdisk_dmg_lzma_len != 0)
|
if (ramdisk_dmg_len != 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// strncat(xargs_cmd, " rootdev=md0", 0x270 - strlen(xargs_cmd) - 1);
|
strncat(xargs_cmd, " rootdev=md0", 0x270 - strlen(xargs_cmd) - 1);
|
||||||
upload_pongo_file(handle, **ramdisk_to_upload, ramdisk_dmg_lzma_len);
|
upload_pongo_file(handle, **ramdisk_to_upload, ramdisk_dmg_len);
|
||||||
if ((*ramdisk_to_upload) == &ramdisk_dmg_lzma)
|
issue_pongo_command(handle, "ramdisk");
|
||||||
issue_pongo_command(handle, "ramdisk " RAMDISK_UNCOMPRESSED_SIZE);
|
|
||||||
else {
|
|
||||||
issue_pongo_command(handle, "ramdisk");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#ifdef NO_OVERLAY
|
#ifdef NO_OVERLAY
|
||||||
if (binpack_dmg_len != 0)
|
if (binpack_dmg_len != 0)
|
||||||
@@ -68,13 +66,13 @@ void *pongo_usb_callback(stuff_t *arg) {
|
|||||||
issue_pongo_command(handle, "overlay");
|
issue_pongo_command(handle, "overlay");
|
||||||
}
|
}
|
||||||
issue_pongo_command(handle, xargs_cmd);
|
issue_pongo_command(handle, xargs_cmd);
|
||||||
if ((palerain_flags & palerain_option_pongo_full)) goto done;
|
if (checkrain_options_enabled(host_flags, host_option_pongo_full)) goto done;
|
||||||
issue_pongo_command(handle, "bootx");
|
issue_pongo_command(handle, "bootx");
|
||||||
LOG(LOG_INFO, "Booting Kernel...");
|
LOG(LOG_INFO, "Booting Kernel...");
|
||||||
if ((palerain_flags & palerain_option_setup_partial_root)) {
|
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_partial_root)) {
|
||||||
LOG(LOG_INFO, "Please wait up to 5 minutes for the bindfs to be created.");
|
LOG(LOG_INFO, "Please wait up to 5 minutes for the bindfs to be created.");
|
||||||
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -B (Create BindFS) option to jailbreak.");
|
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -B (Create BindFS) option to jailbreak.");
|
||||||
} else if ((palerain_flags & palerain_option_setup_rootful)) {
|
} else if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) {
|
||||||
LOG(LOG_INFO, "Please wait up to 10 minutes for the fakefs to be created.");
|
LOG(LOG_INFO, "Please wait up to 10 minutes for the fakefs to be created.");
|
||||||
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -c (Create FakeFS) option to jailbreak.");
|
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -c (Create FakeFS) option to jailbreak.");
|
||||||
}
|
}
|
||||||
@@ -165,7 +163,7 @@ int upload_pongo_file(usb_device_handle_t handle, unsigned char *buf, unsigned i
|
|||||||
if (verbose < 3 || verbose > 4) {
|
if (verbose < 3 || verbose > 4) {
|
||||||
LOG(LOG_VERBOSE, "Uploaded %llu bytes to PongoOS", (unsigned long long)buf_len);
|
LOG(LOG_VERBOSE, "Uploaded %llu bytes to PongoOS", (unsigned long long)buf_len);
|
||||||
} else {
|
} else {
|
||||||
if ((palerain_flags & palerain_option_no_colors))
|
if (checkrain_options_enabled(host_flags, host_option_no_colors))
|
||||||
printf("/send mem:%p:%p\nUploaded %llu bytes]\n", (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
|
printf("/send mem:%p:%p\nUploaded %llu bytes]\n", (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
|
||||||
else
|
else
|
||||||
printf("/send mem:%p:%p\n" BCYN "[Uploaded %llu bytes]\n" CRESET, (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
|
printf("/send mem:%p:%p\n" BCYN "[Uploaded %llu bytes]\n" CRESET, (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
||||||
+4
-9
@@ -1,4 +1,3 @@
|
|||||||
#ifdef TUI
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -13,15 +12,15 @@
|
|||||||
#include <palerain.h>
|
#include <palerain.h>
|
||||||
#include <tui.h>
|
#include <tui.h>
|
||||||
|
|
||||||
int redraw_screen(void) {
|
int redraw_screen() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int destroy_window(void) {
|
int destroy_window() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int init_window(void) {
|
int init_window() {
|
||||||
setlocale(LC_ALL, NULL);
|
setlocale(LC_ALL, NULL);
|
||||||
setenv(
|
setenv(
|
||||||
"NEWT_COLORS",
|
"NEWT_COLORS",
|
||||||
@@ -62,7 +61,7 @@ int init_window(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tui(void) {
|
int tui() {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if ((ret = init_window())) return ret;
|
if ((ret = init_window())) return ret;
|
||||||
ret = MAIN_SCREEN;
|
ret = MAIN_SCREEN;
|
||||||
@@ -100,7 +99,3 @@ out:
|
|||||||
tui_started = false;
|
tui_started = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/* ISO C forbids an empty translation unit */
|
|
||||||
extern char** environ;
|
|
||||||
#endif
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
#ifdef TUI
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -13,9 +12,4 @@
|
|||||||
#include <palerain.h>
|
#include <palerain.h>
|
||||||
#include <tui.h>
|
#include <tui.h>
|
||||||
|
|
||||||
tui_screen_t tui_screen_enter_dfu(void) { return JAILBREAKING_SCREEN; }
|
tui_screen_t tui_screen_enter_dfu() { return JAILBREAKING_SCREEN; }
|
||||||
|
|
||||||
#else
|
|
||||||
/* ISO C forbids an empty translation unit */
|
|
||||||
extern char** environ;
|
|
||||||
#endif
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
#ifdef TUI
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -13,9 +12,4 @@
|
|||||||
#include <palerain.h>
|
#include <palerain.h>
|
||||||
#include <tui.h>
|
#include <tui.h>
|
||||||
|
|
||||||
tui_screen_t tui_screen_enter_recovery(void) { return ENTER_DFU_SCREEN; }
|
tui_screen_t tui_screen_enter_recovery() { return ENTER_DFU_SCREEN; }
|
||||||
|
|
||||||
#else
|
|
||||||
/* ISO C forbids an empty translation unit */
|
|
||||||
extern char** environ;
|
|
||||||
#endif
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
#ifdef TUI
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -13,9 +12,4 @@
|
|||||||
#include <palerain.h>
|
#include <palerain.h>
|
||||||
#include <tui.h>
|
#include <tui.h>
|
||||||
|
|
||||||
tui_screen_t tui_screen_jailbreak(void) { return EXIT_SCREEN; }
|
tui_screen_t tui_screen_jailbreak() { return EXIT_SCREEN; }
|
||||||
|
|
||||||
#else
|
|
||||||
/* ISO C forbids an empty translation unit */
|
|
||||||
extern char** environ;
|
|
||||||
#endif
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
#ifdef TUI
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -13,7 +12,7 @@
|
|||||||
#include <palerain.h>
|
#include <palerain.h>
|
||||||
#include <tui.h>
|
#include <tui.h>
|
||||||
|
|
||||||
tui_screen_t tui_screen_main(void) {
|
tui_screen_t tui_screen_main() {
|
||||||
int ret = MAIN_SCREEN;
|
int ret = MAIN_SCREEN;
|
||||||
bool can_start = false;
|
bool can_start = false;
|
||||||
newtCenteredWindow(WIDTH, HEIGHT, NULL);
|
newtCenteredWindow(WIDTH, HEIGHT, NULL);
|
||||||
@@ -46,8 +45,3 @@ tui_screen_t tui_screen_main(void) {
|
|||||||
newtFormDestroy(form);
|
newtFormDestroy(form);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
/* ISO C forbids an empty translation unit */
|
|
||||||
extern char** environ;
|
|
||||||
#endif
|
|
||||||
+11
-15
@@ -1,4 +1,3 @@
|
|||||||
#ifdef TUI
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -22,14 +21,16 @@ void bitfield_check_cb(newtComponent box, void* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tui_screen_t tui_screen_options(void) {
|
tui_screen_t tui_screen_options() {
|
||||||
tui_bit_info_t verbose_info = { &palerain_flags, palerain_option_verbose_boot };
|
tui_bit_info_t verbose_info = { &kpf_flags, checkrain_option_verbose_boot };
|
||||||
tui_bit_info_t rootful_info = { &palerain_flags, palerain_option_rootful };
|
tui_bit_info_t rootful_info = { &palerain_flags, palerain_option_rootful };
|
||||||
tui_bit_info_t setup_rootful_info = { &palerain_flags, palerain_option_setup_rootful };
|
tui_bit_info_t setup_rootful_info = { &palerain_flags, palerain_option_setup_rootful };
|
||||||
tui_bit_info_t force_revert_info = { &palerain_flags, palerain_option_force_revert };
|
tui_bit_info_t force_revert_info = { &checkrain_flags, checkrain_option_force_revert };
|
||||||
tui_bit_info_t safemode_info = { &palerain_flags, palerain_option_safemode };
|
tui_bit_info_t safemode_info = { &checkrain_flags, checkrain_option_safemode };
|
||||||
tui_bit_info_t flower_chain_info = { &palerain_flags, palerain_option_flower_chain };
|
|
||||||
|
|
||||||
|
static checkrain_option_t flower_flags = 0, flower_option_flower_chain = (1 << 0);
|
||||||
|
tui_bit_info_t flower_chain_info = { &flower_flags, flower_option_flower_chain };
|
||||||
|
|
||||||
const char* bootargs_entered = NULL;
|
const char* bootargs_entered = NULL;
|
||||||
int ret = MAIN_SCREEN;
|
int ret = MAIN_SCREEN;
|
||||||
|
|
||||||
@@ -40,11 +41,11 @@ tui_screen_t tui_screen_options(void) {
|
|||||||
newtTextboxSetText(optionsNotice, "You may set the following options. If you don't know what they mean you'll probably have no reason to set them.");
|
newtTextboxSetText(optionsNotice, "You may set the following options. If you don't know what they mean you'll probably have no reason to set them.");
|
||||||
// newtTextboxSetColors(optionsNotice, NEWT_COLORSET_LABEL, NEWT_COLORSET_LABEL);
|
// newtTextboxSetColors(optionsNotice, NEWT_COLORSET_LABEL, NEWT_COLORSET_LABEL);
|
||||||
|
|
||||||
newtComponent verboseBootBox = newtCheckbox(1, 3, "Verbose boot", CHECKBOX_STATE(palerain_flags, palerain_option_verbose_boot), NULL, NULL);
|
newtComponent verboseBootBox = newtCheckbox(1, 3, "Verbose boot", CHECKBOX_STATE(kpf_flags, checkrain_option_verbose_boot), NULL, NULL);
|
||||||
newtComponent rootfulBox = newtCheckbox(1, 4, "Rootful", CHECKBOX_STATE(palerain_flags, palerain_option_rootful), NULL, NULL);
|
newtComponent rootfulBox = newtCheckbox(1, 4, "Rootful", CHECKBOX_STATE(palerain_flags, palerain_option_rootful), NULL, NULL);
|
||||||
newtComponent rootfulSetupBox = newtCheckbox(1, 5, "Setup fakefs", CHECKBOX_STATE(palerain_flags, palerain_option_setup_rootful), NULL, NULL);
|
newtComponent rootfulSetupBox = newtCheckbox(1, 5, "Setup fakefs", CHECKBOX_STATE(palerain_flags, palerain_option_setup_rootful), NULL, NULL);
|
||||||
newtComponent forceRevertBox = newtCheckbox(1, 6, "Restore system", CHECKBOX_STATE(palerain_flags, palerain_option_force_revert), NULL, NULL);
|
newtComponent forceRevertBox = newtCheckbox(1, 6, "Restore system", CHECKBOX_STATE(checkrain_flags, checkrain_option_force_revert), NULL, NULL);
|
||||||
newtComponent safeModeBox = newtCheckbox(1, 7, "Safe mode", CHECKBOX_STATE(palerain_flags, palerain_option_safemode), NULL, NULL);
|
newtComponent safeModeBox = newtCheckbox(1, 7, "Safe mode", CHECKBOX_STATE(checkrain_flags, checkrain_option_safemode), NULL, NULL);
|
||||||
|
|
||||||
newtComponentAddCallback(verboseBootBox, bitfield_check_cb, &verbose_info);
|
newtComponentAddCallback(verboseBootBox, bitfield_check_cb, &verbose_info);
|
||||||
newtComponentAddCallback(rootfulBox, bitfield_check_cb, &rootful_info);
|
newtComponentAddCallback(rootfulBox, bitfield_check_cb, &rootful_info);
|
||||||
@@ -55,7 +56,7 @@ tui_screen_t tui_screen_options(void) {
|
|||||||
newtComponent bootCmdlineLabel = newtLabel(1, 8, "Kernel command line:");
|
newtComponent bootCmdlineLabel = newtLabel(1, 8, "Kernel command line:");
|
||||||
newtComponent bootCmdlineEntry = newtEntry(1, 9, &xargs_cmd[6], WIDTH - 2, &bootargs_entered, NEWT_ENTRY_SCROLL);
|
newtComponent bootCmdlineEntry = newtEntry(1, 9, &xargs_cmd[6], WIDTH - 2, &bootargs_entered, NEWT_ENTRY_SCROLL);
|
||||||
|
|
||||||
newtComponent flowerChainBox = newtCheckbox(1, 10, "Flower chain", CHECKBOX_STATE(palerain_flags, palerain_option_flower_chain), NULL, NULL);
|
newtComponent flowerChainBox = newtCheckbox(1, 10, "Flower chain", CHECKBOX_STATE(flower_flags, flower_option_flower_chain), NULL, NULL);
|
||||||
newtComponentAddCallback(flowerChainBox, bitfield_check_cb, &flower_chain_info);
|
newtComponentAddCallback(flowerChainBox, bitfield_check_cb, &flower_chain_info);
|
||||||
|
|
||||||
|
|
||||||
@@ -74,8 +75,3 @@ tui_screen_t tui_screen_options(void) {
|
|||||||
newtFormDestroy(form);
|
newtFormDestroy(form);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
/* ISO C forbids an empty translation unit */
|
|
||||||
extern char** environ;
|
|
||||||
#endif
|
|
||||||
@@ -24,7 +24,6 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef USE_LIBUSB
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h> // open
|
#include <fcntl.h> // open
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@@ -251,7 +250,3 @@ int wait_for_pongo(void) {
|
|||||||
CFRelease(cfdict);
|
CFRelease(cfdict);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/* ISO C forbids an empty translation unit */
|
|
||||||
extern char** environ;
|
|
||||||
#endif
|
|
||||||
@@ -264,7 +264,4 @@ int wait_for_pongo(void)
|
|||||||
libusb_exit(ctx);
|
libusb_exit(ctx);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/* ISO C forbids an empty translation unit */
|
|
||||||
extern char** environ;
|
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user