-
Notifications
You must be signed in to change notification settings - Fork 6
/
install
110 lines (86 loc) · 3.25 KB
/
install
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
# Created By Armin Kazemi
# github.com/arminkz/TORPi
if [ "$EUID" -ne 0 ]
then echo "Please run the script with sudo privileges."
exit
fi
RED='\033[0;31m'
YEL='\033[1;33m'
BRW='\033[0;33m'
NC='\033[0m'
echo -e "\033[1;37;44m TORPi - Version 0.2 \033[0m"
echo -e "
_ _ _ \033[0;31m _ _ \033[0m
/\ \ /\ \ /\ \ \033[0;31m /\ \ /\ \ \033[0m
\_\ \ / \ \ / \ \ \033[0;31m / \ \ \ \ \ \033[0m
/\__ \ / /\ \ \ / /\ \ \ \033[0;31m / /\ \ \ /\ \_\ \033[0m
/ /_ \ \ / / /\ \ \ / / /\ \_\ \033[0;31m / / /\ \_\ / /\/_/ \033[0m
/ / /\ \ \ / / / \ \_\ / / /_/ / / \033[0;31m / / /_/ / // / / \033[0m
/ / / \/_// / / / / // / /__\/ / \033[0;31m / / /__\/ // / / \033[0m
/ / / / / / / / // / /_____/ \033[0;31m / / /_____// / / \033[0m
/ / / / / /___/ / // / /\ \ \ \033[0;31m / / / ___/ / /__ \033[0m
/_/ / / / /____\/ // / / \ \ \ \033[0;31m/ / / /\__\/_/___\ \033[0m
\_\/ \/_________/ \/_/ \_\/\033[0;31m \/_/ \/_________/ \033[0m
"
echo -e "Installing Required Packages ..."
apt install -y -qq hostapd dnsmasq
systemctl stop hostapd
systemctl stop dnsmasq
#-- /etc/dhcpcd.conf
echo -e "Setting static IP for raspberry pi..."
#backup
mv /etc/dhcpcd.conf /etc/dhcpcd.conf.old
#set static ip for wlan0 in dhcpcd.conf
cp template/dhcpcd /etc/dhcpcd.conf
systemctl restart dhcpcd
#-- /etc/hostapd/hostapd.conf
#SSID / PASS / ...
echo -e "\033[1;33mplease specify your wifi hotspot \033[0m\n"
read -p 'SSID: ' ssid
read -sp 'Password (at least 8 characters): ' pass
read -p 'Wifi Channel (1-12): ' ch
#backup
mv /etc/hostapd/hostapd.conf /etc/hostapd/hostapd.conf.old
#set /etc/hostapd/hostapd.conf
sed -e "s/\${ssid}/${ssid}/" -e "s/\${ch}/${ch}/" -e "s/\${pass}/${pass}/" template/hostapd > /etc/hostapd/hostapd.conf
#-- /etc/dnsmasq.conf
#backup
mv /etc/dnsmasq.conf /etc/dnsmasq.conf.old
#set /etc/dnsmasq.conf
cp template/dnsmasq /etc/dnsmasq.conf
echo -e "Enabling IP Forwarding..."
#set /etc/sysctl.conf -> net.ipv4.ip_forward=1
sysctl -w net.ipv4.ip_forward=1
sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sh -c "iptables-save > /etc/iptables.ipv4.nat"
#-- /etc/rc.local
#backup
mv /etc/rc.local /etc/rc.local.old
#add /etc/rc.local
cp template/rc.local /etc/rc.local
echo -e "Starting wifi hotspot..."
service hostapd start
service dnsmasq start
echo -e "Installing Tor..."
apt install -y -qq tor
#-- /etc/tor/torrc
#backup
mv /etc/tor/torrc /etc/tor/torrc.old
#set /etc/tor/torrc
cp template/torrc /etc/tor/torrc
iptables -F
iptables -t nat -F
iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 22 -j REDIRECT --to-ports 22
iptables -t nat -A PREROUTING -i wlan0 -p udp --dport 53 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040
sh -c "iptables-save > /etc/iptables.ipv4.nat"
touch /var/log/tor/notices.log
chown debian-tor /var/log/tor/notices.log
chmod 644 /var/log/tor/notices.log
echo -e "Starting Tor Service..."
service tor start
service tor status
update-rc.d tor enable
echo -e "Done! please reboot your pi"