refactor: libciderra1n support (#764)

* refactor

refactor: remove wdi

refactor: move openra1n to its own library

refactor: move everything standalone file to src root

* submodule

* okay these shouldnt of been included

* remove

* readd

* fix openra1n libusb

* liteusb for ra1ncovery

* fix action

* token

* whatever lwra bw apwxidix

* I knew this was gonna happen

* fix mac build

* what if this doesnt work

* okay bro

* lzma resources

* rename

* use idevice++, fix multiple devices, enter recovery

* whatever

* fix

* --force-enable-ssv

* improve exploit stuff, mirror tui logic to gui

also cooool logging for libopenra1n

* fix idevice windows build

* lets not be fancy

* new idevice patch

* easier to read

* lets hope this action works!

* remove useless ifs

* not required for non tui

* PLEASE COMPILE

* gsed lmao

* this might work idk

* whatever bro

* ah

* amd fix

* fix ts

* fix

* licensing

* update paleinfo

* LETS NOT do that

* forgot a file
This commit is contained in:
c authored and GitHub committed 2026-07-21 20:22:02 -07:00
1 parent f15011828b
commit 0cf2c6492f
128 files changed
+12054 -3114

No files matched your search

+77 -47
View File
@@ -1,3 +1,30 @@
/*
* palera1n - https://palera.in
*
* Copyright (C) 2026 palera1n team
*
* SPDX-License-Identifier: MIT
*
* 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.
*
*/
#include <unistd.h>
#include <cstdlib>
#include <iostream>
@@ -5,29 +32,34 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <inttypes.h> // PRIx64
#ifdef WITH_GUI
# include <wx/wx.h>
#endif
#include "m8/run.h"
#include "exploit.h"
#ifdef WITH_TUI
# include "tui/Tui.hpp"
#endif
#include "utils.h"
#if WITH_CIDERRAIN
# include <ciderra1n/log.h>
extern "C" {
# include <ciderra1n/ra1n.h>
}
#else
# include <openra1n/utils.h>
#endif
#include "globals.h"
#include "paleinfo.h"
#ifdef _WIN32
# include "usb/driver.h"
#endif
#include "usb/pongo_helper.h"
#include "pongo_helper.h"
void print_credits() {
printf(
"::\n"
":: Palera1n beta " PALERAIN_VERSION "\n"
"::\n"
":: (c) 2026\n"
":: Copyright (C) 2026 palera1n team\n"
"::\n"
":: ======== Made by =======>\n"
":: Made by: asdfugil, kok3shidoll, claration, mineek\n"
@@ -57,6 +89,7 @@ void print_usage(char* argv) {
#endif
" --dark-blockchain [f] Enable dark blockchain\n"
" --force-revert [f] Force environment reversion\n"
" --force-enable-ssv [f] Force SSV detection to result in YES\n"
" -l, --rootless [f] Enable rootless mode (standard)\n"
" -f, --rootful [f] Boots fakefs\n"
" -c, --setup-fakefs [f] Setup fake filesystem\n"
@@ -70,12 +103,9 @@ void print_usage(char* argv) {
" -K, --override-kpf <FILE PATH> Override kernel patchfinder\n"
" -o, --override-overlay <FILE PATH> Override overlay\n"
" -r, --override-ramdisk <FILE PATH> Override ramdisk\n"
" -d, --debug-logging Enable debug logging\n"
" -n, --no-colors [f] Disable colors on the command line\n"
" -q, --quick [f] Enable Quick Mode\n"
#ifdef _WIN32
" --install-drivers <PID> Install libusbK drivers for PID\n"
" --remove-drivers <PID> Remove libusbK drivers for PID\n"
#endif
, argv
);
@@ -103,6 +133,7 @@ void parse_arguments(int argc, char* argv[]) {
#endif
{"dark-blockchain", no_argument, NULL, 4},
{"force-revert", no_argument, NULL, 5},
{"force-enable-ssv", no_argument, NULL, 6},
{"rootless", no_argument, NULL, 'l'},
{"rootful", no_argument, NULL, 'f'},
{"setup-fakefs", no_argument, NULL, 'c'},
@@ -116,12 +147,9 @@ void parse_arguments(int argc, char* argv[]) {
{"override-kpf", required_argument, NULL, 'K'},
{"override-overlay", required_argument, NULL, 'o'},
{"override-ramdisk", required_argument, NULL, 'r'},
{"debug-logging", no_argument, NULL, 'd'},
{"no-colors", no_argument, NULL, 'n'},
{"quick", no_argument, NULL, 'q'},
#ifdef _WIN32
{"install-drivers", required_argument, NULL, 6},
{"remove-drivers", required_argument, NULL, 7},
#endif
{NULL, 0, NULL, 0}
};
@@ -149,19 +177,26 @@ void parse_arguments(int argc, char* argv[]) {
# endif
#endif
while ((options = getopt_long(argc, argv, "hvlfcBsTVpe:k:K:o:r:nq", long_options, &option_index)) != -1) {
while ((options = getopt_long(argc, argv, "hvlfcBsTVpe:k:K:o:r:dnq", long_options, &option_index)) != -1) {
switch (options) {
case 'h': // --help
print_usage(argv[0]);
exit(1);
case 'v': // --version
printf("Palera1n beta " PALERAIN_VERSION " [USB: %s (openra1n)]\n",
#if WITH_CIDERRAIN
printf("Palera1n beta " PALERAIN_VERSION " [USB: %s (libcidera1n %s)]\n",
ra1n_show_usb_backend(),
ra1n_show_build_version()
);
#else
printf("Palera1n beta " PALERAIN_VERSION " [USB: %s (libopenra1n)]\n",
#ifdef __APPLE__
"IOKit"
#else
"libusb"
#endif
);
#endif
printf("%s (%s)\n", GIT_HASH, GIT_BRANCH);
printf("Git: %s\n", GIT_URL);
printf("Compiled on %s at %s\n", __DATE__, __TIME__);
@@ -191,6 +226,9 @@ void parse_arguments(int argc, char* argv[]) {
case 5: // --force-revert
palerain_flags |= palerain_option_force_revert;
break;
case 6: // --force-enable-ssv
palerain_flags |= palerain_option_ssv;
break;
case 'l': // --rootless
palerain_flags &= ~palerain_option_rootful;
palerain_flags |= palerain_option_rootless;
@@ -219,25 +257,25 @@ void parse_arguments(int argc, char* argv[]) {
break;
case 'e': // --extra-bootargs
if (strlen(optarg) > (sizeof(boot_args) - 0x20)) {
LOG_ERROR("Boot arguments too long");
LOG_ERROR("Boot arguments too long!");
exit(1);
}
snprintf(boot_args, sizeof(boot_args), "%s", optarg);
break;
case 'k': // --override-pongo
if (!override_payload_from_file(optarg, &g_payload_pongo)) {
LOG_ERROR("Failed to load pongo payload\n");
LOG_ERROR("Failed to load pongo payload, is the path correct?");
exit(1);
}
if (g_payload_pongo.data_len > PONGO_MAX_SZ) {
LOG_ERROR("Pongo payload too large: %zu bytes (max %zu)", g_payload_pongo.data_len, PONGO_MAX_SZ);
LOG_ERROR("Pongo payload is too large! %zu bytes (max %zu)", g_payload_pongo.data_len, PONGO_MAX_SZ);
exit(1);
}
LOG("Overriding pongo payload with %s", optarg);
break;
case 'K': // --override-kpf
if (!override_payload_from_file(optarg, &g_payload_kpf)) {
LOG_ERROR("Failed to load kpf payload\n");
LOG_ERROR("Failed to load kpf payload, is the path correct?");
exit(1);
}
if (g_payload_kpf.data_len < 4
@@ -251,44 +289,27 @@ void parse_arguments(int argc, char* argv[]) {
break;
case 'o': // --override-overlay
if (!override_payload_from_file(optarg, &g_payload_overlay)) {
LOG_ERROR("Failed to load overlay payload\n");
LOG_ERROR("Failed to load overlay payload, is the path correct?");
exit(1);
}
LOG("Overriding overlay payload with %s", optarg);
break;
case 'r': // --override-ramdisk
if (!override_payload_from_file(optarg, &g_payload_ramdisk)) {
LOG_ERROR("Failed to load ramdisk payload\n");
LOG_ERROR("Failed to load ramdisk payload, is the path correct?");
exit(1);
}
LOG("Overriding ramdisk payload with %s", optarg);
break;
case 'd': // --debug-logging
if (gDebugLevel < 5) gDebugLevel++;
break;
case 'n': // --no-colors
palerain_flags |= palerain_option_no_colors;
break;
case 'q': // --quick
palerain_flags |= palerain_option_quick;
break;
#ifdef _WIN32
case 6: { // --install-drivers <PID>
unsigned short parsed_pid = (unsigned short)strtol(optarg, NULL, 16);
if (parsed_pid == 0) {
LOG_ERROR("Invalid PID value provided\n");
exit(1);
}
install_libusbk_target(0x05AC, parsed_pid);
exit(0);
}
case 7: { // --remove-drivers <PID>
unsigned short parsed_pid = (unsigned short)strtol(optarg, NULL, 16);
if (parsed_pid == 0) {
LOG_ERROR("Invalid PID value provided\n");
exit(1);
}
uninstall_libusbk_target(0x05AC, parsed_pid);
exit(0);
}
#endif
case '?':
LOG_ERROR("Unknown option\n");
print_usage(argv[0]);
@@ -345,17 +366,24 @@ void parse_arguments(int argc, char* argv[]) {
exit(1);
}
}
// controls logging settings in our checkm8 libraries
if (palerain_flags & palerain_option_no_colors) gSilentLogs = false;
if (palerain_flags & palerain_option_tui) gSilentLogs = true;
}
int main(int argc, char* argv[], char* envp[]) {
print_credits();
parse_arguments(argc, argv);
LOG("palera1n_flags: %llu", palerain_flags);
LOG("Welcome to palera1n!");
LOG("Reminder, this jailbreak IS designed for iOS 15+");
LOG_DEBUG("palera1n_flags: 0x%" PRIx64, palerain_flags);
// communicating with libusb on linux needs root
#ifdef __linux__
if (geteuid() != 0) {
LOG_WARN("You are not running as root, this may cause issues when exploiting");
LOG_ERROR("You are not running as root, this may cause issues when exploiting...");
}
#endif
@@ -384,6 +412,8 @@ int main(int argc, char* argv[], char* envp[]) {
}
#endif
shared_t state{};
return exploit(&state);
int stage;
bool ret = exploit(&stage);
LOG("Thank you for using palera1n!");
return ret;
}