app/controllers/core.rb in wpscan-3.5.0 vs app/controllers/core.rb in wpscan-3.5.1

- old
+ new

@@ -25,57 +25,60 @@ end # @return [ Boolean ] def update_db_required? if local_db.missing_files? - raise Error::MissingDatabaseFile if parsed_options[:update] == false + raise Error::MissingDatabaseFile if ParsedCli.update == false return true end - return parsed_options[:update] unless parsed_options[:update].nil? + return ParsedCli.update unless ParsedCli.update.nil? return false unless user_interaction? && local_db.outdated? output('@notice', msg: 'It seems like you have not updated the database for some time.') print '[?] Do you want to update now? [Y]es [N]o, default: [N]' - Readline.readline =~ /^y/i ? true : false + /^y/i.match?(Readline.readline) ? true : false end def update_db output('db_update_started') - output('db_update_finished', updated: local_db.update, verbose: parsed_options[:verbose]) + output('db_update_finished', updated: local_db.update, verbose: ParsedCli.verbose) - exit(0) unless parsed_options[:url] + exit(0) unless ParsedCli.url end def before_scan @last_update = local_db.last_update - maybe_output_banner_help_and_version # From CMS Scanner + maybe_output_banner_help_and_version # From CMSScanner update_db if update_db_required? setup_cache check_target_availability load_server_module check_wordpress_state + rescue Error::NotWordPress => e + target.maybe_add_cookies + raise e unless target.wordpress?(ParsedCli.detection_mode) end # Raises errors if the target is hosted on wordpress.com or is not running WordPress # Also check if the homepage_url is still the install url def check_wordpress_state raise Error::WordPressHosted if target.wordpress_hosted? - if Addressable::URI.parse(target.homepage_url).path =~ %r{/wp-admin/install.php$}i + if %r{/wp-admin/install.php$}i.match?(Addressable::URI.parse(target.homepage_url).path) output('not_fully_configured', url: target.homepage_url) exit(WPScan::ExitCode::VULNERABLE) end - raise Error::NotWordPress unless target.wordpress?(parsed_options[:detection_mode]) || parsed_options[:force] + raise Error::NotWordPress unless target.wordpress?(ParsedCli.detection_mode) || ParsedCli.force end # Loads the related server module in the target # and includes it in the WpItem class which will be needed # to check if directory listing is enabled etc @@ -83,10 +86,10 @@ # @return [ Symbol ] The server module loaded def load_server_module server = target.server || :Apache # Tries to auto detect the server # Force a specific server module to be loaded if supplied - case parsed_options[:server] + case ParsedCli.server when :apache server = :Apache when :iis server = :IIS when :nginx