Class: Msf::Module::Platform
- Inherits:
-
Object
- Object
- Msf::Module::Platform
- Defined in:
- lib/msf/core/module/platform.rb
Overview
This is the definitions of which Platforms the framework knows about. The relative ranks are used to support ranges, and the Short names are used to allow for more convenient specification of the platforms.…
Direct Known Subclasses
AIX, Android, Apple_iOS, Arista, BSD, BSDi, Brocade, Cisco, Firefox, FreeBSD, HPUX, Hardware, Irix, Java, JavaScript, Juniper, Linux, Mainframe, Mikrotik, Multi, NetBSD, Netware, NodeJS, OSX, OpenBSD, PHP, Python, R, Ruby, Solaris, Unifi, Unix, Unknown, Windows
Defined Under Namespace
Classes: AIX, Android, Apple_iOS, Arista, BSD, BSDi, Brocade, Cisco, Firefox, FreeBSD, HPUX, Hardware, Irix, Java, JavaScript, Juniper, Linux, Mainframe, Mikrotik, Multi, NetBSD, Netware, NodeJS, OSX, OpenBSD, PHP, Python, R, Ruby, Solaris, Unifi, Unix, Unknown, Windows
Constant Summary collapse
- Rank =
0
- Short =
actually, having an argument of ” is what to do for wanting ‘all’
"all"
Class Attribute Summary collapse
-
.full_name ⇒ Object
Returns the value of attribute full_name.
Class Method Summary collapse
-
.find_children ⇒ Object
Finds all inherited children from a given module.
-
.find_platform(str) ⇒ Object
The magic to try to build out a Platform from a string.
- .inherited(subclass) ⇒ Object
-
.realname ⇒ Object
Returns the “real” name of the module instance, accounting for potentially aliased class names.
Instance Method Summary collapse
-
#find_children ⇒ Object
Calls the class method.
Class Attribute Details
.full_name ⇒ Object
Returns the value of attribute full_name.
17 18 19 |
# File 'lib/msf/core/module/platform.rb', line 17 def full_name @full_name end |
Class Method Details
.find_children ⇒ Object
Finds all inherited children from a given module.
142 143 144 145 |
# File 'lib/msf/core/module/platform.rb', line 142 def self.find_children @subclasses ||= [] @subclasses.sort_by { |a| a::Rank } end |
.find_platform(str) ⇒ Object
The magic to try to build out a Platform from a string.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/msf/core/module/platform.rb', line 52 def self.find_platform(str) # remove any whitespace and downcase str = str.gsub(' ', '').downcase # Match known platforms first, then fall back to string matching case str when 'windows', 'win' return Msf::Module::Platform::Windows when 'linux' return Msf::Module::Platform::Linux when 'unix' return Msf::Module::Platform::Unix when 'osx' return Msf::Module::Platform::OSX when 'solaris' return Msf::Module::Platform::Solaris when 'freebsd' return Msf::Module::Platform::FreeBSD when 'netware' return Msf::Module::Platform::Netware when 'bsd' return Msf::Module::Platform::BSD when 'openbsd' return Msf::Module::Platform::OpenBSD when 'android' return Msf::Module::Platform::Android when 'java' return Msf::Module::Platform::Java when 'r' return Msf::Module::Platform::R when 'ruby' return Msf::Module::Platform::Ruby when 'cisco' return Msf::Module::Platform::Cisco when 'juniper' return Msf::Module::Platform::Juniper when 'unifi' return Msf::Module::Platform::Unifi when 'brocade' return Msf::Module::Platform::Brocade when 'mikrotik' return Msf::Module::Platform::Mikrotik when 'arista' return Msf::Module::Platform::Arista when 'bsdi' return Msf::Module::Platform::BSDi when 'netbsd' return Msf::Module::Platform::NetBSD when 'aix' return Msf::Module::Platform::AIX when 'hpux' return Msf::Module::Platform::HPUX when 'irix' return Msf::Module::Platform::Irix when 'php' return Msf::Module::Platform::PHP when 'javascript' return Msf::Module::Platform::JavaScript when 'python' return Msf::Module::Platform::Python when 'nodejs' return Msf::Module::Platform::NodeJS when 'firefox' return Msf::Module::Platform::Firefox when 'mainframe' return Msf::Module::Platform::Mainframe when 'multi' return Msf::Module::Platform::Multi when 'hardware' return Msf::Module::Platform::Hardware when 'apple_ios' return Msf::Module::Platform::Apple_iOS when 'unknown' return Msf::Module::Platform::Unknown end # Start at the base platform module mod = ::Msf::Module::Platform # Scan forward, trying to find the end module while str.length > 0 mod, str = find_portion(mod, str) end return mod end |
.inherited(subclass) ⇒ Object
147 148 149 150 |
# File 'lib/msf/core/module/platform.rb', line 147 def self.inherited(subclass) @subclasses ||= [] @subclasses << subclass end |
.realname ⇒ Object
Returns the “real” name of the module instance, accounting for potentially aliased class names.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/msf/core/module/platform.rb', line 24 def self.realname # Use the cached version if one has been set return full_name if (full_name) # Otherwise, generate it and cache it names = [] c = Msf::Module::Platform name.split('::')[3 .. -1].each { |part| c = c.const_get(part) if (c.const_defined?('RealName') == true) names << c.const_get('RealName') else names << part end } full_name = names.join(' ') end |
Instance Method Details
#find_children ⇒ Object
Calls the class method.
45 46 47 |
# File 'lib/msf/core/module/platform.rb', line 45 def find_children self.class.find_children end |