一個月沒有寫學習記錄了,但是這一個月一直沒閑着,抽空寫寫自己裝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.