安装metasploitable3的经验总结

一个月没有写学习记录了,但是这一个月一直没闲着,抽空写写自己装metasploitable3的经验教训(提示:只要你的环境配置没错,步骤没错,多试几次就会成功了,我总共测试了15次,,短的耗时30分钟,长的3个小时以上。失败激起了我的好胜心,终于在今天凌晨5点大家还在睡觉的时候突然成功了,瞬间不困了,嘿嘿)

最近两天在win10系统下装metasploitable3,两天尝试了各种方法,总结如下:
在你喜欢的地方建一个文件夹metasploitable3文件夹用来放git下来的文件

第一种环境配置:
win10(1089)
VMware-workstation15 pro
packer
vagrant
vagrant-reload
git(如果没有这个可以下载zip包,自己解压也可)

这种方法可以按照https://github.com/rapid7/metasploitable3上的具体步骤手动安装
在powershell(路径要在metasploitable3下)中执行packer build --only=vmware-iso ./packer/templates/windows_2008_r2.json
然后全称自动安装配置,无需干涉,这个过程的快慢取决你的网速。
结束之后执行vagrant box add packer/builds/windows_2008_r2_*_0.1.0.box --name=metasploitable3-win2k8
如何你已经安装vagrant-reload可以省略再次执行vagrant plugin install vagrant-reload命令
最后一步vagrant up大功告成

自动安装期间虚拟机的变化如图:

后边的就是安装界面,省略了

第二种环境配置

virtualbox(我只是把VMware删除了,然后就直接按照官网指导制动安装了)
win10(1089)
packer
vagrant
vagrant-reload

在powershell((路径要在metasploitable3下))中执行.\build.ps1 windows2008
和第一种环境一样全程自动(自动安装期间虚拟机变化和上边的一样),无需干涉
结束后执行vagrant up win2k8
大功告成

以上两种方式是自己安装做box的,可以保证和在自己的机器环境配置完美运行,可是这种方式太费神,容易失败。不适合小白,和追求效率的伙伴。
下面有一种方式是直接的,就是用人家已经做好的box,这样虽然简单有效,但是无法保证下好的box是否和自己的机器环境符合,也无法保证别人是否在里边留下什么东西。
环境要求:vagrant
virtualbox或者vmware-workststion
去https://app.vagrantup.com/boxes/search?utf8=%E2%9C%93&sort=downloads&provider=&q=metasploitable3寻找自己喜欢的box,这里有很多个人做好的box,建议选择rapid7/metasploitable3-win2k8
步骤1:在metasploitable3文件夹下打开powershell,运行vagrant init rapid7/metasploitable3-win2k8 --box-version 0.1.0-weekly命令
会生成一个vagrant的文件,自动配置好了信息
然后直接 vagrant up 自动下载。

以上是我这两天亲身实践的结果,最重要的一点就是网速一定要超级好,网速一定要超级好,网速一定要超级好。重要事情说三遍!!!
如果你在装的时候经常报错,提示不是没有这个文件就是没有那个文件,那十有八九就是网速不好造成的。不要灰心,按一下键盘上的向上键,重来。
祝你们好运!


PS C:\Users\nzknr\metasploitable3> vagrant init rapid7/metasploitable3-win2k8 --box-version 0.1.0-weekly
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
`vagrantup.com` for more information on using Vagrant.

PS C:\Users\nzknr\metasploitable3> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'rapid7/metasploitable3-win2k8' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: 0.1.0-weekly
==> default: Loading metadata for box 'rapid7/metasploitable3-win2k8'
default: URL: https://vagrantcloud.com/rapid7/metasploitable3-win2k8
==> default: Adding box 'rapid7/metasploitable3-win2k8' (v0.1.0-weekly) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/rapid7/boxes/metasploitable3-win2k8/versions/0.1.0-weekly/providers/virtualbox.box
==> default: Box download is resuming from prior download progress
default: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
default: Progress: 0% (Rate: 5d/s, Estimated time remaining: 0:31:12)

后边附上自己造box四次失败反馈信息,总结返现每次都不一样,均是网络异常造成的数据丢失。

第一次安装失败反馈失败信息
vagrant2.4

C:\Users\vagrant>sc config "domain1" obj= "NT Authority\LOCAL SERVICE"
[SC] OpenService FAILED 1060:(这是错误根源)
vmware-iso:
vmware-iso: The specified service does not exist as an installed service.
vmware-iso:
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Script exited with non-zero exit status: 36.Allowed exit codes are: [0]

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Script exited with non-zero exit status: 36.Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

第二次安装失败 vagrant 1.9.0
C:\Users\vagrant>cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\openjdk-1.6.0-unofficial-b27-windows-amd64.zip" -oC:\openjdk6"
==> vmware-iso:
==> vmware-iso: ERROR: The system cannot find the file specified. (错误根源)
vmware-iso:
==> vmware-iso: C:\Windows\Temp\openjdk-1.6.0-unofficial-b27-windows-amd64.zip
vmware-iso: 7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
==> vmware-iso:
vmware-iso:
vmware-iso: Scanning the drive for archives:
==> vmware-iso:
==> vmware-iso:
==> vmware-iso: System ERROR:
==> vmware-iso: The system cannot find the file specified.
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Script exited with non-zero exit status: 2.Allowed exit codes are: [0]

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Script exited with non-zero exit status: 2.Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

第三次

vmware-iso: C:\Users\vagrant>if exist a:\vagrant.pub (copy a:\vagrant.pub C:\Users\vagrant\.ssh\authorized_keys ) else (powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagrant\.ssh\authorized_keys')" 0<NUL )

==> vmware-iso: Exception calling "DownloadFile" with "2" argument(s): "Unable to connect to the remote server" (不能连接远程服务器)

==> vmware-iso: At line:1 char:47
==> vmware-iso: + (New-Object System.Net.WebClient).DownloadFile <<<< ('https://raw.githubuserc
==> vmware-iso: ontent.com/mitchellh/vagrant/master/keys/vagrant.pub', 'C:\Users\vagrant\.ssh\a
==> vmware-iso: uthorized_keys')
==> vmware-iso: + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
==> vmware-iso: + FullyQualifiedErrorId : DotNetMethodException
==> vmware-iso:
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.
PS C:\Users\nzknr\Documents\gitfiles\metasploitable3>


第四次

vmware-iso: jdk8 v8.0.211 [Approved]
vmware-iso: jdk8 package files install completed. Performing other installation steps.
vmware-iso: Downloading JDK from https://javadl.oracle.com/webapps/download/GetFile/1.8.0_211-b12/478a62b7d4e34b78b671c754eaaf38ab/windows-i586/jdk-8u211-windows-x64.exe(下载文件,等了有一个小时没下载成功,直接失败)
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Script exited with non-zero exit status: 2300218.Allowed exit codes are: [0]

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Script exited with non-zero exit status: 2300218.Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

猜你喜欢

转载自www.cnblogs.com/niucs/p/11097382.html