-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathinstall_bk
72 lines (51 loc) · 1.65 KB
/
install_bk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
##!/bin/sh
run_it () {
PREFIX="/usr/local"
set -e
set -u
# Let's display everything on stderr.
exec 1>&2
UNAME=$(uname)
# Check to see if OS is Raspbian
if [ "$UNAME" != "Linux" ] ; then
echo "This installer script is only designed to be executed on Raspbian."
echo "Please run this script on a v3 Rasbperry Pi with Raspbian installed."
exit 1
fi
# Check that script is running under root
if [ "$EUID" -ne 0 ] ; then
echo "This installer script must be run with sudo."
exit 1
fi
# Update the package manager and install base packages
apt-get update --assume-yes
# apt-get upgrade --assume-yes
### STEP 1: Wi-Fi Setup ###
apt-get install --assume-yes hostapd dnsmasq
# Ignore wlan0 for dhcpcd
echo "denyinterfaces wlan0" >> /etc/dhcpcd.conf
mv ./config/interfaces /etc/network/interfaces
# Restart wireless and the DHCP server
service dhcpcd restart
ifdown wlan0
ifup wlan0
mv ./config/hostapd.conf /etc/hostapd/hostapd.conf
mv ./config/hostapd /etc/default/hostapd
mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
mv ./config/dnsmasq.conf /etc/dnsmasq.conf
# Enable ipv4 forwarding
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
# Save the iptables routing rules
sh -c "iptables-save > /etc/iptables.ipv4.nat"
mv ./config/rc.local /etc/rc.local
service hostapd restart
service dnsmasq restart
### STEP 2: Dumpcap Setup ###
apt-get install --assume-yes tshark python-pip # tshark includes dumpcap
pip install scapy
}
run_it