Module: PWN::WWW::Google

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

Overview

This plugin supports Google actions.

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



80
81
82
83
84
# File 'lib/pwn/www/google.rb', line 80

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

.close(opts = {}) ⇒ Object

Supported Method Parameters

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

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

)



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

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



88
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/google.rb', line 88

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}.search_linkedin_for_employees_by_company(
      browser_obj: 'required - browser_obj returned from #open method',
      company: 'required - company string'
    )

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

    #{self}.authors
  "
end

.open(opts = {}) ⇒ Object

Supported Method Parameters

browser_obj = PWN::WWW::Google.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/google.rb', line 13

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

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

  browser_obj
rescue StandardError => e
  raise e
end

.search(opts = {}) ⇒ Object

Supported Method Parameters

browser_obj = PWN::WWW::Google.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
# File 'lib/pwn/www/google.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)
  browser.button(text: 'Google Search').click!

  browser_obj
rescue StandardError => e
  raise e
end

.search_linkedin_for_employees_by_company(opts = {}) ⇒ Object

Supported Method Parameters

browser_obj = PWN::WWW::Google.search_linkedin_for_employees_by_company(

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

)



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/pwn/www/google.rb', line 49

public_class_method def self.search_linkedin_for_employees_by_company(opts = {})
  browser_obj = opts[:browser_obj]
  company = opts[:company].to_s.scrub
  q = "site:linkedin.com inurl:in intext:\"#{company}\""

  browser = browser_obj[:browser]
  browser.text_field(name: 'q').wait_until(&:present?).set(q)
  browser.button(text: 'Google Search').click!
  sleep 3 # Cough: <hack>

  browser_obj
rescue StandardError => e
  raise e
end