简体   繁体   English

socat反向shell运行python脚本

[英]socat reverse shell run python script

I am new to using socat and was wondering if this was even possible. 我是socat的新手,想知道是否有可能。 So my scenario is I am working on my OSCP and have a machine that I can get a reverse shell back on, let's say port 8888. I am trying to keep from writing to disk on this windows xp machine. 因此,我的情况是我正在使用OSCP并拥有一台可以重新安装反向外壳的机器,例如端口8888。我试图避免在此Windows XP机器上写入磁盘。 Is there anyway I can set the socat connection so when the machine connects back to me it will be able run my python enumeration script, collect the output, and write the output back to my local disk? 无论如何,我可以设置socat连接,以便当机器重新连接到我时,它将能够运行我的python枚举脚本,收集输出并将输出写回到本地磁盘吗?

Thank you 谢谢

Not sure about your scenario details, but socat has the EXEC address type: 不确定您的方案详细信息,但是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

so in your case if I understand it, you would want to do something like: 因此,如果您理解我的意思,您可能想做些类似的事情:

socat TCP-LISTEN:8888 EXEC:/path/to/your/python/script socat TCP-LISTEN:8888 EXEC:/路径/到/你的/ python /脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM