Merge pull request #7 from kevthehermit/DuckToolkit

Add Ducktoolkit Lib and Languages
pull/16/head
appelbaum 2017-03-06 19:37:01 -08:00 committed by GitHub
commit a19743d064
4 changed files with 110 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,93 @@
#!/usr/bin/env bash
# Based on bashbunnypayloads installer
# https://github.com/hak5/bashbunny-payloads/blob/master/payloads/library/tools_installer/install.sh
##
# Switch Position
##
check_switch() {
switch1=`cat /sys/class/gpio_sw/PA8/data`
switch2=`cat /sys/class/gpio_sw/PL4/data`
switch3=`cat /sys/class/gpio_sw/PL3/data`
if [ "x$switch1" = "x0" ] && [ "x$switch2" = "x1" ] && [ "x$switch3" = "x1" ]; then
SWITCH_POSITION="switch1"
elif [ "x$switch1" = "x1" ] && [ "x$switch2" = "x0" ] && [ "x$switch3" = "x1" ]; then
SWITCH_POSITION="switch2"
elif [ "x$switch1" = "x1" ] && [ "x$switch2" = "x1" ] && [ "x$switch3" = "x0" ]; then
SWITCH_POSITION="switch3"
else
SWITCH_POSITION="invalid"
fi
}
check_switch
TARGET_DIR='/root/tools'
RELEASE_ARCHIVE=$(find /root/udisk/payloads/${SWITCH_POSITION} -name DuckToolkit-*)
echo "Install Log:" > /tmp/duck_installer.log
echo "----------------" >> /tmp/duck_installer.log
if [ -f ${RELEASE_ARCHIVE} ]; then
echo "Found ${RELEASE_ARCHIVE}" >> /tmp/duck_installer.log
else
LED R
echo "No ducktoolkit release found" >> /tmp/duck_installer.log
exit 1
fi
# Set LED to purple blinking and move files
LED R B 100
# Backup Existing library
if [ -d "$TARGET_DIR/DuckToolkit" ]; then
echo "Library Exists; removing" >> /tmp/duck_installer.log
rm -rf ${TARGET_DIR}/DuckToolkit
fi
echo "Copying files to target dir" >> /tmp/duck_installer.log
cp ${RELEASE_ARCHIVE} ${TARGET_DIR}
cd ${TARGET_DIR}
tar zxf DuckToolkit-* && mv $(find . -name "DuckToolkit-*" ! -name "*.gz") DuckToolkit && rm DuckToolkit*.tar.gz
echo "Move Complete" >> /tmp/duck_installer.log
# Set LED to purple solid and check that move completed
LED R B
if ! [ -d "${TARGET_DIR}/DuckToolkit" ]; then
# Set LED to red on fail and exit
LED R
echo "Failed to copy files to target dir" >> /tmp/duck_installer.log
exit 1
else
# Set LED to amber blinking on setup
LED G R 100
# Set calling script executable
chmod +x ${TARGET_DIR}/DuckToolkit/bunnyducky.py
# Update Q and QUACK to use the new library
echo "Update Q" >> /tmp/duck_installer.log
cat <<'EOF' > /root/Q
#!/bin/sh
# Input parameters;
strparam="$@"
/root/tools/DuckToolkit/bunnyducky.py -l $DUCKY_LANG "$strparam" >> /root/ducklog.txt
exit 0
EOF
echo "Update QUACK" >> /tmp/duck_installer.log
cat <<'EOF' > /root/QUACK
#!/bin/sh
# Input parameters;
strparam="$@"
/root/tools/DuckToolkit/bunnyducky.py -l $DUCKY_LANG "$strparam" >> /root/ducklog.txt
exit 0
EOF
# LED To green for complete
LED R G B
fi
cp /tmp/duck_installer.log /root/udisk/payloads/${SWITCH_POSITION}/install_log.txt

View File

@ -0,0 +1,3 @@
# Install payload for the DuckToolkit
# See install.sh and readme.txt for details
ATTACKMODE ECM_ETHERNET STORAGE

View File

@ -0,0 +1,14 @@
DuckToolkit installer for Bash Bunny.
Adds support for new languages. and uses the Ducktoolkit python library for encoding.
Version 1.0.0
Moves the libary files to /tools
Update Q and QUACK to point to the new library
Writes error to /root/ducky.log
Purple Blinking.................Moving tools
Purple Solid....................Tools moved
Amber Blinking..................Setup tools
Red Solid.......................Tool installation failed
White Solid.....................Installation completed successfully