-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathonionX.sh
171 lines (151 loc) · 4.77 KB
/
onionX.sh
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/bash
nc="\033[00m"
red="\033[01;31m"
green="\033[01;32m"
yellow="\033[01;33m"
blue="[debug]\033[01;34m"
purple="\033[01;35m"
cyan="\033[01;36m"
# default constant values
port="1337"
tordir=$PWD/hidden_service
logo="${yellow}__ ____ __ ${red}
${yellow} ____ ____ |__| ____ ____ ${red}\ \/ /
${yellow} / __ \ / \| |/ __ \ / \ ${red}\ /
${yellow}( \_\ ) | \ | \_\ ) | ${red}\/ \
${yellow} \____/|___| /__|\____/|___| ${red}/___/\ \
${yellow} \/ \/${red} \/
${cyan} A dark web website for everyone
${nc}"
contact="${yellow}YouTube - ${purple}https://youtube.com/c/pwnos
${yellow}LinkedIn - ${purple}https://linkedin.com/in/sam-sepi0l/
${yellow}Twitter - ${purple}https://twitter.com/sam5epi0l
${yellow}Buymeacoffee - ${purple}https://www.buymeacoffee.com/sam5epi0l
${nc}"
echo -e "$logo $contact"
sleep 1
# checking for system root access
if [ "$(command -v sudo)" ]; then
sudo="sudo"
echo -e "${blue} Script will require sudo/root priviladges${nc}"
else
sudo=""
echo -e "${blue}You're a powerful enough to install packages${nc}"
fi
sleep 1
# checking for system home dir
if (( "${#HOME}" == 0 )); then
HOME="$(getent passwd "$(id -u)" | awk -F ':' '{print $6}')"
if (( "${#HOME}" == 0 )) || [[ ! -d "${HOME}" ]]; then
printf -- "{blue}%s%{nc}\n" "Could not identify HOME variable" >&2
exit 1
fi
if [[ ! -w "${HOME}" ]]; then
printf -- "{blue}%s%{nc}\n" "Permissions error: cannot write to $HOME" >&2
exit 1
fi
export HOME
fi
echo -e "${blue} You live at ${green} $home ${nc}"
sleep 1
# checking for configuration dir
if [ -d /data/data/com.termux/files/usr/etc ]; then
tor_conf_dir="/data/data/com.termux/files/usr/etc/tor"
elif [ -d /etc ]; then
tor_conf_dir="/etc/tor"
fi
echo -e "${blue} TOR default configurations are here ${green} $tor_conf_dir ${nc}"
sleep 1
# checking for system bin dir
if [ -d /data/data/com.termux/files/usr/bin ]; then
bin="/data/data/com.termux/files/usr/bin"
elif [ -d /sbin ]; then
bin="/sbin"
elif [ -d /bin ]; then
bin="/bin"
elif [ -d /usr/local/bin ]; then
bin="/usr/local/bin"
fi
echo -e "${blue} Your bin directory is here $bin ${nc}"
sleep 1
# checking for system package manager
if [ -e /data/data/com.termux/files/usr/bin/pkg ]; then
pac="pkg"
system="termux"
elif [ "$(command -v apt)" ]; then
pac="apt"
system="linux"
elif [ "$(command -v apt-get)" ]; then
pac="apt-get"
system="linux"
elif [ "$(command -v apk)" ]; then
pac="apk"
system="linux"
elif [ "$(command -v yum)" ]; then
pac="yum"
system="fedora"
elif [ "$(command -v brew)" ]; then
pac="brew"
system="mac"
sudo=""
fi
echo -e "${blue} Your system is $system and $pac is the package manager ${nc}"
sleep 1
echo -e "${blue} You are currently installing in $PWD directory ${nc}"
sleep 1
# setup process
echo -e "[-]${green} Installing .... ${nc}"
sleep 1
echo -e "[-]${yellow} Running setup .... ${nc}"
sleep 1
# installing dependency
# $sudo $pac update -y
#for each_pac in "tor"; do
if [ ! "$(command -v tor)" ]; then
if [ "$sudo" ]; then
echo -e "${blue} Installing tor with sudo${nc}"
$sudo $pac install tor -y
else
echo -e "${blue} Installing tor without sudo ${nc}"
$pac install tor -y
fi
fi
#done
sleep 1
# setup tor hidden service [error]
echo -e "[-] ${yellow} starting tor hidden service on port $port ${red} change it if port is unavailable ${nc}"
sleep 1
echo -e "[-]${green} tor hidden service dir is here ${cyan} $tordir ${nc}"
sleep 1
echo -e "${blue} configuring torrc file"
# $sudo find $conf_dir/ -type f -name torrc -exec sudo sed -i "s/\#HiddenServiceDir \/var\/lib\/tor\/hidden_service\//HiddenServiceDir \/hidden_service\//g" {} +
# $sudo find $conf_dir/ -type f -name torrc -exec sudo sed -i "s/\#HiddenServicePort 80 127.0.0.1:80/HiddenServicePort 80 127.0.0.1:1337/g" {} +
cp $tor_conf_dir/torrc .
echo "HiddenServiceDir $PWD/hidden_service/" >> torrc
echo "HiddenServicePort 80 127.0.0.1:$port" >> torrc
# Start tor service
echo -e "[-] ${yellow} Starting tor hidden service ${nc}"
sleep 1
tor -f torrc --quiet &
echo -e "[-] ${red} tor started ${nc}"
sleep 1
# check onionX is installed or not
if [ -e "$bin/tor" ]; then
echo "pass"
if [ -d "$tordir" ]; then
echo -e "$logo"
echo -e "[i]${purple} onionX ${green}installed successfully !!${nc}"
sleep 1
echo -e "[i]${green} Start your apache/nginx server on port $port ${nc}"
sleep 1
echo -e "[i]${yellow} Check out your Website here - $(cat hidden_service/hostname) ${nc}"
sleep 1
echo -e "[i]${purple} got errors, contact me here $contact ${nc}"
else
echo -e "$logo"
sleep 1
echo -e "[i] ${red}Sorry ${cyan}: onionx ${red}is not installed !!${nc}"
sleep 1
echo -e "[i] ${green}Please try again or contact me here $contact ${nc}"
fi
fi