Module: WhatWeb

Defined in:
lib/whatweb.rb,
lib/whatweb/cli.rb,
lib/whatweb/errors.rb,
lib/whatweb/helper.rb,
lib/whatweb/plugin.rb,
lib/whatweb/target.rb,
lib/whatweb/version.rb,
lib/whatweb/matcher/md5.rb,
lib/whatweb/matcher/url.rb,
lib/whatweb/matcher/base.rb,
lib/whatweb/matcher/ghdb.rb,
lib/whatweb/matcher/text.rb,
lib/whatweb/matcher/common.rb,
lib/whatweb/matcher/status.rb,
lib/whatweb/matcher/version.rb,
lib/whatweb/matcher/tag_pattern.rb

Defined Under Namespace

Modules: Helper, Matcher Classes: CLI, NoHeaderError, Plugin, PluginManager, Target

Constant Summary collapse

VERSION =
"0.4.1"

Class Method Summary collapse

Class Method Details

.execute_plugins(url, options = {}) ⇒ Object



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

def self.execute_plugins(url, options = {})
  user_agent = options[:user_agent] || "WhatWeb/#{VERSION}"
  is_aggressive = options[:is_aggressive] || false
  max_threads = options[:max_threads] || 10

  plugins = PluginManager.instance.load_plugins
  target = Target.new(url, user_agent: user_agent)

  pool = Thread.pool(max_threads)
  results = {}
  plugins.each do |name, plugin|
    pool.process do
      result = plugin.execute(target, is_aggressive)
      results[name] = result unless result.empty?
    end
  end
  pool.shutdown
  results
end

.plugin_namesObject



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/whatweb.rb', line 39

def self.plugin_names
  plugins = PluginManager.instance.load_plugins
  plugins.map do |name, plugin|
    {
      name: name,
      author: plugin.author.encode("UTF-8"),
      description: plugin.description.encode("UTF-8"),
      website: plugin.website,
      version: plugin.version
    }
  end
end