Module: Ronin::Payloads::Metadata::OS::ClassMethods

Defined in:
lib/ronin/payloads/metadata/os.rb

Overview

Class methods which will be added to the payload class which includes Ronin::Payloads::Metadata::OS.

Instance Method Summary collapse

Instance Method Details

#os(new_os = nil) ⇒ :unix, ...

Gets or sets the payload's targeted Operating System (OS).

Examples:

os :linux

Parameters:

  • new_os (:unix, :bsd, :freebsd, :openbsd, :netbsd, :linux, :macos, :windows, nil) (defaults to: nil)

    The optional new Operating System (OS) to set.

Returns:

  • (:unix, :bsd, :freebsd, :openbsd, :netbsd, :linux, :macos, :windows, nil)

    The payload's Operating System (OS).



62
63
64
65
66
67
68
69
70
# File 'lib/ronin/payloads/metadata/os.rb', line 62

def os(new_os=nil)
  if new_os
    @os = new_os
  else
    @os ||= if superclass.kind_of?(ClassMethods)
              superclass.os
            end
  end
end

#os_version(new_os_version = nil) ⇒ String?

Gets or sets the payload's targeted Operating System (OS) version.

Examples:

os :linux
os_version '5.x'

Parameters:

  • new_os_version (String, nil) (defaults to: nil)

    The optional new Operating System (OS) version to set.

Returns:

  • (String, nil)

    The payload's Operating System (OS) version.



87
88
89
90
91
92
93
94
95
# File 'lib/ronin/payloads/metadata/os.rb', line 87

def os_version(new_os_version=nil)
  if new_os_version
    @os_version = new_os_version
  else
    @os_version ||= if superclass.kind_of?(ClassMethods)
                      superclass.os_version
                    end
  end
end