Module: PWN::Plugins::Spider

Defined in:
lib/pwn/plugins/spider.rb

Overview

This plugin supports Pastebin actions.

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



57
58
59
60
61
# File 'lib/pwn/plugins/spider.rb', line 57

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.crawl(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::Spider.crawl(

target_fqdn: 'required - target fqdn to spider',
results_path: 'required - path to save spider results',
proxy: 'optional - proxy to spider through e.g. http://127.0.0.1:8080'

)



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/pwn/plugins/spider.rb', line 16

public_class_method def self.crawl(opts = {})
  # TODO: Add AuthN Support
  # FYI: Anemone very well may have a memory leak.
  # Despite saving results to file, Anemone causes
  # memory exhaustion on large sites
  target_fqdn = opts[:target_fqdn].to_s.scrub.strip.chomp
  results_path = opts[:results_path].to_s.scrub.strip.chomp

  proxy = opts[:proxy].to_s.scrub.strip.chomp unless opts[:proxy].nil?

  # Colors!
  green = "\e[32m"
  yellow = "\e[33m"
  end_of_color = "\e[0m"

  puts "#{green}Spidering Target FQDN: #{target_fqdn}#{end_of_color}"
  File.open(results_path, 'w') do |f|
    if proxy
      proxy_uri = URI.parse(proxy)
      proxy_hash = { proxy_host: proxy_uri.host, proxy_port: proxy_uri.port }
      Anemone.crawl(target_fqdn, proxy_hash) do |anemone|
        anemone.on_every_page do |page|
          puts "#{yellow}Discovered: #{page.url}#{end_of_color}"
          f.puts(page.url)
        end
      end
    else
      Anemone.crawl(target_fqdn) do |anemone|
        anemone.on_every_page do |page|
          puts "#{green}Discovered: #{page.url}#{end_of_color}"
          f.puts(page.url)
        end
      end
    end
  end
rescue StandardError => e
  raise e
end

.helpObject

Display Usage for this Module



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/pwn/plugins/spider.rb', line 65

public_class_method def self.help
  puts %{USAGE:
    #{self}.crawl(
      target_fqdn: 'required - target fqdn to spider',
      results_path: 'required - path to save spider results',
      proxy: 'optional - proxy to spider through e.g. http://127.0.0.1:8080'
    )

    #{self}.authors
  }
end