mirror of
https://github.com/wismna/HackPi.git
synced 2025-10-03 15:40:16 -04:00
Update install.sh
This commit is contained in:
45
install.sh
45
install.sh
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Installation file for HackPi
|
||||
# Installer for HackPi
|
||||
#
|
||||
# Usage:
|
||||
# chmod +x install.sh
|
||||
@@ -8,11 +8,12 @@
|
||||
#
|
||||
|
||||
KERNEL_VERSION=$(uname -r)
|
||||
MODULE_INSTALLED=false
|
||||
|
||||
# Update Packages and ensure dependencies are installed
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -y
|
||||
sudo apt-get install -y install isc-dhcp-server dsniff screen nodejs bridge-utils
|
||||
sudo apt-get install -y isc-dhcp-server dsniff screen nodejs bridge-utils
|
||||
sudo git clone https://github.com/samyk/poisontap ~/poisontap
|
||||
sudo git clone https://github.com/lgandx/Responder ~/Responder
|
||||
|
||||
@@ -21,8 +22,11 @@ printf "\nBackup files? [y/n]"
|
||||
read backup
|
||||
|
||||
if [[ $backup == y* ]] ;
|
||||
then
|
||||
if [ ! -d ~/HackPi/backup ] ;
|
||||
then
|
||||
sudo mkdir ~/HackPi/backup
|
||||
fi
|
||||
sudo cp /boot/config.txt ~/HackPi/backup/config.txt.bak
|
||||
sudo cp /etc/modules ~/HackPi/backup/modules.bak
|
||||
sudo cp /etc/rc.local ~/HackPi/backup/rc.local.bak
|
||||
@@ -31,10 +35,36 @@ then
|
||||
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 [[ $KERNEL_VERSION == "4.4.38+" || $KERNEL_VERSION == "4.4.48+" ]] ;
|
||||
then
|
||||
sudo cp -f ~/HackPi/dwc2/dwc2."$KERNEL_VERSION".ko /lib/modules/"$KERNEL_VERSION"/kernel/drivers/usb/dwc2/dwc2.ko
|
||||
$MODULE_INSTALLED=true
|
||||
else
|
||||
printf "\nModule for kernel $KERNEL_VERSION not found.\nPatching is possible, but requires downloading the kernel."
|
||||
printf "\nProceed? [y/n] "
|
||||
read proceed
|
||||
if [[ $proceed == y* ]];
|
||||
then
|
||||
sudo apt-get install -y bc
|
||||
sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source
|
||||
sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update
|
||||
rpi-source
|
||||
printf "\nPatching kernel module...\n"
|
||||
cd ~/linux/drivers/usb/dwc2
|
||||
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
|
||||
$MODULE_INSTALLED=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$MODULE_INSTALLED" = true ] ;
|
||||
then
|
||||
# Server configuration
|
||||
printf "\nConfigure backdoor usage? [y/n] "
|
||||
read server
|
||||
|
||||
if [[ $server == y* ]] ;
|
||||
then
|
||||
printf "\nIP address of server which is running the backend_server.js: "
|
||||
@@ -42,7 +72,7 @@ then
|
||||
sudo sed -i -e 's/YOUR.DOMAIN/'$ip'/g' ~/poisontap/target_backdoor.js
|
||||
sudo sed -i -e 's/YOUR.DOMAIN/'$ip'/g' ~/poisontap/backdoor.html
|
||||
|
||||
printf "\nAnd the port: "
|
||||
printf "And the port: "
|
||||
read port
|
||||
if [ $port != "1337" ] ;
|
||||
then
|
||||
@@ -61,6 +91,9 @@ sudo chmod +x /etc/rc.local
|
||||
sudo cp -f ~/HackPi/isc-dhcp-server /etc/default/
|
||||
sudo cp -f ~/HackPi/dhcpd.conf /etc/dhcp/
|
||||
sudo cp -f ~/HackPi/interfaces /etc/network/
|
||||
sudo cp -f ~/HackPi/dwc2/dwc2."$KERNEL_VERSION".ko /lib/modules/"$KERNEL_VERSION"/kernel/drivers/usb/dwc2/dwc2.ko
|
||||
|
||||
printf "\nDone.\nYou can now reboot the device."
|
||||
else
|
||||
printf "Installation aborted.\n"
|
||||
[ -v PS1 ] && return || exit
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user