-
Notifications
You must be signed in to change notification settings - Fork 180
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·145 lines (124 loc) · 4.88 KB
/
Copy pathstart.sh
File metadata and controls
executable file
·145 lines (124 loc) · 4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
# tr4mpass -- Guided activation lock bypass wrapper
# Cross-platform OS detection, dependency installation, device
# detection, DFU guidance, and bypass execution.
#
# The helper routines live in start-helpers.sh so this driver stays
# under the project's 300-line-per-file limit.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BINARY="$SCRIPT_DIR/tr4mpass"
HELPERS="$SCRIPT_DIR/start-helpers.sh"
# ------------------------------------------------------------------ #
# ANSI colors (needed by helpers, so initialize before sourcing). #
# ------------------------------------------------------------------ #
if [ -t 1 ]; then
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
CYAN='\033[0;36m'
BOLD='\033[1m'
RESET='\033[0m'
else
RED='' GREEN='' YELLOW='' CYAN='' BOLD='' RESET=''
fi
# ------------------------------------------------------------------ #
# pkg-config dependency list. libssh2 is consumed by the Phase 2C #
# SSH jailbreak path; if the distro package is missing at build time #
# the production link will fail with "library not found for -lssh2". #
# Install hints are provided by the helpers for every platform. #
# ------------------------------------------------------------------ #
PKGCONFIG_DEPS=(
"libimobiledevice-1.0"
"libirecovery-1.0"
"libusb-1.0"
"libplist-2.0"
"openssl"
"libcurl"
"libssh2"
)
# ------------------------------------------------------------------ #
# Source helper functions. #
# ------------------------------------------------------------------ #
if [ ! -f "$HELPERS" ]; then
printf "[-] Missing %s -- aborting.\n" "$HELPERS" >&2
exit 1
fi
# shellcheck source=start-helpers.sh
. "$HELPERS"
# ------------------------------------------------------------------ #
# Main #
# ------------------------------------------------------------------ #
main() {
print_banner
detect_os
install_deps
build_project
echo ""
echo "----------------------------------------"
if ! wait_for_device; then
msg_info "Tip: Check your USB cable and try a different port."
exit 1
fi
# Only parse detailed info if device is in normal mode
# (DFU mode devices cannot be queried via lockdownd).
if [ "$DEVICE_MODE" = "normal" ]; then
msg_info "Querying device information..."
parse_device_info
display_device_info
gate_support
else
# DFU mode -- query CPID from serial descriptor to determine path
msg_info "Device in DFU mode. Querying chip info..."
parse_device_info
# Derive real support status from parsed CPID
if [ -z "$DEV_CPID" ] || [ "$DEV_CPID" = "0x0000" ]; then
msg_warn "Chip ID could not be read from DFU serial descriptor."
msg_info "This usually means the device is not in true SecureROM DFU mode."
msg_info "Re-enter DFU mode using the precise button sequence and try again."
msg_info " Home button: Power+Home 10s, release Power, hold Home 5s"
msg_info " Face ID: Vol-Up, Vol-Down, hold Side to black screen,"
msg_info " Side+Vol-Down 5s, release Side, hold Vol-Down 10s"
msg_info "Screen must stay completely BLACK (no Apple logo)."
exit 1
fi
echo ""
echo "========================================"
echo " Device Information"
echo "========================================"
printf " %-12s %s\n" "Mode:" "DFU"
printf " %-12s %s\n" "Chip:" "${DEV_CHIP_NAME:-(unknown)} (CPID: ${DEV_CPID:-(unknown)})"
printf " %-12s %s\n" "Bypass:" "$DEV_BYPASS"
printf " %-12s %s\n" "Status:" "$DEV_STATUS"
echo "========================================"
echo ""
if [ "$DEV_STATUS" = "UNSUPPORTED" ]; then
msg_err "UNSUPPORTED: Device chip could not be identified or is not in the chip database."
msg_info "This tool supports A5 through A17 chips."
exit 1
fi
msg_ok "Device is supported. Ready to proceed."
printf "${BOLD}Press Enter to start bypass...${RESET}"
read -r
fi
echo ""
msg_info "Starting tr4mpass..."
echo ""
# Final validation before exec.
if [ ! -e "$BINARY" ]; then
msg_err "Binary not found at $BINARY. Build may have failed."
msg_info "Run 'make' manually to see errors."
exit 1
fi
if [ -d "$BINARY" ]; then
msg_err "Expected binary at $BINARY but found a directory."
msg_info "Remove it and rebuild: rm -rf '$BINARY' && make clean && make"
exit 1
fi
if [ ! -x "$BINARY" ]; then
msg_err "Binary exists but is not executable. Run: chmod +x $BINARY"
exit 1
fi
exec "$BINARY" "$@"
}
main "$@"