Module: PWN::WWW::Duckduckgo

Defined in:
lib/pwn/www/duckduckgo.rb

Overview

This plugin supports Duckduckgo actions.

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



81
82
83
84
85
# File 'lib/pwn/www/duckduckgo.rb', line 81

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

.close(opts = {}) ⇒ Object

Supported Method Parameters

browser_obj = PWN::WWW::Duckduckgo.close(

browser_obj: 'required - browser_obj returned from #open method'

)



70
71
72
73
74
75
76
77
# File 'lib/pwn/www/duckduckgo.rb', line 70

public_class_method def self.close(opts = {})
  browser_obj = opts[:browser_obj]
  PWN::Plugins::TransparentBrowser.close(
    browser_obj: browser_obj
  )
rescue StandardError => e
  raise e
end

.helpObject

Display Usage for this Module



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/pwn/www/duckduckgo.rb', line 89

public_class_method def self.help
  puts "USAGE:
    browser_obj = #{self}.open(
      browser_type: 'optional :firefox|:chrome|:ie|:headless (Defaults to :firefox)',
      proxy: 'optional - scheme://proxy_host:port || tor'
    )

    browser_obj = #{self}.search(
      browser_obj: 'required - browser_obj returned from #open method',
      q: 'required search string'
    )

    browser_obj = #{self}.onion(
      browser_obj: 'required - browser_obj returned from #open method'
    )

    browser_obj = #{self}.close(
      browser_obj: 'required - browser_obj returned from #open method'
    )

    #{self}.authors
  "
end

.onion(opts = {}) ⇒ Object

Supported Method Parameters

browser_obj = PWN::WWW::Duckduckgo.onion(

browser_obj: 'required - browser_obj returned from #open method',

)



54
55
56
57
58
59
60
61
62
63
# File 'lib/pwn/www/duckduckgo.rb', line 54

public_class_method def self.onion(opts = {})
  browser_obj = opts[:browser_obj]

  browser = browser_obj[:browser]
  browser.goto('http://3g2upl4pq6kufc4m.onion')

  browser_obj
rescue StandardError => e
  raise e
end

.open(opts = {}) ⇒ Object

Supported Method Parameters

browser_obj = PWN::WWW::Duckduckgo.open(

browser_type: 'optional - :firefox|:chrome|:ie|:headless (Defaults to :firefox)',
proxy: 'optional - scheme://proxy_host:port || tor'

)



13
14
15
16
17
18
19
20
21
22
# File 'lib/pwn/www/duckduckgo.rb', line 13

public_class_method def self.open(opts = {})
  browser_obj = PWN::Plugins::TransparentBrowser.open(opts)

  browser = browser_obj[:browser]
  browser.goto('https://duckduckgo.com')

  browser_obj
rescue StandardError => e
  raise e
end

.search(opts = {}) ⇒ Object

Supported Method Parameters

browser_obj = PWN::WWW::Duckduckgo.search(

browser_obj: 'required - browser_obj returned from #open method',
q: 'required - search string'

)



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/pwn/www/duckduckgo.rb', line 30

public_class_method def self.search(opts = {})
  browser_obj = opts[:browser_obj]
  q = opts[:q].to_s

  browser = browser_obj[:browser]
  browser.text_field(name: 'q').wait_until(&:present?).set(q)
  if browser.url == 'https://duckduckgo.com/' ||
     browser.url == 'http://3g2upl4pq6kufc4m.onion/'

    browser.button(id: 'search_button_homepage').click!
  else
    browser.button(id: 'search_button').click!
  end

  browser_obj
rescue StandardError => e
  raise e
end