2026-01-30 14:05:07 -07:00
|
|
|
# # -Cpanic=immediate-abort
|
|
|
|
|
# RUSTFLAGS="-Zunstable-options -Zlocation-detail=none -Zfmt-debug=none" \
|
|
|
|
|
# cargo +nightly build \
|
|
|
|
|
# -Z build-std=std,panic_abort \
|
|
|
|
|
# -Z build-std-features= \
|
|
|
|
|
# --profile minimize -p unshell-payload -- $@
|
|
|
|
|
|
2026-02-20 18:17:11 -07:00
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
OBFUSCATION_KEY=kjwerkwerkjbwejehrwhje \
|
2026-06-01 13:08:26 -06:00
|
|
|
# RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" \
|
|
|
|
|
cargo build --profile minimize -p endpoint_test $@
|
2026-01-30 14:05:07 -07:00
|
|
|
|
2026-06-01 13:08:26 -06:00
|
|
|
export BINARY=./target/minimize/endpoint_test
|
2026-01-30 14:05:07 -07:00
|
|
|
|
|
|
|
|
declare -a headers=(
|
|
|
|
|
".gnu_debuglink" # - Debug information link
|
|
|
|
|
".comment" #- Compiler version info
|
|
|
|
|
".shstrtab" #- Section header string table (only needed by tools like readelf)
|
|
|
|
|
".note.gnu.bu" ".note.gnu.build-id" # - Build ID note
|
|
|
|
|
".eh_frame" ".eh_frame_hdr" # Exception handling info (can break C++ exceptions if removed)
|
|
|
|
|
#".gnu.version" ".gnu.version_r" # Symbol versioning (may be needed for some shared libraries)
|
|
|
|
|
".gnu.hash" # Hash table for symbol lookup optimization
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# TODO: Implement FAKE section header comments and information
|
|
|
|
|
# Shuffle order of headers??
|
|
|
|
|
|
|
|
|
|
for section in "${headers[@]}"
|
|
|
|
|
do
|
|
|
|
|
strip --remove-section="$section" $BINARY
|
2026-04-25 11:36:10 -06:00
|
|
|
# echo "Removed section header $section"
|
2026-01-30 14:05:07 -07:00
|
|
|
done
|
2026-02-09 10:27:15 -07:00
|
|
|
|
2026-04-25 11:36:10 -06:00
|
|
|
echo "Binary size: $(wc -c $BINARY)"
|
2026-02-09 10:27:15 -07:00
|
|
|
|
2026-04-25 11:36:10 -06:00
|
|
|
# $BINARY
|