made some edits

* removed the paranoia mount. we don't need to test that the kernel
is doing it's job when mount fstab

* log to a persistent location

* edited ignore loop to include hidden directories
This commit is contained in:
Alex Flores 2017-03-15 15:02:47 -04:00
parent d1598208c2
commit da987207f6

View File

@ -18,62 +18,54 @@ LED R G B
ATTACKMODE RNDIS_ETHERNET ATTACKMODE RNDIS_ETHERNET
#ATTACKMODE ECM_ETHERNET #ATTACKMODE ECM_ETHERNET
source bunny_helpers.sh
# Set your desired repo url and branch if you're not looking to update from mainline # Set your desired repo url and branch if you're not looking to update from mainline
git_repo="https://github.com/hak5/bashbunny-payloads.git" git_repo="https://github.com/hak5/bashbunny-payloads.git"
git_branch="master" git_branch="master"
payloads_dir="/root/udisk" payloads_dir="/root/udisk"
echo "Git Bunny Git" >> /tmp/git log_file="/root/udisk/payloads/$SWITCH_POSITION/git.log"
echo "Git Bunny Git" > $log_file
# Test for internet connection # Test for internet connection
wget -q --tries=15 --timeout=5 --spider http://example.com wget -q --tries=15 --timeout=5 --spider http://example.com
[[ "$?" -ne 0 ]] && { LED R; exit 1; } [[ "$?" -ne 0 ]] && { LED R; exit 1; }
# Let's go (`tail -f /tmp/git` to monitor progress) # Let's go
LED R G LED R G
cd $payloads_dir cd $payloads_dir
# Paranoid mount
if [ `ls $payloads_dir | wc -l` -eq 0 ]; then
mount -o sync /dev/nandf $payloads_dir
cd $payloads_dir
if [ `ls $payloads_dir | wc -l` -eq 0 ]; then
LED R 200
exit 1
fi
fi
# Cannot verify ca certificate... skip it # Cannot verify ca certificate... skip it
export GIT_SSL_NO_VERIFY=1 export GIT_SSL_NO_VERIFY=1
if [ -d ".git" ]; then if [ -d ".git" ]; then
# Get the newest payloads # Get the newest payloads
git pull origin $git_branch &>> /tmp/git git pull origin $git_branch &>> $log_file
LED G 200 LED G 200
exit 1 exit 1
else else
# Move the existing payloads directory, in case hackers be hackin' # Move the existing payloads directory, in case hackers be hackin'
mv payloads payloads-orig mv payloads payloads-orig
# Initialize Repository # Initialize Repository
git init &>> /tmp/git git init &>> $log_file
# Let's pick the hak5 github repo # Let's pick the hak5 github repo
git remote add origin $git_repo &>> /tmp/git git remote add origin $git_repo &>> $log_file
# Instead of cloning the whole repo, # Instead of cloning the whole repo,
git config core.sparsecheckout true git config core.sparsecheckout true
# isolate the payloads directory # isolate the payloads directory
echo "payloads" >> .git/info/sparse-checkout echo "payloads" >> .git/info/sparse-checkout
# "git clone" # "git clone"
git pull origin $git_branch &>> /tmp/git git pull origin $git_branch &>> $log_file
# Ignore any existing directories or files, so git status is pretty # Ignore any existing directories or files, so git status is pretty
LED R B LED R B
for ignore_existing in *; do for file in $(ls -A); do
if [[ "${ignore_existing}" =~ [^payloads$] ]]; then [[ "${file}" =~ [^payloads$] ]] && echo "${file}" >> .gitignore
echo "${ignore_existing}" >> .gitignore
fi
done done
# Put the existing payloads back # Put the existing switch directories back
cp -r payloads-orig/switch* payloads/. cp -r payloads-orig/switch* payloads/.
# Git 'er done # Git 'er done
LED G LED G
fi fi