Class: Ronin::Payloads::Shellcode::ReverseShellPayload

Inherits:
Ronin::Payloads::ShellcodePayload show all
Includes:
Mixins::Network, Mixins::ResolveHost, Mixins::ReverseShell
Defined in:
lib/ronin/payloads/shellcode/reverse_shell_payload.rb

Overview

Base class for all reverse shell shellcode payloads.

Instance Attribute Summary

Attributes included from Mixins::PostEx

#session

Attributes inherited from Payload

#encoders, #payload

Instance Method Summary collapse

Methods included from Mixins::Network

#pack_ipv4, #pack_ipv6, #pack_port

Methods included from Mixins::ResolveHost

#host_address, #host_addresses, #host_ip_address, #host_ip_addresses, #host_ipv4_address, #host_ipv4_addresses, #host_ipv6_address, #host_ipv6_addresses

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

payload_type, #shellcode

Methods inherited from ASMPayload

#assemble, assembler, payload_type

Methods included from Metadata::OS

included, #os, #os_version

Methods included from Metadata::Arch

#arch, included

Methods inherited from BinaryPayload

payload_type

Methods inherited from Payload

#build, #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

#packed_ipv4(**kwargs) ⇒ String

The reverse shell host's packed IPv4 address in network byte-order.

Parameters:

Options Hash (**kwargs):

  • :negate (Boolean)

    Inverts the bits of the IP address.

Returns:

  • (String)

    The packed IPv4 address in network byte-order.

Raises:

  • (BuildFailed)

    The payload's host param either has no IPv4 addresses or was not an IPv4 address.



57
58
59
60
61
62
63
# File 'lib/ronin/payloads/shellcode/reverse_shell_payload.rb', line 57

def packed_ipv4(**kwargs)
  unless (ip = host_ipv4_address)
    raise(BuildFailed,"host name has no IPv4 addresses: #{params[:host].inspect}")
  end

  pack_ipv4(ip,**kwargs)
end

#packed_ipv6(**kwargs) ⇒ String

The reverse shell host's packed IPv6 address in network byte-order.

Parameters:

Options Hash (**kwargs):

  • :negate (Boolean)

    Inverts the bits of the IP address.

Returns:

  • (String)

    The packed IPv6 address in network byte-order.

Raises:

  • (BuildFailed)

    The payload's host param either has no IP addresses or was not an IP address.



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/ronin/payloads/shellcode/reverse_shell_payload.rb', line 81

def packed_ipv6(**kwargs)
  unless (ip = host_ipv6_address)
    unless (ip = host_ipv4_address)
      raise(BuildFailed,"host name has no IP addresses: #{params[:host].inspect}")
    end

    ip = "::ffff:#{ip}"
  end

  pack_ipv6(ip,**kwargs)
end

#packed_port(**kwargs) ⇒ String

The reverse shell's packed port number in network byte-order.

Parameters:

Options Hash (**kwargs):

  • :negate (Boolean)

    Inverts the bits of the port number.

Returns:

  • (String)

    The packed port number in network byte-order.



105
106
107
# File 'lib/ronin/payloads/shellcode/reverse_shell_payload.rb', line 105

def packed_port(**kwargs)
  pack_port(port,**kwargs)
end