大半夜的收到群里面几个基佬的“邀请”让我部署一个w12scan的平台,不过,大半夜的,打工是不可能打工的,只能靠睡觉来放松了,还是得隔天早上,起来开工。
嗯。。。一群人半夜呼了吾几百次
第一步:准备服务器,centos7.6 内存4G cpu 4核
第二步:执行优化脚本(必做),优化脚本
第三步:安装docker
which docker
##检查是否安装docker及寻找地址
回显:/usr/bin/which: no docker in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
很显然我没安装。。。
既然没安装:那就安装一波
执行yum -y install yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum makecache fast
yum install docker-ce-17.12.0.ce-1.el7.centos.x86_64 -y
##这里提示一下,默认很多走的都是海外的镜像,国内部署可能会慢的要死
正常走完上面一步,我们检查一下安装正常了没
docker version
回显:
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:10:14 2017
OS/Arch: linux/amd64
[root@w12scan-0-177 yum.repos.d]# systemctl start docker
[root@w12scan-0-177 yum.repos.d]# which docker
/usr/bin/docker
[root@w12scan-0-177 yum.repos.d]# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.12.0-ce
Storage Driver: devicemapper
Pool Name: docker-8:3-807331917-pool
Pool Blocksize: 65.54kB
Base Device Size: 10.74GB
Backing Filesystem: xfs
Udev Sync Supported: true
Data file: /dev/loop0
Metadata file: /dev/loop1
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Data Space Used: 11.73MB
Data Space Total: 107.4GB
Data Space Available: 107.4GB
Metadata Space Used: 17.36MB
Metadata Space Total: 2.147GB
Metadata Space Available: 2.13GB
Thin Pool Minimum Free Space: 10.74GB
Deferred Removal Enabled: true
Deferred Deletion Enabled: true
Deferred Deleted Device Count: 0
Library Version: 1.02.149-RHEL7 (2018-07-20)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
curity Options:
▽seccomp
Profile: default
Kernel Version: 3.10.0-957.12.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.858GiB
Name: w12scan-0-177
ID: 6V77:LJ6U:QERB:UFXZ:DF2H:PTFQ:YZLA:7M2G:5OKE:UJDH:EIAK:U2MC
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
那么安装正常,我们执行下一步
systemctl enable docker
开机自启动docker服务
vim /etc/docker/daemon.json
##编辑docker额外源镜像
{
"registry-mirrors": [ "https://registry.docker-cn.com" ]
}
rpm -qa|grep docker
检查是否存在docker软件包
接下来就是安装w12scan了
执行 git clone https://github.com/boy-hack/w12scan
可以看到回显:
Cloning into 'w12scan'...
remote: Enumerating objects: 119, done.
remote: Counting objects: 100% (119/119), done.
remote: Compressing objects: 100% (80/80), done.
remote: Total 3145 (delta 48), reused 80 (delta 29), pack-reused 3026
Receiving objects: 100% (3145/3145), 13.18 MiB | 666.00 KiB/s, done.
Resolving deltas: 100% (833/833), done.
没安装Git的童鞋可以执行
yum install -y git
由于W12scan基于docker-compose
来运行,务必安装
进入目录:cd w12scan/
用docker-compose运行docker-compose up -d
如果回显-bash: docker-compose: command not found
则没安装
那么,查询pip是否安装which pip
如果回显/usr/bin/which: no pip in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
则没安装
我们运行
yum -y install epel-release
yum -y install python-pip
来安装pip
安装结束后which pip
检查
接下来更新一下pip
pip install --upgrade pip
##切记千万别乱更新,国内ecs实测更新可能会导致大面积异常红色错误,国内ecs服务器没事千万别更新。国外的不知道怎么回事,没问题。如果您足够自信能够修好可能造成的异常的话,您可以更新。
安装compose
pip install docker-compose
这里有非常重要的一个坑,如果您用的是纯净的系统镜像,那么请务必先运行
yum install -y gcc g++
yum install -y python-devel python3 python3-pip python3-devel
不然python在造轮子的时候会编译错误又或者找不到文件头
都执行完毕后
docker-compose -version
查看版本
如果回显版本就正常了
接下来就是运行了
输入docker-compose up -d
就开始部署环境了
最近部署脚本貌似有一些问题 在目录下的Dockerfile里面对镜像安装pip3的脚本似乎有一些问题,这个也是一个巨坑,连站长认识的一个大佬也翻车了。
解决方法暂时也未知,后面我会更新一篇文章来探讨这个问题。
如果安装成功的话
第五步: 运行netstat -lntup
如果回显:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 5377/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 5472/master
tcp6 0 0 :::22 :::* LISTEN 5377/sshd
tcp6 0 0 ::1:25 :::* LISTEN 5472/master
tcp6 0 0 :::8000 :::* LISTEN 8724/docker-proxy
则部署成功
我们可以直接在浏览器中访问地址:http://127.0.0.1:8000
如果您很不巧的无法打开那么您应该调下防火墙了
firewall-cmd --remove-forward-port=port=8000:proto=tcp:toport=80 --permanent
firewall-cmd --permanent --remove-port=80/tcp
firewall-cmd --reload
默认账号和密码均为:boyhack
当然,公网部署也是可以的,但是你也要小心会不会被
FBI Open The Door!
参考链接为:
https://x.hacking8.com/tag/w12scan //官网
https://github.com/w-digital-scanner/w12scan
https://www.freebuf.com/sectool/202375.html
https://blog.csdn.net/jiangyu1013/article/details/84570872
I just could not depart your web site prior to suggesting that I really loved the usual info an individual supply in your visitors Is gonna be back regularly to check up on new posts