Class: Ronin::Payloads::Java::ReverseShell

Inherits:
Ronin::Payloads::JavaPayload show all
Includes:
Mixins::BuildDir, Mixins::ERB, Mixins::ReverseShell
Defined in:
lib/ronin/payloads/builtin/java/reverse_shell.rb

Overview

A basic Java reverse shell.

Constant Summary collapse

TEMPLATE =

Path to the Payload.java.erb ERB template file.

File.join(__dir__,'reverse_shell','Payload.java.erb')

Instance Attribute Summary collapse

Attributes included from Mixins::BuildDir

#build_dir

Attributes included from Mixins::PostEx

#session

Attributes inherited from Payload

#encoders, #payload

Instance Method Summary collapse

Methods included from Mixins::BuildDir

#perform_build, #perform_cleanup

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::JavaPayload

#compile_java, javac, 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 Attribute Details

#class_fileString? (readonly)

The path to the generated .class file.

Returns:

  • (String, nil)


58
59
60
# File 'lib/ronin/payloads/builtin/java/reverse_shell.rb', line 58

def class_file
  @class_file
end

#java_fileString? (readonly)

The path to the generated .java file.

Returns:

  • (String, nil)


53
54
55
# File 'lib/ronin/payloads/builtin/java/reverse_shell.rb', line 53

def java_file
  @java_file
end

Instance Method Details

#buildObject

Builds the Java reverse shell payload.



63
64
65
66
67
68
69
70
71
# File 'lib/ronin/payloads/builtin/java/reverse_shell.rb', line 63

def build
  @java_file  = File.join(build_dir,'Payload.java')
  @class_file = File.join(build_dir,'Payload.class')

  File.write(@java_file,erb(TEMPLATE))
  compile(@java_file, dest_dir: build_dir)

  @payload = File.binread(@class_file)
end