首页 > 解决方案 > 设置 Exploit Education Phoenix 中的 powershell 脚本问题

问题描述

嘿,我想开始在这个网站上做 ctf:https ://exploit.education/phoenix/

但是我遇到了一个问题,我无法进行设置。这是如何设置 ctf 的链接 - https://blog.lamarranet.com/index.php/exploit-education-phoenix-setup/ 我按照这些步骤操作,直到 powershell 代码: powershell代码img

但我不断从 powershell 收到错误: 厄罗斯

我把文件放在 D:\Guy - 我的cp

我的外壳代码 -

\Program
     D:\Guy\qemu\qemu-system-x86_64.exe 
    -kernel vmlinuz-4.9.0-8-amd64 
    -initrd initrd.img-4.9.0-8-amd64 
    -append "root=/dev/vda1" 
    -m 1024M `
    -netdev user,id=unet,hostfwd=tcp:127.0.0.1:2222-:22 
    -device virtio-net,netdev=unet 
    -drive file=exploit-education-phoenix-amd64.qcow2,if=virtio,format=qcow2,index=0

我的PowerShell代码

如果有人可以帮助我,那将是惊人的。谢谢!!!

标签: powershellqemuphoenixexploitctf

解决方案


不幸的是,这篇文章让人们发现了 powershell 中最常见的陷阱之一,即反引号

`

\Program` Files\qemu\qemu-system-x86_64.exe `
    -kernel vmlinuz-4.9.0-8-amd64 `
    -initrd initrd.img-4.9.0-8-amd64 `
    -append "root=/dev/vda1" `
    -m 1024M `
    -netdev user,id=unet,hostfwd=tcp:127.0.0.1:2222-:22 `
    -device virtio-net,netdev=unet `
    -drive file=exploit-education-phoenix-amd64.qcow2,if=virtio,format=qcow2,index=0

它们用于转义Program Files每行末尾的空格和换行符。从网站复制和粘贴很容易导致问题,例如在它们之后添加空格、断行续行。我建议使用 splatting,因为它更容易阅读,而且不容易出错。

$params = @{
    kernel = 'vmlinuz-4.9.0-8-amd64'
    initrd = 'initrd.img-4.9.0-8-amd64'
    append = "root=/dev/vda1"
    m      = '1024M'
    netdev = 'user,id=unet,hostfwd=tcp:127.0.0.1:2222-:22'
    device = 'virtio-net,netdev=unet'
    drive  = 'file=exploit-education-phoenix-amd64.qcow2,if=virtio,format=qcow2,index=0'
}

& '\Program Files\qemu\qemu-system-x86_64.exe' @params

还使用了调用运算符&并引用了可执行路径,因为它包含一个空格。


推荐阅读