48 lines
1.4 KiB
Bash
Executable File
48 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
output_dir="${OUTPUT_DIR:-$repo_root/build}"
|
|
zig_bin="${ZIG_BIN:-zig}"
|
|
|
|
if ! command -v "$zig_bin" >/dev/null 2>&1; then
|
|
echo "Zig not found. Set ZIG_BIN=/absolute/path/to/zig." >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$output_dir"
|
|
echo "Using: $($zig_bin version)"
|
|
|
|
"$zig_bin" cc \
|
|
-target arm-linux-musleabi \
|
|
-static -O0 -marm -pthread -fno-stack-protector \
|
|
-I"$repo_root/src/exploit/stub" \
|
|
-I"$repo_root/src/exploit/common" \
|
|
-I"$repo_root/src/exploit/expIov" \
|
|
"$repo_root/src/exploit/root-main.c" \
|
|
"$repo_root/src/exploit/expIov/iov_exp_main.c" \
|
|
"$repo_root/src/exploit/common/kallsyms.c" \
|
|
"$repo_root/src/exploit/common/exp_sys_call.c" \
|
|
"$repo_root/src/exploit/common/getroot.c" \
|
|
-o "$output_dir/hp-slate7-cve-2015-1805-root"
|
|
|
|
"$zig_bin" cc \
|
|
-target arm-linux-musleabi \
|
|
-static -Os -marm -s \
|
|
"$repo_root/src/installer/install-root.c" \
|
|
-o "$output_dir/hp-slate7-install-root"
|
|
|
|
"$zig_bin" cc \
|
|
-target arm-linux-musleabi \
|
|
-static -nostdlib -Wl,-e,_start -Wl,--build-id=none -s \
|
|
"$repo_root/src/su/rootsh.S" \
|
|
-o "$output_dir/hp-slate7-su"
|
|
|
|
chmod 755 "$output_dir"/hp-slate7-*
|
|
|
|
if command -v shasum >/dev/null 2>&1; then
|
|
shasum -a 256 "$output_dir"/hp-slate7-*
|
|
else
|
|
sha256sum "$output_dir"/hp-slate7-*
|
|
fi
|