Class List Method List File List

# Class: ListGeneratorPlugin

Inherits:
  Plugin
  - Object
  - Plugin
  - ListGeneratorPlugin
  show all
Defined in:
  lib/wpstools/plugins/list_generator/list_generator_plugin.rb

## Instance Attribute Summary

### Attributes inherited from Plugin

#author, #registered_options

## Instance Method Summary (collapse)

- - (Object) full(type) private
- - (ListGeneratorPlugin) initialize constructor

  A new instance of ListGeneratorPlugin.

- - (Object) most_popular(type, number_of_pages) private
- - (Object) run(options = {})

### Methods inherited from Plugin

#register_options

## Constructor Details

### - (`ListGeneratorPlugin`) initialize

A new instance of ListGeneratorPlugin

    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    # File 'lib/wpstools/plugins/list_generator/list_generator_plugin.rb', line 5

    def initialize
      super(author: 'WPScanTeam - @FireFart')

      register_options(
        ['--generate-plugin-list [NUMBER_OF_PAGES]', '--gpl', Integer, 'Generate a new data/plugins.txt file. (supply number of *pages* to parse, default : 150)'],
        ['--generate-full-plugin-list', '--gfpl', 'Generate a new full data/plugins.txt file'],

        ['--generate-theme-list [NUMBER_OF_PAGES]', '--gtl', Integer, 'Generate a new data/themes.txt file. (supply number of *pages* to parse, default : 150)'],
        ['--generate-full-theme-list', '--gftl', 'Generate a new full data/themes.txt file'],

        ['--generate-all', '--ga', 'Generate a new full plugins, full themes, popular plugins and popular themes list']
      )
    end

## Instance Method Details

### - (`Object`) full(type) (private)

    48
    49
    50
    51
    52
    # File 'lib/wpstools/plugins/list_generator/list_generator_plugin.rb', line 48

    def full(type)
      puts "[+] Generating new full #{type} list"
      puts
      GenerateList.new(type + 's', @verbose).generate_full_list
    end

### - (`Object`) most_popular(type, number_of_pages) (private)

    42
    43
    44
    45
    46
    # File 'lib/wpstools/plugins/list_generator/list_generator_plugin.rb', line 42

    def most_popular(type, number_of_pages)
      puts "[+] Generating new most popular #{type} list"
      puts
      GenerateList.new(type + 's', @verbose).generate_popular_list(number_of_pages)
    end

### - (`Object`) run(options = {})

    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    # File 'lib/wpstools/plugins/list_generator/list_generator_plugin.rb', line 19

    def run(options = {})
      @verbose     = options[:verbose] || false
      generate_all = options[:generate_all] || false

      if options.has_key?(:generate_plugin_list) || generate_all
        most_popular('plugin', options[:generate_plugin_list] || 150)
      end

      if options[:generate_full_plugin_list] || generate_all
        full('plugin')
      end

      if options.has_key?(:generate_theme_list) || generate_all
        most_popular('theme', options[:generate_theme_list] || 150)
      end

      if options[:generate_full_theme_list] || generate_all
        full('theme')
      end
    end