Skip to content

Commit c740eb6

Browse files
author
ekultek
committed
full batch functionality added to the searching
1 parent 70b5612 commit c740eb6

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

var/google_search/search.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ def get_urls(query, url, verbose=False, warning=True, **kwargs):
162162
query = query.decode('unicode_escape').encode('utf-8')
163163
proxy, user_agent = kwargs.get("proxy", None), kwargs.get("user_agent", None)
164164
tor, tor_port = kwargs.get("tor", False), kwargs.get("tor_port", None)
165+
batch = kwargs.get("batch", False)
165166
if verbose:
166167
logger.debug(set_color(
167168
"setting up the virtual display to hide the browser...", level=10
@@ -273,12 +274,21 @@ def get_urls(query, url, verbose=False, warning=True, **kwargs):
273274
))
274275
try:
275276
retval = extract_ip_ban(retval)
276-
do_continue = prompt(
277+
question_msg = (
277278
"zeus was able to successfully extract the URL from Google's ban URL "
278279
"it is advised to shutdown zeus and attempt to extract the URL's manually. "
279280
"failing to do so will most likely result in no results being found by zeus. "
280-
"would you like to shutdown", opts="yN"
281+
"would you like to shutdown"
281282
)
283+
if not batch:
284+
do_continue = prompt(
285+
question_msg, opts="yN"
286+
)
287+
else:
288+
do_continue = prompt(
289+
question_msg, opts="yN", default="n"
290+
)
291+
282292
if not str(do_continue).lower().startswith("n"): # shutdown and write the URL to a file
283293
write_to_log_file(retval, EXTRACTED_URL_LOG, "extracted-url-{}.log")
284294
logger.info(set_color(
@@ -322,6 +332,7 @@ def parse_search_results(query, url_to_search, verbose=False, **kwargs):
322332
proxy_string, user_agent = kwargs.get("proxy", None), kwargs.get("agent", None)
323333
forward_for = kwargs.get("forward_for", False)
324334
tor = kwargs.get("tor", False)
335+
batch = kwargs.get("batch", False)
325336

326337
if verbose:
327338
logger.debug(set_color(
@@ -379,7 +390,7 @@ def parse_search_results(query, url_to_search, verbose=False, **kwargs):
379390
try:
380391
query_url = get_urls(
381392
query, url_to_search, verbose=verbose, user_agent=user_agent, proxy=proxy_string,
382-
tor=tor
393+
tor=tor, batch=batch
383394
)
384395
except Exception as e:
385396
if "'/usr/lib/firefoxdriver/webdriver.xpi'" in str(e):

0 commit comments

Comments
 (0)