diff --git a/payloads/library/GitBunnyGit/README.md b/payloads/library/GitBunnyGit/README.md index 26f2e31c..6a1ee439 100644 --- a/payloads/library/GitBunnyGit/README.md +++ b/payloads/library/GitBunnyGit/README.md @@ -5,7 +5,7 @@ Version: 1.0 ## Description -Clones the bashbunny-payloads repository and also will update an existing repository. +Clones the bashbunny-payloads repository and also will update an existing repository. Use this payload to get all the other payloads! ## Configuration @@ -13,7 +13,7 @@ Configured for nix by default. Swap RNDIS_ETHERNET with ECM_ETHERNET on Windows ## Requirements -Target must be sharing internet. +Target must be sharing internet. BashBunny must have git installed. 1. Run bb.sh (pause at main menu) 2. Plug in da bunny diff --git a/payloads/library/GitBunnyGit/payload.txt b/payloads/library/GitBunnyGit/payload.txt index 5150f8e6..7e7a9706 100644 --- a/payloads/library/GitBunnyGit/payload.txt +++ b/payloads/library/GitBunnyGit/payload.txt @@ -18,19 +18,20 @@ 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" -log_file="/root/udisk/payloads/$SWITCH_POSITION/git.log" +log_file="/var/log/git.log" -echo "Git Bunny Git" > $log_file +echo " --------- Git Bunny Git [started] -----------" >> $log_file + +# Sanity check on mounted drive +[[ ! `mount | grep "nandf"` ]] && { LED R 200; echo "Could not mount filesystem" >> $log_file; exit 1; } # Test for internet connection wget -q --tries=15 --timeout=5 --spider http://example.com -[[ "$?" -ne 0 ]] && { LED R; exit 1; } +[[ "$?" -ne 0 ]] && { LED R; echo "Could not connect to the internet" >> $log_file; exit 1; } # Let's go LED R G @@ -41,27 +42,34 @@ export GIT_SSL_NO_VERIFY=1 if [ -d ".git" ]; then # Get the newest payloads git pull origin $git_branch &>> $log_file + echo "Git repository updated." >> $log_file LED G 200 - exit 1 else # Move the existing payloads directory, in case hackers be hackin' mv payloads payloads-orig + echo "Existing 'payloads' directory preserved as 'payloads-orig'" >> $log_file # Initialize Repository git init &>> $log_file # Let's pick the hak5 github repo git remote add origin $git_repo &>> $log_file + echo "Git repository selected: $git_repo" >> $log_file # Instead of cloning the whole repo, git config core.sparsecheckout true + echo "Git configuration change: sparse-checkout=true." >> $log_file # isolate the payloads directory echo "payloads" >> .git/info/sparse-checkout + echo "Sparse checkout: 'payloads' directory selected" >> $log_file # "git clone" git pull origin $git_branch &>> $log_file + echo "Git repository cloned." >> $log_file - # Ignore any existing directories or files, so git status is pretty + # Ignore any existing directories or files, so git status is pretty, and git pull will work after the "clone" LED R B for file in $(ls -A); do - [[ "${file}" =~ [^payloads$] ]] && echo "${file}" >> .gitignore + [[ "${file}" =~ [^payloads$] ]] && { echo "${file}" >> .gitignore; echo ".gitignore add: ${file}" >> $log_file; } done + echo "payloads/switch*" >> .gitignore + echo ".gitignore add: payloads/switch*" >> $log_file; # Put the existing switch directories back cp -r payloads-orig/switch* payloads/. @@ -69,3 +77,4 @@ else # Git 'er done LED G fi +echo " --------- Git Bunny Git [finished] ----------" >> $log_file