AI智能
改变未来

Mirai环境搭建

20200805 –

引言

关于Mirai的环境搭建,我记得能搜到很多结果。不过我当时并没有想要启动mirai的所有功能。毕竟其实他的代码也有缺陷,现在想扫出来结果也有点难了。后面可能还是需要这些功能来辅助扫描结果,其他功能还是要开启。这里先记录一个别人的搭建步骤,后面再来记录我自己的。

搭建过程

[1]他人环境搭建

在这个环境的部署过程中,需要下载很多东西,包括各种乱七八糟的东西,还有交叉编译的环境,为了获得CNC的服务器,还要有go的启动环境。我个人觉得,还是弄一个docker的环境更好。

自己的docker搭建过程

为了搭建mirai的docker环境,需要下载各种乱七八糟的库,同时因为github访问有时候也不稳定,所以mirai的源码,以及go程序需要的库也都是提前下好的。

新建文件夹

mkidr miraicd miraimkdir cross-envmkdir gomkdir mirai#以下文件放置于 cross-envhttps://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-armv4l.tar.bz2https://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-armv5l.tar.bz2https://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-i586.tar.bz2https://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-i686.tar.bz2https://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-m68k.tar.bz2https://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-mips.tar.bz2https://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-mipsel.tar.bz2https://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-powerpc.tar.bz2https://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-sh4.tar.bz2https://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-sparc.tar.bz2https://www.uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-x86_64.tar.bz2http://distro.ibiblio.org/slitaz/sources/packages/c/cross-compiler-armv6l.tar.bz2#以下文件放置于gohttps://dl.google.com/go/go1.14.7.linux-amd64.tar.gzhttps://codeload.github.com/go-sql-driver/mysql/zip/masterhttps://codeload.github.com/mattn/go-shellwords/zip/maste#以下文件放置于miraihttps://codeload.github.com/jgamblin/Mirai-Source-Code/zip/master

编写Dockerfile

FROM centos:7ADD go/go1.14.7.linux-amd64.tar.gz /usr/local/ADD cross-env/cross-compiler-armv4l.tar.bz2 /etc/xcompile/ADD cross-env/cross-compiler-armv5l.tar.bz2 /etc/xcompile/ADD cross-env/cross-compiler-armv6l.tar.bz2 /etc/xcompile/ADD cross-env/cross-compiler-i586.tar.bz2 /etc/xcompile/ADD cross-env/cross-compiler-m68k.tar.bz2 /etc/xcompile/ADD cross-env/cross-compiler-mips.tar.bz2 /etc/xcompile/ADD cross-env/cross-compiler-mipsel.tar.bz2 /etc/xcompile/ADD cross-env/cross-compiler-powerpc.tar.bz2 /etc/xcompile/ADD cross-env/cross-compiler-sh4.tar.bz2 /etc/xcompile/ADD cross-env/cross-compiler-sparc.tar.bz2 /etc/xcompile/COPY go/go-shellwords-master.zip /root/mirai/go/COPY go/mysql-master.zip /root/mirai/go/COPY mirai/Mirai-Source-Code-master.zip /root/mirai/ENV GOPATH /root/go/ENV GOHOME /usr/local/goENV PATH $GOHOME/bin/:$PATHRUN cd /root/ && \\yum install -y unzip && \\mkdir -p /root/go/{bin,pkg,src} && \\mkdir -p /root/go/src/github.com/go-sql-driver && \\mkdir -p /root/go/src/github.com/mattn && \\unzip mirai/go/mysql-master.zip -d /root/go/src/github.com/go-sql-driver && \\unzip mirai/go/go-shellwords-master.zip -d /root/go/src/github.com/mattn && \\cd /root/go/src/github.com/go-sql-driver && mv mysql-master mysql && \\cd /root/go/src/github.com/mattn && mv go-shellwords-master go-shellwords  && \\yum -y install gcc git bzip2 mysql-server mysql mysql-devel glibc-static ElectricFence  && \\cd /root/mirai/ && unzip Mirai-Source-Code-master.zip && \\mv Mirai-Source-Code-master Mirai-Source-CodeENV PATH $PATH:/etc/xcompile/cross-compiler-armv4l/bin:/etc/xcompile/cross-compiler-armv5l/bin:/etc/xcompile/cross-compiler-armv6l/bin:/etc/xcompile/cross-compiler-i586/bin:/etc/xcompile/cross-compiler-m68k/bin:/etc/xcompile/cross-compiler-mips/bin:/etc/xcompile/cross-compiler-mipsel/bin:/etc/xcompile/cross-compiler-powerpc/bin:/etc/xcompile/cross-compiler-sh4/bin:/etc/xcompile/cross-compiler-sparc/binWORKDIR /root/mirai/Mirai-Source-Code

构建镜像

mirai

路径下,执行命令构建镜像。

docker build -t mirai:base .

完成后,即可构建一个mirai:base的镜像供使用。

参考文章

[1] Mirai-botnet 环境搭建步骤

赞(0) 打赏
未经允许不得转载:爱站程序员基地 » Mirai环境搭建