4141group = parser .add_mutually_exclusive_group ()
4242group .add_argument ("-d" , "--dork" , help = " specify the dork you wish to use\n " )
4343group .add_argument ("-l" , "--list" , help = " specify path to list with dorks\n " )
44- parser .add_argument ("-v" , "--verbose" , action = "store_true" , help = " toggle verbosity\n " )
44+ #parser.add_argument("-n", "--nogui", action="store_true", default=False, help="run headless without a GUI")
45+ parser .add_argument ("-v" , "--verbose" , action = "store_true" , default = False , help = "toggle verbosity\n " )
4546args = parser .parse_args ()
4647
4748dork_list = []
4849
50+ # Doesn't jive with proxy settings
51+ #if args.nogui == True:
52+ # options = webdriver.FirefoxOptions()
53+ # options.add_argument("--headless")
54+
55+
4956# Dork list processing
5057if args .list :
5158 print "\n [" + t .green ("+" ) + "]Reading in list from: " + args .list + "\n \n "
@@ -102,7 +109,12 @@ def search():
102109 link_list = []
103110
104111 if set_proxy == True :
112+ # the --nogui option doesn't seem to want to play nice with
113+ # The way in which i configure the proxy, if the user chose
114+ # to employ one
105115 driver = proxy (IP , PORT )
116+ elif args .nogui == True :
117+ driver = webdriver .Firefox (firefox_options = options )
106118 else :
107119 driver = webdriver .Firefox ()
108120
@@ -117,36 +129,45 @@ def search():
117129 break
118130 driver .quit ()
119131 sys .exit (0 )
120-
121- assert "Google" in driver .title
132+
133+ #if args.nogui == True:
134+ # for items in dork_list:
135+ # elem = driver.find_element_by_name("q")
136+ # elem.clear()
137+ # elem.send_keys(items)
138+ # elem.send_keys(Keys.RETURN)
139+ # time.sleep(2.2)
140+ #
141+ #else:
142+ assert "Google" in driver .title
122143 for items in dork_list :
123144 elem = driver .find_element_by_name ("q" )
124145 elem .clear ()
125146 elem .send_keys (items )
126147 elem .send_keys (Keys .RETURN )
127148 time .sleep (2.2 )
128-
129- try :
130- WebDriverWait (driver , 20 ).until (EC .presence_of_element_located ((By .CLASS_NAME , "r" ))) #r
131- except Exception as e :
132- driver .quit ()
133- print "\n [" + t .red ("!" ) + "]Detecting page source elements failed/timed out.\n "
149+ try :
150+ WebDriverWait (driver , 20 ).until (EC .presence_of_element_located ((By .CLASS_NAME , "r" ))) #r
151+ except Exception as e :
152+ driver .quit ()
153+ print "\n [" + t .red ("!" ) + "]Detecting page source elements failed/timed out.\n "
134154
135- if args .verbose == True :
136- print "An error was raised with the following error message: "
137- print "\n %s" % (e )
155+ if args .verbose == True :
156+ print "An error was raised with the following error message: "
157+ print "\n %s" % (e )
138158
139- time .sleep (1 )
140- continue
159+ time .sleep (1 )
160+ continue
141161
142162
143- assert "No results found" not in driver .page_source
144- if "No results found" in driver .page_source :
145- continue
163+ assert "No results found" not in driver .page_source
164+ if "No results found" in driver .page_source :
165+ continue
146166
147- links = driver .find_elements_by_xpath ("//div[@data-hveid]/div/div/a[@onmousedown]" ) # //h3//a[@href]
148- for elem in links :
149- link_list .append (elem .get_attribute ("href" )) # href elem.get_attribute("href")
167+ links = driver .find_elements_by_xpath ("//div[@data-hveid]/div/div/a[@onmousedown]" ) # //h3//a[@href]
168+
169+ for elem in links :
170+ link_list .append (elem .get_attribute ("href" )) # href elem.get_attribute("href")
150171
151172
152173
0 commit comments