设置中的 powershell 脚本问题 Exploit Education Phoenix

问题描述

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

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

powershell code img

但我不断收到来自 powershell 的错误

Erros

我把文件放在 D:\Guy -

My cp

我的shell代码-

\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

my powershell code

如果有人可以帮助我,那就太棒了。 谢谢!!!

解决方法

不幸的是,article 使人们陷入了 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,hostfwd=tcp:127.0.0.1:2222-:22'
    device = 'virtio-net,netdev=unet'
    drive  = 'file=exploit-education-phoenix-amd64.qcow2,index=0'
}

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

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

,

我试过了:

$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'
}
& '\D:\Guy\qemu\qemu-system-x86_64.exe' @params

它没有给出错误,但它仍然不起作用(也许我对 file_path 有误)