Class: Ronin::Exploits::CLI::Commands::Show Private
- Inherits:
-
ExploitCommand
- Object
- Core::CLI::Command
- Ronin::Exploits::CLI::Command
- ExploitCommand
- Ronin::Exploits::CLI::Commands::Show
- Includes:
- CommandKit::Printing::Fields, Core::CLI::Printing::Arch, Core::CLI::Printing::Metadata, Core::CLI::Printing::OS, Core::CLI::Printing::Params, Payloads::CLI::Printing
- Defined in:
- lib/ronin/exploits/cli/commands/show.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Prints information about an exploit.
Usage
ronin-exploits show [options] {NAME | --file FILE}
Options
-f, --file FILE The exploit file to load
-v, --verbose Enables verbose output
-h, --help Print help information
Arguments
[NAME] The exploit name to load
Constant Summary collapse
- EXPLOIT_TYPES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Known exploit types and their printable names.
{ exploit: 'Custom', # memory corruption exploits memory_corruption: 'Memory Corruption', stack_overflow: 'Stack Overflow', seh_overflow: 'SEH Overflow', heap_overflow: 'Heap Overflow', use_after_free: 'Use After Free', # web exploits web: 'Web', lfi: 'Local File Inclusion (LFI)', rfi: 'Remote File Inclusion (RFI)', sqli: 'SQL injection (SQLI)', xss: 'Cross-Site Scripting (XSS)', open_redirect: 'Open Redirect', ssti: 'Server-Side Template Injection (SSTI)' }
Instance Attribute Summary
Attributes inherited from ExploitCommand
Instance Method Summary collapse
-
#exploit_type(exploit_class) ⇒ String
private
Returns the printable exploit type for the exploit class.
-
#print_advisories(exploit) ⇒ Object
private
Prints any advisories defined by an exploit class.
-
#print_advisory(advisory) ⇒ Object
private
Prints an advisory.
-
#print_exploit(exploit) ⇒ Object
private
Prints the exploit class'es metadata.
-
#print_metadata(exploit) ⇒ Object
private
Print the main metadata fields for the exploit.
-
#print_shouts(exploit) ⇒ Object
private
Prints the shouts section.
-
#print_target(target) ⇒ Object
private
Prints an exploit target.
-
#run(name = nil) ⇒ Object
private
Runs the
ronin-exploits show
command.
Methods inherited from ExploitCommand
#initialize_exploit, #load_exploit, #load_exploit_from, #validate_exploit
Methods included from ExploitMethods
#initialize_exploit, #load_exploit, #load_exploit_from, #validate_exploit
Instance Method Details
#exploit_type(exploit_class) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the printable exploit type for the exploit class.
233 234 235 |
# File 'lib/ronin/exploits/cli/commands/show.rb', line 233 def exploit_type(exploit_class) EXPLOIT_TYPES.fetch(exploit_class.exploit_type,'unknown') end |
#print_advisories(exploit) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Prints any advisories defined by an exploit class.
179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/ronin/exploits/cli/commands/show.rb', line 179 def print_advisories(exploit) unless exploit.advisories.empty? puts "Advisories:" puts indent do exploit.advisories.each do |advisory| print_advisory(advisory) end end puts end end |
#print_advisory(advisory) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Prints an advisory.
243 244 245 246 247 |
# File 'lib/ronin/exploits/cli/commands/show.rb', line 243 def print_advisory(advisory) if advisory.url then puts "* #{advisory.id} (#{advisory.url})" else puts "* #{advisory.id}" end end |
#print_exploit(exploit) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Prints the exploit class'es metadata.
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 |
# File 'lib/ronin/exploits/cli/commands/show.rb', line 86 def print_exploit(exploit) puts "[ #{exploit.id} ]" puts indent do (exploit) print_advisories(exploit) (exploit) print_description(exploit) print_references(exploit) if defined?(Mixins::HasTargets) && exploit.include?(Mixins::HasTargets) unless exploit.targets.empty? exploit.targets.each_with_index do |target,index| puts "[ Target ##{index + 1} ]" puts indent { print_target(target) } end end end print_shouts(exploit) end print_params(exploit) end |
#print_metadata(exploit) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Print the main metadata fields for the exploit.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/ronin/exploits/cli/commands/show.rb', line 121 def (exploit) fields = { 'Type' => exploit_type(exploit) } if defined?(Core::Metadata::Version) && exploit.include?(Core::Metadata::Version) fields['Version'] = exploit.version if exploit.version end fields['Quality'] = exploit.quality if exploit.quality fields['Released'] = exploit.release_date if exploit.release_date fields['Disclosed'] = exploit.disclosure_date if exploit.disclosure_date if defined?(Metadata::Arch) && exploit.include?(Metadata::Arch) if (arch = target.arch) fields['Arch'] = arch end end if defined?(Metadata::OS) && exploit.include?(Metadata::OS) if (os = exploit.os) fields['OS'] = if (os_version = exploit.os_version) "#{os} #{os_version}" else os end end end if (software = exploit.software) fields['Software'] = software end if (versions = exploit.software_versions) case versions when Array fields['Software Versions'] = versions.join(', ') when Range fields['Software Versions'] = "#{versions.begin} - #{versions.end}" end end if defined?(Mixins::HasPayload) && exploit.include?(Mixins::HasPayload) fields['Payload Type'] = payload_type(exploit.payload_class) end fields['Summary'] = exploit.summary if exploit.summary print_fields(fields) end |
#print_shouts(exploit) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Prints the shouts section.
199 200 201 202 203 |
# File 'lib/ronin/exploits/cli/commands/show.rb', line 199 def print_shouts(exploit) if defined?(Metadata::Shouts) && exploit.include?(Metadata::Shouts) puts "Shouts: #{exploit.shouts.join(', ')}" end end |
#print_target(target) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Prints an exploit target.
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/ronin/exploits/cli/commands/show.rb', line 255 def print_target(target) fields = {} fields['Arch'] = target.arch if target.arch if target.os fields['OS'] = if target.os_version "#{target.os} #{target.os_version}" else target.os end end if target.software fields['Software'] = if target.version "#{target.software} #{target.version}" else target.software end end print_fields(fields) if verbose? unless target.empty? puts "Params:" indent { print_fields(target.to_h) } end end puts end |
#run(name = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Runs the ronin-exploits show
command.
74 75 76 77 78 |
# File 'lib/ronin/exploits/cli/commands/show.rb', line 74 def run(name=nil) super(name) print_exploit(exploit_class) end |