Skip to content

Commit

Permalink
Fix rapid7#5197, Fixed yard doc errors
Browse files Browse the repository at this point in the history
Fix rapid7#5197 Fixed issues that caused errors during yard doc generation
  • Loading branch information
tdoan-r7 authored and wchen-r7 committed Apr 21, 2016
1 parent 62eae86 commit 5e36a31
Show file tree
Hide file tree
Showing 22 changed files with 56 additions and 57 deletions.
2 changes: 1 addition & 1 deletion lib/metasploit/framework/community_string_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Framework

# This class is responsible for taking datastore options from the snmp_login module
# and yielding appropriate {Metasploit::Framework::Credential}s to the {Metasploit::Framework::LoginScanner::SNMP}.
# This one has to be different from {credentialCollection} as it will only have a {Metasploit::Framework::Credential#public}
# This one has to be different from credentialCollection as it will only have a {Metasploit::Framework::Credential#public}
# It may be slightly confusing that the attribues are called password and pass_file, because this is what the legacy
# module used. However, community Strings are now considered more to be public credentials than private ones.
class CommunityStringCollection
Expand Down
4 changes: 2 additions & 2 deletions lib/metasploit/framework/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ module Database
# Module Methods
#

# Returns first configuration pathname from {configuration_pathnames} or the overridding `:path`.
# Returns first configuration pathname from configuration_pathnames or the overridding `:path`.
#
# @param options [Hash{Symbol=>String}]
# @option options [String] :path Path to use instead of first element of {configurations_pathnames}
# @option options [String] :path Path to use instead of first element of configurations_pathnames
# @return [Pathname] if configuration pathname exists.
# @return [nil] if configuration pathname does not exist.
def self.configurations_pathname(options={})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def check_setup

# Returns the latest sid from MSP
#
# @param [Rex::Proto::Http::Response]
# @param res [Rex::Proto::Http::Response]
# @return [String] The session ID for MSP
def get_sid(res)
cookies = res.get_cookies
Expand All @@ -41,7 +41,7 @@ def get_sid(res)

# Returns the hidden inputs
#
# @param [Rex::Proto::Http::Response]
# @param res [Rex::Proto::Http::Response]
# @return [Hash] Input fields
def get_hidden_inputs(res)
found_inputs = {}
Expand Down
2 changes: 1 addition & 1 deletion lib/metasploit/framework/login_scanner/snmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def versions
end
end

# Attempt to login with every {Credential credential} in # {#cred_details}.
# Attempt to login with every {Credential credential} in # #cred_details.
#
# @yieldparam result [Result] The {Result} object for each attempt
# @yieldreturn [void]
Expand Down
4 changes: 2 additions & 2 deletions lib/metasploit/framework/spec/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def self.clean
# Adds actions to `spec` task so that `rake spec` fails if any of the following:
#
# # `log/leaked-constants.log` exists after printing out the leaked constants.
# # {Each.configured!} is unnecessary in `spec/spec_helper.rb` and should be removed.
# # Each.configured! is unnecessary in `spec/spec_helper.rb` and should be removed.
#
# @return [void]
def self.define_task
Expand Down Expand Up @@ -96,4 +96,4 @@ def self.full_name(child_constant_name)

full_name
end
end
end
6 changes: 3 additions & 3 deletions lib/metasploit/framework/spec/constants/each.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class << self
attr_accessor :leaks_cleaned
end

# Is {Metasploit::Framework::Spec::Constants::Each.configure!} still necessary or should it be removed?
# Is Metasploit::Framework::Spec::Constants::Each.configure! still necessary or should it be removed?
#
# @return [true] if {configure!}'s `before(:each)` cleaned up leaked constants
# @return [false] otherwise
Expand Down Expand Up @@ -91,7 +91,7 @@ def self.configured?
!!@configured
end

# Adds action to `spec` task so that `rake spec` fails if {configured!} is unnecessary in `spec/spec_helper.rb` and
# Adds action to `spec` task so that `rake spec` fails if configured! is unnecessary in `spec/spec_helper.rb` and
# should be removed
#
# @return [void]
Expand All @@ -116,4 +116,4 @@ def self.define_task
end
end
end
end
end
4 changes: 2 additions & 2 deletions lib/metasploit/framework/spec/constants/suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Metasploit::Framework::Spec::Constants::Suite

LOGS_PATHNAME = Pathname.new('log/metasploit/framework/spec/constants/suite')

# Logs leaked constants to {LOG_PATHNAME} and prints `message` to stderr.
# Logs leaked constants to LOG_PATHNAME and prints `message` to stderr.
#
# @param hook (see log_pathname)
# @param message [String] additional message printed to stderr when there is at least one leaked constant.
Expand Down Expand Up @@ -116,4 +116,4 @@ def self.print_leaked_constants(hook)

leaks
end
end
end
4 changes: 2 additions & 2 deletions lib/metasploit/framework/thread_factory_provider.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Wraps {Msf::Framework} so that {Msf::Framework#threads} is only created on the first call to {#spawn} by
# {Rex::ThreadFactory#spawn}, which allows the threads used by {Msf::ThreadManager} to be created lazily.
# Rex::ThreadFactory#spawn, which allows the threads used by {Msf::ThreadManager} to be created lazily.
#
# @example Setting Rex::ThreadFactory.provider and spawning threads
# Rex::ThreadFactory.provider = Metasploit::Framework::ThreadFactoryProvider.new(framework: framework)
Expand All @@ -23,4 +23,4 @@ class Metasploit::Framework::ThreadFactoryProvider < Metasploit::Model::Base
def spawn(name, critical, *args, &block)
framework.threads.spawn(name, critical, *args, &block)
end
end
end
18 changes: 9 additions & 9 deletions lib/msf/core/auxiliary/auth_brute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def setup
@@max_per_service = nil
end

# Yields each {Metasploit::Credential::Core} in the {Mdm::Workspace} with
# Yields each Metasploit::Credential::Core in the Mdm::Workspace with
# a private type of 'ntlm_hash'
#
# @yieldparam [Metasploit::Credential::Core]
Expand All @@ -60,7 +60,7 @@ def each_ntlm_cred
end
end

# Yields each {Metasploit::Credential::Core} in the {Mdm::Workspace} with
# Yields each Metasploit::Credential::Core in the Mdm::Workspace with
# a private type of 'password'
#
# @yieldparam [Metasploit::Credential::Core]
Expand All @@ -71,7 +71,7 @@ def each_password_cred
end
end

# Yields each {Metasploit::Credential::Core} in the {Mdm::Workspace} with
# Yields each Metasploit::Credential::Core in the Mdm::Workspace with
# a private type of 'ssh_key'
#
# @yieldparam [Metasploit::Credential::Core]
Expand All @@ -90,7 +90,7 @@ def prepend_db_creds?
(datastore['DB_ALL_CREDS'] || datastore['DB_ALL_PASS'] || datastore['DB_ALL_USERS']) && framework.db.active
end

# This method takes a {Metasploit::Framework::CredentialCollection} and prepends existing NTLMHashes
# This method takes a Metasploit::Framework::CredentialCollection and prepends existing NTLMHashes
# from the database. This allows the users to use the DB_ALL_CREDS option.
#
# @param cred_collection [Metasploit::Framework::CredentialCollection]
Expand All @@ -105,7 +105,7 @@ def prepend_db_hashes(cred_collection)
cred_collection
end

# This method takes a {Metasploit::Framework::CredentialCollection} and prepends existing SSHKeys
# This method takes a Metasploit::Framework::CredentialCollection and prepends existing SSHKeys
# from the database. This allows the users to use the DB_ALL_CREDS option.
#
# @param [Metasploit::Framework::CredentialCollection] cred_collection
Expand All @@ -120,7 +120,7 @@ def prepend_db_keys(cred_collection)
cred_collection
end

# This method takes a {Metasploit::Framework::CredentialCollection} and prepends existing Password Credentials
# This method takes a Metasploit::Framework::CredentialCollection and prepends existing Password Credentials
# from the database. This allows the users to use the DB_ALL_CREDS option.
#
# @param cred_collection [Metasploit::Framework::CredentialCollection]
Expand All @@ -135,9 +135,9 @@ def prepend_db_passwords(cred_collection)
cred_collection
end

# Takes a {Metasploit::Credential::Core} and converts it into a
# {Metasploit::Framework::Credential} and processes it into the
# {Metasploit::Framework::CredentialCollection} as dictated by the
# Takes a Metasploit::Credential::Core and converts it into a
# Metasploit::Framework::Credential and processes it into the
# Metasploit::Framework::CredentialCollection as dictated by the
# selected datastore options.
#
# @param [Metasploit::Framework::CredentialCollection] cred_collection the credential collection to add to
Expand Down
4 changes: 2 additions & 2 deletions lib/msf/core/auxiliary/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def myworkspace
# This method safely get the workspace ID. It handles if the db is not active
#
# @return [NilClass] if there is no DB connection
# @return [Fixnum] the ID of the current {Mdm::Workspace}
# @return [Fixnum] the ID of the current Mdm::Workspace
def myworkspace_id
if framework.db.active
myworkspace.id
Expand Down Expand Up @@ -169,7 +169,7 @@ def report_note(opts={})
# should be used directly instead.
#
# @param opts [Hash] the option hash
# @option opts [String] :host the address of the host (also takes a {Mdm::Host})
# @option opts [String] :host the address of the host (also takes a Mdm::Host)
# @option opts [Fixnum] :port the port of the connected service
# @option opts [Mdm::Service] :service an optional Service object to build the cred for
# @option opts [String] :type What type of private credential this is (e.g. "password", "hash", "ssh_key")
Expand Down
10 changes: 5 additions & 5 deletions lib/msf/core/db_manager/import/metasploit_framework/xml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def import_msf_note_element(note, allow_yaml, note_data={})
report_note(note_data)
end

# Imports web_form element using {Msf::DBManager#report_web_form}.
# Imports web_form element using Msf::DBManager#report_web_form.
#
# @param element [REXML::Element] web_form element.
# @param options [Hash{Symbol => Object}] options
Expand Down Expand Up @@ -124,7 +124,7 @@ def import_msf_web_form_element(element, options={}, &notifier)
end
end

# Imports web_page element using {Msf::DBManager#report_web_page}.
# Imports web_page element using Msf::DBManager#report_web_page.
#
# @param element [REXML::Element] web_page element.
# @param options [Hash{Symbol => Object}] options
Expand Down Expand Up @@ -171,7 +171,7 @@ def import_msf_web_page_element(element, options={}, &notifier)
end
end

# Imports web_vuln element using {Msf::DBManager#report_web_vuln}.
# Imports web_vuln element using Msf::DBManager#report_web_vuln.
#
# @param element [REXML::Element] web_vuln element.
# @param options [Hash{Symbol => Object}] options
Expand Down Expand Up @@ -577,8 +577,8 @@ def import_msf_text_element(parent_element, child_name)
end

# Imports web_form, web_page, or web_vuln element using
# {Msf::DBManager#report_web_form}, {Msf::DBManager#report_web_page}, and
# {Msf::DBManager#report_web_vuln}, respectively.
# Msf::DBManager#report_web_form, Msf::DBManager#report_web_page, and
# Msf::DBManager#report_web_vuln, respectively.
#
# @param element [REXML::Element] the web_form, web_page, or web_vuln
# element.
Expand Down
6 changes: 3 additions & 3 deletions lib/msf/core/db_manager/import/nexpose/raw.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ def nexpose_host_from_rawxml(h, vstructs, wspace,task=nil)
# Takes an array of vuln hashes, as returned by the NeXpose rawxml stream
# parser, like:
# [
# {"id"=>"winreg-notes-protocol-handler", severity="8", "refs"=>[{"source"=>"BID", "value"=>"10600"}, ...]}
# {"id"=>"windows-zotob-c", severity="8", "refs"=>[{"source"=>"BID", "value"=>"14513"}, ...]}
# "id"=>"winreg-notes-protocol-handler", severity="8", "refs"=>["source"=>"BID", "value"=>"10600", ...]
# "id"=>"windows-zotob-c", severity="8", "refs"=>["source"=>"BID", "value"=>"14513", ...]
# ]
# and transforms it into a struct, containing :id, :refs, :title, and :severity
#
Expand Down Expand Up @@ -227,4 +227,4 @@ def nexpose_refs_to_struct(vulns)
end
return ret
end
end
end
6 changes: 3 additions & 3 deletions lib/msf/core/db_manager/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_session(opts)
# :session host is contained. Also used as the workspace for the
# Mdm::ExploitAttempt and Mdm::Vuln. Defaults to Mdm::Worksapce with
# Mdm::Workspace#name equal to +session.workspace+.
# @return [nil] if {Msf::DBManager#active} is +false+.
# @return [nil] if Msf::DBManager#active is +false+.
# @return [Mdm::Session] if session is saved
# @raise [ArgumentError] if :session is not an {Msf::Session}.
# @raise [ActiveRecord::RecordInvalid] if session is invalid and cannot be
Expand Down Expand Up @@ -68,7 +68,7 @@ def get_session(opts)
# exploit that was used to open the session.
# @option option [String] :via_payload the {MSf::Module#fullname} of the
# payload sent to the host when the exploit was successful.
# @return [nil] if {Msf::DBManager#active} is +false+.
# @return [nil] if Msf::DBManager#active is +false+.
# @return [Mdm::Session] if session is saved.
# @raise [ArgumentError] if :host is not an Mdm::Host.
# @raise [ActiveRecord::RecordInvalid] if session is invalid and cannot be
Expand Down Expand Up @@ -103,7 +103,7 @@ def report_session(opts)

protected

# @param session [Msf::Session] A session with a {db_record Msf::Session#db_record}
# @param session [Msf::Session] A session with a db_record Msf::Session#db_record
# @param wspace [Mdm::Workspace]
# @return [void]
def infer_vuln_from_session(session, wspace)
Expand Down
4 changes: 2 additions & 2 deletions lib/msf/core/exploit/browser_autopwn2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ def is_payload_compatible?(compatible_payloads, payload_name)
# Checks if the module is multi-platform based on the directory path.
#
# @param m [Object] Module.
# @return Module [TrueClass] is multi-platform.
# @return Module [FalseClass] is not multi-platform.
# @return [TrueClass] is multi-platform.
# @return [FalseClass] is not multi-platform.
def is_multi_platform_exploit?(m)
m.fullname.include?('multi/')
end
Expand Down
6 changes: 3 additions & 3 deletions lib/msf/core/exploit/remote/browser_exploit_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ class BESException < RuntimeError; end
'vuln_test', # Example: "if(window.MyComponentIsInstalled)return true;",
# :activex is a special case.
# When you set this requirement in your module, this is how it should be:
# [{:clsid=>'String', :method=>'String'}]
# [:clsid=>'String', :method=>'String']
# Where each Hash is a test case
# But when BES receives this information, the JavaScript will return this format:
# "{CLSID}=>Method=>Boolean;"
# "CLSID=>Method=>Boolean;"
# Also see: #has_bad_activex?
'activex'
])
Expand Down Expand Up @@ -216,7 +216,7 @@ def try_set_target(profile)

# Returns true if there's a bad ActiveX, otherwise false.
# @param ax [String] The raw activex the JavaScript detection will return in this format:
# "{CLSID}=>Method=>Boolean;"
# "CLSID=>Method=>Boolean;"
# @return [Boolean] True if there's a bad ActiveX, otherwise false
def has_bad_activex?(ax)
ax.to_s.split(';').each do |a|
Expand Down
2 changes: 1 addition & 1 deletion lib/msf/core/handler/reverse_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def payload_uri(req)
"#{scheme}://#{callback_host}/"
end

# Use the {#refname} to determine whether this handler uses SSL or not
# Use the #refname to determine whether this handler uses SSL or not
#
def ssl?
!!(self.refname.index('https'))
Expand Down
4 changes: 2 additions & 2 deletions lib/msf/core/module_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ def valid?(reference_name)
# @option info [Array<String>] 'files' List of paths to files that defined
# +klass+.
# @return [Class] The klass parameter modified to have
# {Msf::Module#framework}, {Msf::Module#refname}, {Msf::Module#file_path},
# and {Msf::Module#orig_cls} set.
# Msf::Module.framework, Msf::Module#refname, Msf::Module#file_path,
# and Msf::Module#orig_cls set.
def add_module(klass, reference_name, info = {})
# Set the module's reference_name so that it can be referenced when
# instances are created.
Expand Down
2 changes: 1 addition & 1 deletion lib/msf/core/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def inspect
mod
end

# This method returns the ID of the {Mdm::Session} that the post module
# This method returns the ID of the Mdm::Session that the post module
# is currently running against.
#
# @return [NilClass] if there is no database record for the session
Expand Down
11 changes: 7 additions & 4 deletions lib/rex/parser/fs/bitlocker.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# -*- coding: binary -*-

require 'openssl/ccm'
require 'metasm'

##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'openssl/ccm'
require 'metasm'

module Rex
module Parser
###
Expand Down Expand Up @@ -112,7 +115,7 @@ def decrypt_aes_ccm_key(fve_entry, key)

# Parse the metadata_entries and return a hashmap using the
# following format:
# {metadata_entry_type => {metadata_value_type => [fve_entry,...]}}
# metadata_entry_type => metadata_value_type => [fve_entry,...]
def fve_entries(metadata_entries)
offset_entry = 0
entry_size = metadata_entries[0, 2].unpack('v')[0]
Expand Down Expand Up @@ -215,7 +218,7 @@ def fvek_entries
end

# Produce a hash map using the following format:
# {PROTECTION_TYPE => [fve_entry, fve_entry...]}
# PROTECTION_TYPE => [fve_entry, fve_entry...]
def vmk_entries
res = {}
(@fve_metadata_entries[ENTRY_TYPE_VMK][VALUE_TYPE_VMK]).each do |vmk|
Expand Down
4 changes: 0 additions & 4 deletions lib/rex/proto/adb/client.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# -*- coding: binary -*-

##
# ADB protocol support
##

require 'rex/proto/adb/message'

module Rex
Expand Down
Loading

0 comments on commit 5e36a31

Please sign in to comment.