basic implement of Google IP bypass done (more work to be done)

This commit is contained in:
ekultek 2017-09-26 18:20:43 -05:00
parent 90d3798a93
commit 526807c7ff
2 changed files with 52 additions and 2 deletions

View file

@ -22,7 +22,7 @@ except NameError:
# clone link
CLONE = "https://github.com/ekultek/zeus-scanner.git"
# current version <major.minor.commit.patch ID>
VERSION = "1.0.18"
VERSION = "1.0.18.94c6"
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
# version string formatting
@ -380,4 +380,14 @@ def create_tree(start, conns, down="|", over="-", sep="-" * 40):
down, over, con
)
)
print(sep)
print(sep)
def add_https(url):
"""
add https:// to a url
"""
if "https://" in url:
return url
else:
return "https://{}".format(url.split("://")[-1])

View file

@ -1,4 +1,5 @@
import os
import re
import time
import urllib
@ -17,9 +18,33 @@ from lib.settings import (
URL_REGEX,
shutdown,
create_dir,
add_https
)
def bypass_ip_block(url, content_sep=("continue=", "Fid", "%")):
"""
bypass Google's IP blocking by extracting the true URL from the ban URL.
"""
if isinstance(url, unicode):
url = str(url)
index_list = []
index_list_2 = []
if content_sep[0] in url:
data_list = url.split(content_sep[0])
url_to_use = data_list[1]
else:
url_to_use = url
for m in re.finditer(content_sep[1], url_to_use):
index_list.append((m.start(), m.end()))
splice_to_use = index_list[-1][-1]
for m2 in re.finditer(content_sep[2], url[0:splice_to_use]):
index_list_2.append((m2.start(), m2.end()))
return add_https(url[0:index_list_2[-1][-1] - 1])
def get_urls(query, url, verbose=False, warning=True, user_agent=None, proxy=None, **kwargs):
"""
Bypass Google captchas and Google API by using selenium-webdriver to gather
@ -93,6 +118,21 @@ def get_urls(query, url, verbose=False, warning=True, user_agent=None, proxy=Non
"obtaining URL from selenium..."
))
retval = browser.current_url
if "http://ipv6.google.com" or "http://ipv4.google.com" in retval:
logger.warning(set_color(
"it appears that Google is attempting to block your IP address, attempting bypass...", level=30
))
try:
retval = bypass_ip_block(retval)
except IndexError:
logger.warning(set_color(
"for now the IP ban bypass will only work for queries that have Google's search syntax "
"in them. (IE inurl:, incontext:, incontent:)"
))
raise NotImplementedError(
"bypass for query '{}' is not implemented yet, try again with a different dork, "
"or change your IP address...".format(query)
)
if verbose:
logger.debug(set_color(
"found current URL from selenium browser '{}'...".format(retval), level=10