Update install.sh

Fixes
This commit is contained in:
Jan Rude
2017-03-06 11:43:28 +01:00
committed by GitHub
parent 73dbeb9e45
commit 78e1fd761f

View File

@@ -11,7 +11,7 @@ KERNEL_VERSION=$(uname -r)
MODULE_INSTALLED=false
# Update Packages and ensure dependencies are installed
sudo apt-get update
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y isc-dhcp-server dsniff screen nodejs bridge-utils
sudo git clone https://github.com/samyk/poisontap ~/poisontap
@@ -23,7 +23,7 @@ read backup
if [[ $backup == y* ]] ;
then
if [ ! -d ~/HackPi/backup ] ;
if [ ! -d ~/HackPi/backup ] ;
then
sudo mkdir ~/HackPi/backup
fi
@@ -32,14 +32,17 @@ then
sudo cp /etc/rc.local ~/HackPi/backup/rc.local.bak
sudo cp /etc/default/isc-dhcp-server ~/HackPi/backup/isc-dhcp-server.bak
sudo cp /etc/network/interfaces ~/HackPi/backup/interfaces.bak
sudo cp /lib/modules/"$KERNEL_VERSION"/kernel/drivers/usb/dwc2/dwc2.ko ~/HackPi/backup/dwc2.ko.bak
fi
# Check if kernel module is there, otherwise download kernel and patch
if [ -f ~/HackPi/dwc2/dwc2."$KERNEL_VERSION".ko ] ;
then
if [[ $backup == y* ]] ;
then
sudo cp /lib/modules/"$KERNEL_VERSION"/kernel/drivers/usb/dwc2/dwc2.ko ~/HackPi/backup/dwc2.ko.bak
fi
sudo cp -f ~/HackPi/dwc2/dwc2."$KERNEL_VERSION".ko /lib/modules/"$KERNEL_VERSION"/kernel/drivers/usb/dwc2/dwc2.ko
$MODULE_INSTALLED=true
MODULE_INSTALLED=true
else
printf "\nModule for kernel $KERNEL_VERSION not found.\nPatching is possible, but requires downloading the kernel."
printf "\nProceed? [y/n] "
@@ -55,13 +58,13 @@ else
patch -i ~/HackPi/dwc2/gadget.patch
cd ~/linux
make M=drivers/usb/dwc2 CONFIG_USB_DWC2=m
sudo cp -f drivers/usb/dwc2/dwc2."$KERNEL_VERSION".ko /lib/modules/"$KERNEL_VERSION"/kernel/drivers/usb/dwc2/dwc2.ko
sudo cp -f drivers/usb/dwc2/dwc2."$KERNEL_VERSION".ko ~/HackPi/dwc2/
$MODULE_INSTALLED=true
sudo cp -f drivers/usb/dwc2/dwc2.ko /lib/modules/"$KERNEL_VERSION"/kernel/drivers/usb/dwc2/dwc2.ko
sudo cp -f drivers/usb/dwc2/dwc2.ko ~/HackPi/dwc2/dwc2."$KERNEL_VERSION".ko
MODULE_INSTALLED=true
fi
fi
if [ "$MODULE_INSTALLED" = true ] ;
if [ "$MODULE_INSTALLED" == true ] ;
then
# Server configuration
printf "\nConfigure backdoor usage? [y/n] "
@@ -83,7 +86,7 @@ then
sudo sed -i -e 's/1337/'$port'/g' ~/poisontap/backdoor.html
fi
fi
# Install files
sudo cp -f ~/HackPi/config.txt /boot/
sudo cp -f ~/HackPi/modules /etc/