forked from ffffffff0x/f8x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
f8x-dev
558 lines (447 loc) · 17.3 KB
/
f8x-dev
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
#!/usr/bin/env bash
# ===================== Basic variable settings =====================
if test -e /usr/local/bin/f8x
then
sleep 0.001
# f8x -update
else
curl -o f8x https://f8x.io/ && mv --force f8x /usr/local/bin/f8x && chmod +x /usr/local/bin/f8x && echo -e "\033[1;36m$(date +"%H:%M:%S")\033[0m \033[1;32m[INFOR]\033[0m - \033[1;32mInstalled f8x tools\033[0m" || echo -e "\033[1;36m$(date +"%H:%M:%S")\033[0m \033[1;31m[ERROR]\033[0m - \033[1;31mf8x installation failed\n\033[0m"
fi
. /usr/local/bin/f8x > /dev/null 2>&1
F8x_dev_Version="0.0.3 Dev"
# ===================== Software version variable setting =====================
tomcat6_bin="apache-tomcat-6.0.53.tar.gz"
tomcat6_dir="apache-tomcat-6.0.53"
tomcat7_bin="apache-tomcat-7.0.109.tar.gz"
tomcat7_dir="apache-tomcat-7.0.109"
tomcat8_bin="apache-tomcat-8.5.68.tar.gz"
tomcat8_dir="apache-tomcat-8.5.68"
tomcat9_bin="apache-tomcat-9.0.50.tar.gz"
tomcat9_dir="apache-tomcat-9.0.50"
redis3_bin="redis-3.2.0.tar.gz"
redis3_dir="redis-3.2.0"
redis4_bin="redis-4.0.11.tar.gz"
redis4_dir="redis-4.0.11"
redis5_bin="redis-5.0.12.tar.gz"
redis5_dir="redis-5.0.12"
sharry_Ver="v1.9.0"
sharry_File="sharry-restserver-1.9.0.zip"
memcached160_bin="memcached-1.6.0.tar.gz"
memcached160_dir="memcached-1.6.0"
Main
Pentest_Base_Install > /dev/null 2>&1
# ===================== Install sharry =====================
sharry_Install(){
name="sharry"
if test -d $T_Dir/$name
then
Echo_ALERT "$name is already installed in $T_Dir/$name, run the following command to turn on the service:"
else
cd $T_Dir/ && rm -rf sharry-restserver-* && Echo_ALERT "Downloading $name (~70M)" && $Porxy_OK wget https://github.com/eikek/sharry/releases/download/$sharry_Ver/$sharry_File > /dev/null 2>&1 || Echo_ERROR2
unzip $sharry_File > /dev/null 2>&1 && rm -f $sharry_File > /dev/null 2>&1 && mv --force sharry-restserver-* sharry && Echo_INFOR "Successfully installed $name, run the following command to turn on the service:" || Echo_ERROR3
fi
Echo_INFOR "$T_Dir/sharry/bin/sharry-restserver , the service requires a jdk environment, if not installed you can run the -oraclejdk option to install it."
}
# ===================== Install mariadb =====================
mariadb_Install(){
name="mariadb"
which mysql > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name installed"
Echo_INFOR "systemctl start mariadb"
else
Rm_Lock
case $Linux_Version in
*"CentOS"*|*"RedHat"*|*"Fedora"*)
Install_Switch "mariadb"
Install_Switch "mariadb-server"
;;
*"Kali"*|*"Ubuntu"*|*"Debian"*)
Install_Switch "mariadb-client"
Install_Switch "mariadb-server"
;;
*) ;;
esac
systemctl start mariadb
mysql_secure_installation
mysqlcmd="select User, host from mysql.user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'toor' WITH GRANT OPTION;
FLUSH PRIVILEGES;"
mysql -u root -p -e "${mysqlcmd}"
Echo_INFOR "Default root/toor For security reasons, please do not deploy in a public network environment."
systemctl restart mariadb
# If you can't connect, you need to modify the configuration file
# vim /etc/mysql/mariadb.conf.d/50-server.cnf
# bind-address = 0.0.0.0
# :wq
# systemctl restart mariadb
fi
}
mariadb_docker_Install(){
echo -e "\033[5;33m\nPlease enter your mariadb listening port\033[0m" && read -r input
mariadb_port=$input
echo -e "\033[5;33m\nPlease enter your mariadb password(Special characters should be preceded by a backslash \"\\\" to escape them)\033[0m" && read -r input
mariadb_pass=$input
docker search mariadb
docker pull mariadb
docker images mariadb
docker run -d -p $mariadb_port:3306 --name f8x-mariadb1 -e MYSQL_ROOT_PASSWORD=$mariadb_pass mariadb:latest
docker ps
Echo_ALERT "Already listening to 0.0.0.0:$mariadb_port, please do not deploy in public network environment"
}
# ===================== Install mongodb =====================
mongodb_Install(){
echo -e "\033[5;33m\nPlease enter your mongodb listening port\033[0m" && read -r input
mongodb_port=$input
docker search mongodb # 从Docker Hub查找镜像
docker pull mongo # 从镜像仓库中拉取或者更新指定镜像
docker images mongo # 列出本地主机上的mongo镜像
docker run -d -p $mongodb_port:27017 --name mongodb mongo # 创建一个新的容器并运行一个命令
docker ps # 显示正在运行的容器
Echo_ALERT "Already listening to 0.0.0.0:$mongodb_port, please do not deploy in public network environment"
}
# ===================== Install memcached =====================
memcached_Install(){
Rm_Lock
Install_Switch "memcached"
}
# ===================== Install memcached 1.6.0 =====================
memcached160_Install(){
mkdir -p /tmp/memcached160 && cd /tmp/memcached160
ls -al /usr/local/libevent-2.1.12-stable/lib | grep libevent > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_INFOR "libevent 2.1.12 installed"
else
$Porxy_OK wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz > /dev/null 2>&1 || Echo_ERROR2
tar -zxvf libevent-2.1.12-stable.tar.gz > /dev/null 2>&1
cd libevent-2.1.12-stable
./configure --prefix=/usr/local/libevent-2.1.12-stable
make && make install && Echo_INFOR "Successfully installed libevent 2.1.12"
fi
cd /tmp/memcached160 && rm -rf $memcached160_bin && $Porxy_OK wget https://www.memcached.org/files/$memcached160_bin > /dev/null 2>&1 || Echo_ERROR2
tar -zxvf $memcached160_bin > /dev/null 2>&1
cd $memcached160_dir && ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent-2.1.12-stable/
make && make test
make install && Echo_INFOR "Successfully installed memcached 1.6.0"
rm -rf /tmp/memcached160
# 写了一大堆,编译还报错,干脆直接软件包安装得了 :)
}
# ===================== Install postgresql =====================
postgresql_Install(){
# Rm_Lock
#
# case $Linux_Version in
# *"CentOS"*|*"RedHat"*|*"Fedora"*)
# Install_Switch "postgresql-server"
# ;;
# *"Kali"*|*"Ubuntu"*|*"Debian"*)
# Install_Switch "postgresql"
# Install_Switch "postgresql-contrib"
# Install_Switch "sudo"
# ;;
# *) ;;
# esac
#
# sudo -u postgres psql -c "SELECT version();" 2>> /tmp/f8x_error.log
Echo_INFOR "To allow external access, please refer to the following steps"
Echo_INFOR "1. Configure to listen on all ports, modify \033[1;33m/etc/postgresql/11/main/postgresql.conf\033[0m \033[1;32madd\033[0m \033[1;33mlisten_addresses = '*'\033[0m"
Echo_INFOR "2. Configure to allow external connections, modify \033[1;33m/etc/postgresql/11/main/pg_hba.conf\033[0m \033[1;32madd\033[0m \033[1;33mhost all all 0.0.0.0/0 md5\033[0m"
Echo_INFOR "3. Open firewall ports and restart services : \033[1;33mservice postgresql restart\033[0m"
echo -e ""
Echo_INFOR "Default is postgres user, no password, if external connection need to set password"
Echo_INFOR "sudo -u postgres psql postgres"
Echo_INFOR "\password postgres"
Echo_INFOR "\q"
}
# ===================== Install redis3 =====================
redis3_Install(){
Rm_Lock
Install_Switch "tcl"
case $Linux_Version in
*"CentOS"*|*"RedHat"*|*"Fedora"*)
Install_Switch "tcl-devel"
;;
*"Kali"*|*"Ubuntu"*|*"Debian"*)
Install_Switch "tcl-dev"
;;
*) ;;
esac
name="redis3"
cd /tmp && rm -rf $redis3_bin && $Porxy_OK wget http://download.redis.io/releases/$redis3_bin > /dev/null 2>&1 || Echo_ERROR2
tar -zxf $redis3_bin > /dev/null 2>&1
cd $redis3_dir
make test
make MALLOC=libc
make install
cd /tmp && rm -rf $redis3_bin
mv --force /tmp/$redis3_dir/redis.conf /etc/redis.conf
Echo_INFOR "redis.conf copied to /etc/redis.conf"
rm -rf $redis3_dir
}
# ===================== Install redis4 =====================
redis4_Install(){
Install_Switch "tcl"
case $Linux_Version in
*"CentOS"*|*"RedHat"*|*"Fedora"*)
Install_Switch "tcl-devel"
;;
*"Kali"*|*"Ubuntu"*|*"Debian"*)
Install_Switch "tcl-dev"
;;
*) ;;
esac
name="redis4"
cd /tmp && rm -rf $redis4_bin && $Porxy_OK wget http://download.redis.io/releases/$redis4_bin > /dev/null 2>&1 || Echo_ERROR2
tar -zxf $redis4_bin > /dev/null 2>&1
cd $redis4_dir
make test
make MALLOC=libc
make install
cd /tmp && rm -rf $redis4_bin
mv --force /tmp/$redis4_dir/redis.conf /etc/redis.conf
Echo_INFOR "redis.conf copied to /etc/redis.conf"
rm -rf $redis4_dir
}
# ===================== Install redis5 =====================
redis5_Install(){
Rm_Lock
Install_Switch "tcl"
case $Linux_Version in
*"CentOS"*|*"RedHat"*|*"Fedora"*)
Install_Switch "tcl-devel"
;;
*"Kali"*|*"Ubuntu"*|*"Debian"*)
Install_Switch "tcl-dev"
;;
*) ;;
esac
name="redis5"
cd /tmp && rm -rf $redis5_bin && $Porxy_OK wget http://download.redis.io/releases/$redis5_bin > /dev/null 2>&1 || Echo_ERROR2
tar -zxf $redis5_bin > /dev/null 2>&1
cd $redis5_dir
make test
make MALLOC=libc
make install
cd /tmp && rm -rf $redis5_bin
mv --force /tmp/$redis5_dir/redis.conf /etc/redis.conf
Echo_INFOR "redis.conf copied to /etc/redis.conf"
rm -rf $redis5_dir
}
# ===================== Install tomcat6 =====================
tomcat6_Install(){
# Tomcat 6.0 requires JRE 5.0 or later.
name="tomcat6"
dir="/usr/local/$tomcat6_dir"
if test -d $dir
then
Echo_ALERT "$name is already installed in $dir"
else
cd $T_Dir && rm -rf $tomcat6_bin && $Porxy_OK wget https://archive.apache.org/dist/tomcat/tomcat-6/v6.0.53/bin/$tomcat6_bin > /dev/null 2>&1 || Echo_ERROR2
tar -zxf $tomcat6_bin -C /usr/local/ > /dev/null 2>&1 && rm -rf $tomcat6_bin
fi
rm -rf /usr/local/tomcat
ln -s /usr/local/${tomcat6_dir}/ /usr/local/tomcat
Echo_INFOR "Manually run the following command:\nexport CATALINA_HOME=/usr/local/tomcat\nexport PATH=\$CATALINA_HOME/bin:\$PATH"
Echo_INFOR "catalina.sh version"
Echo_INFOR "catalina.sh start"
}
# ===================== Install tomcat7 =====================
tomcat7_Install(){
# Tomcat 7.0 requires Java 6 or later.
name="tomcat7"
dir="/usr/local/$tomcat7_dir"
if test -d $dir
then
Echo_ALERT "$name is already installed in $dir"
else
cd $T_Dir && rm -rf $tomcat7_bin && $Porxy_OK wget https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.109/bin/$tomcat7_bin > /dev/null 2>&1 || Echo_ERROR2
tar -zxf $tomcat7_bin -C /usr/local/ > /dev/null 2>&1 && rm -rf $tomcat7_bin
fi
rm -rf /usr/local/tomcat
ln -s /usr/local/${tomcat7_dir}/ /usr/local/tomcat
Echo_INFOR "Manually run the following command:\nexport CATALINA_HOME=/usr/local/tomcat\nexport PATH=\$CATALINA_HOME/bin:\$PATH"
Echo_INFOR "catalina.sh version"
Echo_INFOR "catalina.sh start"
}
# ===================== Install tomcat8 =====================
tomcat8_Install(){
# Tomcat 8.5 requires Java 7 or later.
name="tomcat8"
dir="/usr/local/$tomcat8_dir"
if test -d $dir
then
Echo_ALERT "$name is already installed in $dir"
else
cd $T_Dir && rm -rf $tomcat8_bin && $Porxy_OK wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.68/bin/$tomcat8_bin > /dev/null 2>&1 || Echo_ERROR2
tar -zxf $tomcat8_bin -C /usr/local/ > /dev/null 2>&1 && rm -rf $tomcat8_bin
fi
rm -rf /usr/local/tomcat
ln -s /usr/local/${tomcat8_dir}/ /usr/local/tomcat
Echo_INFOR "Manually run the following command:\nexport CATALINA_HOME=/usr/local/tomcat\nexport PATH=\$CATALINA_HOME/bin:\$PATH"
Echo_INFOR "catalina.sh version"
Echo_INFOR "catalina.sh start"
}
# ===================== Install tomcat9 =====================
tomcat9_Install(){
# Tomcat 9.0 requires Java 8 or later.
name="tomcat9"
dir="/usr/local/$tomcat9_dir"
if test -d $dir
then
Echo_ALERT "$name is already installed in $dir"
else
cd $T_Dir && rm -rf $tomcat9_bin && $Porxy_OK wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.50/bin/$tomcat9_bin > /dev/null 2>&1 || Echo_ERROR2
tar -zxf $tomcat9_bin -C /usr/local/ > /dev/null 2>&1 && rm -rf $tomcat9_bin
fi
rm -rf /usr/local/tomcat
ln -s /usr/local/${tomcat9_dir}/ /usr/local/tomcat
Echo_INFOR "Manually run the following command:\nexport CATALINA_HOME=/usr/local/tomcat\nexport PATH=\$CATALINA_HOME/bin:\$PATH"
Echo_INFOR "catalina.sh version"
Echo_INFOR "catalina.sh start"
}
# ===================== Install nginx (pkg) =====================
nginx_Install_pkg(){
name="nginx"
Rm_Lock
Install_Switch "nginx"
Echo_INFOR "systemctl status nginx"
systemctl status nginx
}
# ===================== Install apache (pkg) =====================
apache_Install_pkg(){
name="apache2"
Rm_Lock
case $Linux_Version in
*"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
Install_Switch "httpd"
Echo_INFOR "systemctl status httpd"
systemctl status httpd
;;
*"Kali"*|*"Ubuntu"*|*"Debian"*)
Install_Switch "apache2"
Echo_INFOR "systemctl status apache2"
systemctl status apache2
;;
*)
;;
esac
}
# -help
Help_Info(){
echo -e "\033[1;34mapache \033[0m"
echo -e " \033[1;34m-apache-pkg\033[0m \033[0;34m : install apache (use apt/yum) \033[0m"
echo -e ""
echo -e "\033[1;34mnginx \033[0m"
echo -e " \033[1;34m-nginx-pkg\033[0m \033[0;34m : install nginx (use apt/yum) \033[0m"
echo -e " \033[1;34m-nginx-src\033[0m \033[0;34m : install nginx (use Source Code) \033[0m"
echo -e ""
echo -e "\033[1;34mtomcat \033[0m"
echo -e " \033[1;34m-tomcat6\033[0m \033[0;34m : install tomcat6 \033[0m"
echo -e " \033[1;34m-tomcat7\033[0m \033[0;34m : install tomcat7 \033[0m"
echo -e " \033[1;34m-tomcat8\033[0m \033[0;34m : install tomcat8 \033[0m"
echo -e " \033[1;34m-tomcat9\033[0m \033[0;34m : install tomcat9 \033[0m"
echo -e ""
echo -e "\033[1;34mDatabase \033[0m"
echo -e " \033[1;34m-mariadb\033[0m \033[0;34m : install mariadb (Package Manager) \033[0m"
echo -e " \033[1;34m-mariadb-docker\033[0m \033[0;34m : install mariadb (docker) \033[0m"
echo -e " \033[1;34m-memcached\033[0m \033[0;34m : install memcached (Package Manager) \033[0m"
echo -e " \033[1;34m-mongodb\033[0m \033[0;34m : install mongodb (docker) \033[0m"
#echo -e " \033[1;34m-postgresql\033[0m \033[0;34m : install postgresql(Package Manager) \033[0m"
echo -e " \033[1;34m-redis3\033[0m \033[0;34m : install redis3 (Compile) \033[0m"
echo -e " \033[1;34m-redis4\033[0m \033[0;34m : install redis4 (Compile) \033[0m"
echo -e " \033[1;34m-redis5\033[0m \033[0;34m : install redis5 (Compile) \033[0m"
#echo -e ""
#echo -e "\033[1;34mOther \033[0m"
#echo -e " \033[1;34m-sharry\033[0m \033[0;34m : install sharry\033[0m"
echo -e ""
echo -e "\033[1;37mcreate by ffffffff0x\033[0m"
echo -e ""
}
for cmd in $@
do
case $cmd in
-sharry)
linux_arm64_Check || exit 1
Porxy_Switch
Base_Check
sharry_Install
;;
-mariadb)
Porxy_Switch
Base_Check
mariadb_Install
;;
-mariadb-docker)
Base_Check
Docker_Check
mariadb_docker_Install
;;
-mongodb)
Base_Check
Docker_Check
mongodb_Install
;;
-memcached)
Porxy_Switch
Base_Check
memcached_Install
;;
-postgresql)
Porxy_Switch
Base_Check
postgresql_Install
;;
-redis3)
Porxy_Switch
Base_Check
redis3_Install
;;
-redis4)
Porxy_Switch
Base_Check
redis4_Install
;;
-redis5)
Porxy_Switch
Base_Check
redis5_Install
;;
-tomcat6)
Porxy_Switch
Base_Check
tomcat6_Install
;;
-tomcat7)
Porxy_Switch
Base_Check
tomcat7_Install
;;
-tomcat8)
Porxy_Switch
Base_Check
tomcat8_Install
;;
-tomcat9)
Porxy_Switch
Base_Check
tomcat9_Install
;;
-nginx-src)
nginx_Install
;;
-nginx-pkg)
nginx_Install_pkg
;;
-apache-pkg)
apache_Install_pkg
;;
-help | help)
printf "\033c"
Help_Info
exit 1
;;
esac
done
echo -e "\033[1;36m \n-----OVER-----\n \033[0m"