Path: blob/master/app/controllers/enumeration/cli_options.rb
485 views
# frozen_string_literal: true12module WPScan3module Controller4# Enumeration CLI Options5class Enumeration < CMSScanner::Controller::Base6def cli_options7cli_enum_choices + cli_plugins_opts + cli_themes_opts +8cli_timthumbs_opts + cli_config_backups_opts + cli_db_exports_opts +9cli_medias_opts + cli_users_opts10end1112# @return [ Array<OptParseValidator::OptBase> ]13def cli_enum_choices14[15OptMultiChoices.new(16['-e', '--enumerate [OPTS]', 'Enumeration Process'],17choices: {18vp: OptBoolean.new(['--vulnerable-plugins']),19ap: OptBoolean.new(['--all-plugins']),20p: OptBoolean.new(['--popular-plugins']),21vt: OptBoolean.new(['--vulnerable-themes']),22at: OptBoolean.new(['--all-themes']),23t: OptBoolean.new(['--popular-themes']),24tt: OptBoolean.new(['--timthumbs']),25cb: OptBoolean.new(['--config-backups']),26dbe: OptBoolean.new(['--db-exports']),27u: OptIntegerRange.new(['--users', 'User IDs range. e.g: u1-5'], value_if_empty: '1-10'),28m: OptIntegerRange.new(['--medias',29'Media IDs range. e.g m1-15',30'Note: Permalink setting must be set to "Plain" for those to be detected'],31value_if_empty: '1-100')32},33value_if_empty: 'vp,vt,tt,cb,dbe,u,m',34incompatible: [%i[vp ap p], %i[vt at t]],35default: { all_plugins: true, config_backups: true }36),37OptRegexp.new(38[39'--exclude-content-based REGEXP_OR_STRING',40'Exclude all responses matching the Regexp (case insensitive) during parts of the enumeration.',41'Both the headers and body are checked. Regexp delimiters are not required.'42], options: Regexp::IGNORECASE43)44]45end4647# @return [ Array<OptParseValidator::OptBase> ]48def cli_plugins_opts49[50OptSmartList.new(['--plugins-list LIST', 'List of plugins to enumerate'], advanced: true),51OptChoice.new(52['--plugins-detection MODE',53'Use the supplied mode to enumerate Plugins.'],54choices: %w[mixed passive aggressive], normalize: :to_sym, default: :passive55),56OptBoolean.new(57['--plugins-version-all',58'Check all the plugins version locations according to the choosen mode (--detection-mode, ' \59'--plugins-detection and --plugins-version-detection)'],60advanced: true61),62OptChoice.new(63['--plugins-version-detection MODE',64'Use the supplied mode to check plugins\' versions.'],65choices: %w[mixed passive aggressive], normalize: :to_sym, default: :mixed66),67OptInteger.new(68['--plugins-threshold THRESHOLD',69'Raise an error when the number of detected plugins via known locations reaches the threshold. ' \70'Set to 0 to ignore the threshold.'], default: 100, advanced: true71)72]73end7475# @return [ Array<OptParseValidator::OptBase> ]76def cli_themes_opts77[78OptSmartList.new(['--themes-list LIST', 'List of themes to enumerate'], advanced: true),79OptChoice.new(80['--themes-detection MODE',81'Use the supplied mode to enumerate Themes, instead of the global (--detection-mode) mode.'],82choices: %w[mixed passive aggressive], normalize: :to_sym, advanced: true83),84OptBoolean.new(85['--themes-version-all',86'Check all the themes version locations according to the choosen mode (--detection-mode, ' \87'--themes-detection and --themes-version-detection)'],88advanced: true89),90OptChoice.new(91['--themes-version-detection MODE',92'Use the supplied mode to check themes versions instead of the --detection-mode ' \93'or --themes-detection modes.'],94choices: %w[mixed passive aggressive], normalize: :to_sym, advanced: true95),96OptInteger.new(97['--themes-threshold THRESHOLD',98'Raise an error when the number of detected themes via known locations reaches the threshold. ' \99'Set to 0 to ignore the threshold.'], default: 20, advanced: true100)101]102end103104# @return [ Array<OptParseValidator::OptBase> ]105def cli_timthumbs_opts106[107OptFilePath.new(108['--timthumbs-list FILE-PATH', 'List of timthumbs\' location to use'],109exists: true, default: DB_DIR.join('timthumbs-v3.txt').to_s, advanced: true110),111OptChoice.new(112['--timthumbs-detection MODE',113'Use the supplied mode to enumerate Timthumbs, instead of the global (--detection-mode) mode.'],114choices: %w[mixed passive aggressive], normalize: :to_sym, advanced: true115)116]117end118119# @return [ Array<OptParseValidator::OptBase> ]120def cli_config_backups_opts121[122OptFilePath.new(123['--config-backups-list FILE-PATH', 'List of config backups\' filenames to use'],124exists: true, default: DB_DIR.join('config_backups.txt').to_s, advanced: true125),126OptChoice.new(127['--config-backups-detection MODE',128'Use the supplied mode to enumerate Config Backups, instead of the global (--detection-mode) mode.'],129choices: %w[mixed passive aggressive], normalize: :to_sym, advanced: true130)131]132end133134# @return [ Array<OptParseValidator::OptBase> ]135def cli_db_exports_opts136[137OptFilePath.new(138['--db-exports-list FILE-PATH', 'List of DB exports\' paths to use'],139exists: true, default: DB_DIR.join('db_exports.txt').to_s, advanced: true140),141OptChoice.new(142['--db-exports-detection MODE',143'Use the supplied mode to enumerate DB Exports, instead of the global (--detection-mode) mode.'],144choices: %w[mixed passive aggressive], normalize: :to_sym, advanced: true145)146]147end148149# @return [ Array<OptParseValidator::OptBase> ]150def cli_medias_opts151[152OptChoice.new(153['--medias-detection MODE',154'Use the supplied mode to enumerate Medias, instead of the global (--detection-mode) mode.'],155choices: %w[mixed passive aggressive], normalize: :to_sym, advanced: true156)157]158end159160# @return [ Array<OptParseValidator::OptBase> ]161def cli_users_opts162[163OptSmartList.new(164['--users-list LIST',165'List of users to check during the users enumeration from the Login Error Messages'],166advanced: true167),168OptChoice.new(169['--users-detection MODE',170'Use the supplied mode to enumerate Users, instead of the global (--detection-mode) mode.'],171choices: %w[mixed passive aggressive], normalize: :to_sym, advanced: true172),173OptRegexp.new(174[175'--exclude-usernames REGEXP_OR_STRING',176'Exclude usernames matching the Regexp/string (case insensitive). Regexp delimiters are not required.'177], options: Regexp::IGNORECASE178)179]180end181end182end183end184185186