Win10系统在vmware/virtualbox上使用packer和vagrant安装Metasploitable3

文章目录

  • Win10系统在vmware/virtualbox上使用packer和vagrant安装Metasploitable3
    • Installation win10 - vmware-iso / virtualbox-iso
      • 迁移vmx
    • Operation

安装时可以选用vmware/virtualbox运行下载的.iso,或者virtualbox运行下载的.box(未展示)。

Installation win10 - vmware-iso / virtualbox-iso

Preparation: metasploitable3, packer, vmware/[virtualbox, vagrant, vagrant-reload].
注:若使用 vitualbox-iso, 须在C盘安装 virtualbox, packer, vagrant.

在powershell里面cd到metasploitable3目录下,输入

packer build --only=vmware-iso ./packer/templates/windows_2008_r2.json   # vmawre
.\build.ps1 windows2008  # powershell - virtualbox

其中在这一步会出现很多问题。

https://github.com/rapid7/metasploitable3 中的packer/templates出了很多问题,可能是因为packer的版本不匹配,听说packer v1.5.3可以解决这个问题,但没有尝试,以下是自己遇到的问题的记录。

  • 问题一

    在使用https://github.com/rapid7/metasploitable3中直接下载的packer -> templates 时,
    如果安装vmware-iso版本,会显示:

    unknown configuration key: '"iso_checksum_type"'
    

    如果安装virtualbox-iso版本,会显示:

    Deprecated configuration key: 'iso_checksum_type'. Please call `packer fix`
    against your template to update your template to be compatible with the current
    version of Packer. Visit https://www.packer.io/docs/commands/fix/ for more
    detail.
    

    于是使用packer fix 文件夹packer\templates 中的windows_2008_r2.json, ubuntu_1404.json, 文件夹packer\templates\pro 中的windows_2008_r2_pro.json, ubuntu_1404_pro.json

  • 问题二

    如果安装vmware-iso版本,会显示:

    Failed to parse file as legacy JSON template: if you are using an HCL template, check your file extensions; they should be either *.pkr.hcl or *.pkr.json; see the docs for more details: https://www.packer.io/docs/templates/hcl_templates.
    Original error: Error parsing JSON: invalid character 'ÿ' looking for beginning of value
    At line 1, column 1 (offset 1):1: �^
    

    如果安装virtualbox-iso版本,会显示与上面同样错误,并加上以下提示:

    Error building the Vagrant box using Packer. Please check the output above for any error messages.
    所在位置 D:\Virtual Machines\Metasploitable3\metasploitable3\build.ps1:157 字符: 10
    +          throw "Error building the Vagrant box using Packer. Please c ...
    +          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : OperationStopped: (Error building ...error messages.:String) [], RuntimeException+ FullyQualifiedErrorId : Error building the Vagrant box using Packer. Please check the output above for any error messages.
    

    查询一番有说linux的LF没有换成windows的CRLF(我打开文件,原本即是CRLF,确定更换后问题没有改变),也有可能是编码没设为UTF-8,于是对于packer fix的两个windows文件(fix的另外两个linux忽略)都进行了更换。

  • 问题三

    如果安装vmware-iso版本,会显示:

    Warning: Warning when preparing build: "vmware-iso"Your vmx data contains the following variable(s), which Packer normally sets
    when it generates its own default vmx template. This may cause your build to
    fail or behave unpredictably: numvcpus, memsize, scsi0.virtualDevvmware-iso: output will be in this color.==> vmware-iso: Retrieving ISO
    ==> vmware-iso: Trying http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso
    ==> vmware-iso: Trying http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso?checksum=md5%3A4263be2cf3c59177c45085c0a7bc6ca5
    ==> vmware-iso: Download failed bad response code: 404
    ==> vmware-iso: error downloading ISO: [bad response code: 404]
    Build 'vmware-iso' errored after 1 second 859 milliseconds: error downloading ISO: [bad response code: 404]==> Wait completed after 1 second 859 milliseconds==> Some builds didn't complete successfully and had errors:
    --> vmware-iso: error downloading ISO: [bad response code: 404]==> Builds finished but no artifacts were created.
    

    如果安装virtualbox-iso版本,会显示:

    virtualbox-iso: output will be in this color.==> virtualbox-iso: Retrieving Guest additions
    ==> virtualbox-iso: Trying C:\Program Files\Oracle\VirtualBox/VBoxGuestAdditions.iso
    ==> virtualbox-iso: Trying file://C:/Program%20Files/Oracle/VirtualBox/VBoxGuestAdditions.iso
    ==> virtualbox-iso: file://C:/Program%20Files/Oracle/VirtualBox/VBoxGuestAdditions.iso => C:/Program Files/Oracle/VirtualBox/VBoxGuestAdditions.iso
    ==> virtualbox-iso: Retrieving ISO
    ... # same as above except 'virtualbo-iso' rather than 'vmware-iso'
    # And some more info
    Error building the Vagrant box using Packer. Please check the output above for any error messages.
    所在位置 D:\Virtual Machines\Metasploitable3\metasploitable3\build.ps1:157 字符: 10
    +          throw "Error building the Vagrant box using Packer. Please c ...
    +          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : OperationStopped: (Error building ...error messages.:String) [], Runtime Exception+ FullyQualifiedErrorId : Error building the Vagrant box using Packer. Please check the output above for any error messages.
    

    报错汇总:vmware: 含有已有默认数据的部分vmx data(后文忽略了);Retrieving ISO : 404
    virtualbox:Retrieving ISO : 404Error building the Vagrant box using Packer - 文件位置:metasploitable3\build.ps1:157 字符: 10。

    先看错误Error building the Vagrant box using Packer用Packer搭建时出现问题,源于从未修改的metasploitable3\build.ps1:157 字符: 10,代码如下:

    If ($(Test-Path "packer\builds\$($os_full)_virtualbox_$boxversion.box") -eq $True) {Write-Host "It looks like the Vagrant box already exists. Skipping the Packer build."} else {cmd.exe /c $packer build --only=virtualbox-iso packer\templates\$os_full.jsonif($?) {Write-Host "Box successfully built by Packer."} else {throw "Error building the Vagrant box using Packer. Please check the output above for any error messages."}}
    

    但其实这应该和 Retrieving ISO : 404 是同一个问题。可以看到两个渠道都有的很明显的 Retrieving ISO : 404 的错误,在一处CSDN博客Metasploitable3 + VMware 安装教程上发现了重要的有关404的消息:文件windows_2008_r2.json中的下载链接(windows Server 2008 r2.iso的iso_url: http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso , iso_checksum: 4263be2cf3c59177c45085c0a7bc6ca5 )已经被微软官方移除了,无法使用。


所以在网上寻找windows_2008_r2.iso并下载至本地(注意各种虚拟机iso等类型映像和文件的管理),并改变windows_2008_r2.json中的iso_url, iso_checksum。

此时输入packer build --only=vmware-iso ./packer/templates/windows_2008_r2.json.\build.ps1 windows2008,成功。之后都用vmware进行iso安装方法的操作,virtualbox的iso安装方法大致相同。

注:因为这里从powershell启动,不要关闭窗口。如果没有迁移映像文件,每次关闭powershell后,虚拟机文件都会被删除。

迁移vmx

在powershell仍在运行过程中,vmware会在metasploitable3文件夹中产生如下新文件夹,复制output-vmware-iso文件夹并可以选择改名。在关闭powershell之后,图中文件夹会自动删除,复制的文件夹被保留,之后用vmware进行虚拟机扫描即可。

vmware会在metasploitable文件夹中产生如下新文件夹:

Operation

我选择的iso版本初次进入界面如下。


加载好之后会显示桌面,我们可以通过CTRL+ALT+DELETE登录、切换用户如下图。

其中用户vagrant的用户名和密码相同:vagrant。

Win10系统在vmware/virtualbox上使用packer和vagrant安装Metasploitable3相关推荐

  1. win服务器上的虚拟机反应慢,Win10系统打开VMware虚拟机特别慢的解决方法

    Win10系统打开VMware虚拟机特别慢怎么办?为了防止病毒和测试软件,很多朋友都安装了VMware等虚拟机,有朋友在Win10系统中安装了VMware虚拟机,但是最近发现在打开VMware的时候特 ...

  2. 计算机连接不上蓝牙鼠标,win10系统蓝牙鼠标连接不上的图文教程

    有关win10系统蓝牙鼠标连接不上的操作方法想必大家有所耳闻.但是能够对win10系统蓝牙鼠标连接不上进行实际操作的人却不多.其实解决win10系统蓝牙鼠标连接不上的问题也不是难事,小编这里提示两点: ...

  3. win10计算机删除用户密码,win10系统彻底清除电脑上存储的用户名和密码的步骤...

    有关win10系统彻底清除电脑上存储的用户名和密码的操作方法想必大家有所耳闻.但是能够对win10系统彻底清除电脑上存储的用户名和密码进行实际操作的人却不多.其实解决win10系统彻底清除电脑上存储的 ...

  4. Win10系统解决VMware启动centOS7,本机电脑蓝屏问题

    Win10系统解决VMware启动centOS7,本机电脑蓝屏问题 根据网上查到的原因是电脑驱动不兼容的问题等等五花八门的问题,但具体原因不明确,我下载的是VMware15.0.4,启动centOS7 ...

  5. Win10系统:VMware workstation 15平台安装win7 X64系统

    #[虚拟机安装]Win10系统:VMware workstation 15平台安装win7 X64系统 一.Vmware虚拟机平台下载 VMware workstation 软件官方网站下载网址: h ...

  6. Win10系统通过VMware安装Centos7,部署KVM安装WIN7虚拟机

    Win10系统通过VMware安装Centos7,部署KVM安装WIN7虚拟机 一.环境准备 本机Win10系统 下载Centos7镜像,Win7镜像,VMWare软件,XShell软件,VNCVie ...

  7. win10系统下JAVA之JDK压缩包制作方法及安装教程(环境配置)

    win10系统下JAVA之JDK压缩包制作方法及安装教程 有时进行JAVA开发,我们可能会用到不同版本的JDK,每次切换不同版本时,总不能删除之前的,重新下载一个新版本,所以通过压缩包免安装方式进行多 ...

  8. 解决Win10系统由于INF文件失效导致安卓MTP驱动安装失败的问题

    解决Win10系统由于INF文件失效导致安卓MTP驱动安装失败的问题 前话 今天电脑C盘莫名就满了.作为Windows insider自然习以为常.肯定又是系统在后台悄悄下载新的更新包造成的.属性里的 ...

  9. 如何在64位win10系统下通过virtualbox虚拟机安装苹果macOS 10.12

    今天突然想玩一玩苹果的Mac OS系统,由于没钱买苹果机,只好通过虚拟机来装一个玩玩,说干就干,开始走起. 一.交待一下背景环境 主机系统:Win10 64位系统 虚拟环境:Virtualbox V5 ...

最新文章

  1. 企业金融云存储建设之路
  2. python和java哪个好学、零基础-老男孩零基础学习|python和java那个更有发展前景?...
  3. HDFS【2.5.1】系列1:HDFS的核心数据结构---元数据
  4. 新人如何快速上手新项目?
  5. 如何在私服上传jar包
  6. python自定义异常类时、可以继承的类是_Python异常类型及处理、自定义异常类型、断言...
  7. 使用计算机的方法视频,怎么直接把电脑的视频共享给电视?巧用当贝市场,四种方法供你选...
  8. Stanford CS230深度学习(六)目标检测、人脸识别和神经风格迁移
  9. Uber发布的CoordConv遭深度质疑,“翻译个坐标也需要训练?”
  10. 基于EfficientNet网络的植物叶部病害分类
  11. 语言密码加密变星号_为什么汉字不能设成密码,你想过吗?
  12. python入门学习(五 字符串string和变量variable)
  13. mysql opxe_PXE安装系统
  14. 微星GE60有线网卡Qualcomm Atheros Bigfoot Killer E2200 ethernet card在ubuntu下无法找到驱动的解决办法...
  15. XM7 FOR ANDROID,[转]2014年初Android平台主机模拟器大全
  16. Mac设计的必备设计软件,看看你还差什么
  17. wordpress开启全站https
  18. 程序员的奋斗史(二十八)——寒门再难出贵子?
  19. Apache 实现AJAX跨域请求
  20. linux termios结构

热门文章

  1. 微信小程序实用代码段(持续更新中)
  2. 跨境支付解决方案需要通过区块链
  3. android仿微博发动态,Android GridView扩展仿微信微博发图动态添加删除图片功能
  4. DNS BIND之运维管理脚本
  5. 【苹果手机端键盘只显示数字】
  6. ftp文件服务器跨平台,跨平台FTP服务器端(Wing FTP Server)
  7. 没钱开发VS肆意挥霍,揭秘“穷项目”和“富项目”差距有多大?
  8. NodeJs基础入门
  9. 感染[熊猫烧香变种 spoclsv.exe]
  10. 斗鱼交出上市以来最差财报:营收首次出现同比下滑,亏损约1亿元