mirror of
https://github.com/badsectorlabs/copyfail-go.git
synced 2026-05-16 14:38:09 +00:00
✨feat: allow binary exec and improve documentation
- Added new shellcode payloads for exec-argv1 and exec-bin-sh for amd64, i386, and aarch64 architectures. - Introduced a backup feature for the su binary before overwriting it. - Enhanced README.md with usage instructions and details about affected kernels. - Added build-n-print.sh script for building and printing payloads in hex format.
This commit is contained in:
parent
e52acbb172
commit
131f7d1842
12 changed files with 552 additions and 63 deletions
37
payloads/build-n-print.sh
Normal file
37
payloads/build-n-print.sh
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check for nasm
|
||||
if ! command -v nasm &> /dev/null; then
|
||||
echo "[!] nasm could not be found. Please install it."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for python3
|
||||
if ! command -v python3 &> /dev/null; then
|
||||
echo "[!] python3 could not be found. Please install it."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for payload in *.asm; do
|
||||
echo "[+] Building $payload"
|
||||
nasm -f bin $payload -o ${payload%.asm}
|
||||
echo "[+] Printing $payload as hex"
|
||||
cat ${payload%.asm} | python3 -c 'import sys, zlib; print(zlib.compress(sys.stdin.buffer.read()).hex())'
|
||||
done
|
||||
|
||||
# Check for aarch64-linux-gnu-as
|
||||
if ! command -v aarch64-linux-gnu-as &> /dev/null; then
|
||||
echo "[!] aarch64-linux-gnu-as could not be found. Please install binutils-aarch64-linux-gnu"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for payload in *.S; do
|
||||
# Assemble the source into an object file
|
||||
echo "[+] Building $payload"
|
||||
aarch64-linux-gnu-as $payload -o ${payload%.S}.o
|
||||
# Extract ONLY the raw bytes into a flat binary file
|
||||
echo "[+] Extracting $payload as binary"
|
||||
aarch64-linux-gnu-objcopy -O binary ${payload%.S}.o ${payload%.S}
|
||||
echo "[+] Printing $payload as hex"
|
||||
cat ${payload%.S} | python3 -c 'import sys, zlib; print(zlib.compress(sys.stdin.buffer.read()).hex())'
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue