Payload to automatically set up/update git repo

This payload was made in collaboration with audibleblink through irc. We both came up with the same idea, but I took it a step further, by adding a git-pull/update after the first payload execution. Original repo at https://github.com/mathew-fleisch/Git-Bunny-Git
This commit is contained in:
Mathew Fleisch 2017-03-14 21:43:53 -07:00 committed by GitHub
parent 155d90bb23
commit d094d2c6e0
2 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,36 @@
# Git-Bunny-Git
Author: Draxiom & audibleblink
Version: 1.0
## Description
Clones the bashbunny-payloads repository and also will update an existing repository.
If you modify your payloads from the library folder, they will be overwritten.
For now, I recommend either renaming modifiied payloads
or storing them in your own forked repo and using your link/branch in the payload.
## Configuration
Configured for *nix by default. Swap RNDIS_ETHERNET with ECM_ETHERNET on Windows
## Requirements
Target must be sharing internet.
1. Run bb.sh (pause at main menu)
2. Plug in da bunny
3. Connect (type 'c') 5 seconds after the white light
4. You can now ssh into the bunny (Run `tail -f /tmp/git` to montior progress)
## Status
| LED | Status |
| ---------------- | ------------------------------------- |
| White | Ready (to share internet connection) |
| Red | Failed (no internet) |
| Red (blinking) | Failed (could not mount filesystem) |
| Amber | Running |
| Purple | Cleaning Up |
| Green (blinking) | Finished (git pull) |
| Green | Finished (git clone) |

View File

@ -0,0 +1,83 @@
#!/bin/bash
# Title: Git Bunny Git
# Author: Draxiom && audibleblink
# Target: any
# Version: 1.0
#
# Update payloads from Github
#
# White | Ready (to run bb.sh on the host computer)
# Red | No Internet
# Red (blinking) | Could not mount filesystem
# Amber | Running
# Green (blinking) | Git Pull Finished
# Green | Git Clone Finished
LED R G B
ATTACKMODE RNDIS_ETHERNET
#ATTACKMODE ECM_ETHERNET
# 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"
touch /tmp/git
echo "Git Bunny Git" >> /tmp/git
# 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)
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 2>> /tmp/git
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 2>> /tmp/git
# Let's pick the hak5 github repo
git remote add origin $git_repo >> /tmp/git 2>> /tmp/git
# 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 2>> /tmp/git
# 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
done
# Put the existing payloads back
cp -r payloads-orig/switch* payloads/.
# Show Purple... cause
sleep 1
# Git 'er done
LED G
fi