powershell - 设置 Exploit Education Phoenix 中的 powershell 脚本问题
问题描述
嘿,我想开始在这个网站上做 ctf:https ://exploit.education/phoenix/
但是我遇到了一个问题,我无法进行设置。这是如何设置 ctf 的链接 - https://blog.lamarranet.com/index.php/exploit-education-phoenix-setup/ 我按照这些步骤操作,直到 powershell 代码:
但我不断从 powershell 收到错误:
我把文件放在 D:\Guy -
我的外壳代码 -
\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 中最常见的陷阱之一,即反引号
`
\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
还使用了调用运算符&
并引用了可执行路径,因为它包含一个空格。
推荐阅读
- angularjs - 在混合模式下使用来自 Angular 组件的路由
- regex - 正则表达式需要在标签中搜索数字 id
- jmeter - JMeter - 显示 grafana 中的选定步骤
- oracle - 如何使用另一个表的插入触发器更新另一个表的值
- angular - 如何将组件导入Angular中的服务类
- facebook-graph-api - 如何使用 facebook graph api 3.3 版获取好友列表?
- android - 即使在高 API 级别的设备上,Androidx AppCompatButton 看起来也与 Button 不同
- coinbase-api - 如何通过 Coinbase API 进行转换
- arrays - 在 Swift 中用错误的设计结构解析 JSON
- javascript - 使用 Chart js 插件创建类似圆环图的圆弧