socat反向shell运行python脚本

时间:2015-03-11 06:33:10

标签: python netcat socat

我是使用socat的新手,并且想知道这是否可能。所以我的方案是我正在研究我的OSCP,并且有一台机器,我可以重新打开反向shell,让我们说端口8888.我试图阻止在这台Windows XP机器上写入磁盘。无论如何我可以设置socat连接,所以当机器连接回我时,它将能够运行我的python枚举脚本,收集输出,并将输出写回我的本地磁盘?

谢谢

1 个答案:

答案 0 :(得分:0)

不确定您的方案详细信息,但socat具有EXEC地址类型:

       EXEC:<command-line>
          Forks  a  sub process that establishes communication with its parent process and invokes the specified program with execvp() .  <command-line> is a simple command with argu-
          ments separated by single spaces. If the program name contains a '/', the part after the last '/' is taken as ARGV[0]. If the program name is a relative path,  the  execvp()
          semantics  for  finding  the program via $PATH apply. After successful program start, socat writes data to stdin of the process and reads from its stdout using a UNIX domain
          socket generated by socketpair() per default. (example)
          Option groups: FD,SOCKET,EXEC,FORK,TERMIOS
          Useful options: path, fdin, fdout, chroot, su, su-d, nofork, pty, stderr, ctty, setsid, pipes, login, sigint, sigquit
          See also: SYSTEM

所以在你的情况下,如果我理解它,你会想做类似的事情:

  

socat TCP-LISTEN:8888 EXEC:/ path / to / your / python / script