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
pull/58/head^2
Alex Flores 2017-03-15 15:02:47 -04:00
parent d1598208c2
commit da987207f6
1 changed files with 14 additions and 22 deletions

View File

@ -18,60 +18,52 @@ LED R G B
ATTACKMODE RNDIS_ETHERNET
#ATTACKMODE ECM_ETHERNET
source bunny_helpers.sh
# 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_branch="master"
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
wget -q --tries=15 --timeout=5 --spider http://example.com
[[ "$?" -ne 0 ]] && { LED R; exit 1; }
# Let's go (`tail -f /tmp/git` to monitor progress)
# Let's go
LED R G
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
export GIT_SSL_NO_VERIFY=1
if [ -d ".git" ]; then
# Get the newest payloads
git pull origin $git_branch &>> /tmp/git
git pull origin $git_branch &>> $log_file
LED G 200
exit 1
else
# Move the existing payloads directory, in case hackers be hackin'
mv payloads payloads-orig
# Initialize Repository
git init &>> /tmp/git
git init &>> $log_file
# 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,
git config core.sparsecheckout true
# isolate the payloads directory
echo "payloads" >> .git/info/sparse-checkout
# "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
LED R B
for ignore_existing in *; do
if [[ "${ignore_existing}" =~ [^payloads$] ]]; then
echo "${ignore_existing}" >> .gitignore
fi
for file in $(ls -A); do
[[ "${file}" =~ [^payloads$] ]] && echo "${file}" >> .gitignore
done
# Put the existing payloads back
# Put the existing switch directories back
cp -r payloads-orig/switch* payloads/.
# Git 'er done