created a --show-success flag that will output the success of the dork depending on how many links have been found with it

This commit is contained in:
ekultek 2017-11-15 07:23:36 -06:00
parent e18e4c02a2
commit 25b72314e7
4 changed files with 45 additions and 6 deletions

View file

@ -33,6 +33,8 @@ c3f01fc8ff7dfe7759f63bf16b00f127 ./lib/firewall/wordfence.py
2bfc3884ae96cc2443ebf94359b380c0 ./lib/firewall/cloudfront.py
fde5445df5d77d245656adea96673cfa ./lib/firewall/squid.py
9c3ec0cce44c4246b97b431e37e3dcc2 ./lib/firewall/aws.py
e4eef006dd909c222b1b9f48826c3ef5 ./lib/firewall/pk.py
6bbe2f6f6a2a1ddf0e416e94ec1f0763 ./lib/firewall/siteguard.py
785c28da8b681a7e23964f99118b5aab ./lib/tamper_scripts/obfuscateordinal_encode.py
10bf1bc4ef0287d31633148fab557e8a ./lib/tamper_scripts/uppercase_encode.py
5b68de0ce3a783b870921b09b5222146 ./lib/tamper_scripts/hex_encode.py

View file

@ -55,7 +55,7 @@ CLONE = "https://github.com/ekultek/zeus-scanner.git"
ISSUE_LINK = "https://github.com/ekultek/zeus-scanner/issues"
# current version <major.minor.commit.patch ID>
VERSION = "1.2.15".format(PATCH_ID)
VERSION = "1.2.16".format(PATCH_ID)
# colors to output depending on the version
VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30}
@ -1058,3 +1058,21 @@ def parse_blacklist(dork, path, batch=False):
else:
prompt(prompt_msg, opts="yN", default="y")
return True
def calculate_success(amount_of_urls):
"""
calculate the success rate of the found links
"""
success_percentage = ((amount_of_urls // 10) + 1) * 10
if success_percentage < 25:
success_rate = "low"
elif 25 < success_percentage < 50:
success_rate = "fair"
elif 50 < success_percentage < 75:
success_rate = "good"
elif 75 <= success_percentage <= 110:
success_rate = "great"
else:
success_rate = "outstanding"
return success_rate

View file

@ -47,7 +47,8 @@ from lib.core.settings import (
MAX_PAGE_NUMBER,
NO_RESULTS_REGEX,
parse_blacklist,
BLACKLIST_FILE_PATH
BLACKLIST_FILE_PATH,
calculate_success
)
try:
@ -345,6 +346,7 @@ def parse_search_results(query, url_to_search, verbose=False, **kwargs):
forward_for = kwargs.get("forward_for", False)
tor = kwargs.get("tor", False)
batch = kwargs.get("batch", False)
show_success = kwargs.get("show_success", False)
if verbose:
logger.debug(set_color(
@ -546,7 +548,13 @@ def parse_search_results(query, url_to_search, verbose=False, **kwargs):
true_retval.add(url)
if len(true_retval) != 0:
write_to_log_file(true_retval, URL_LOG_PATH, "url-log-{}.log")
file_path = write_to_log_file(true_retval, URL_LOG_PATH, "url-log-{}.log")
if show_success:
amount_of_urls = len(open(file_path).readlines())
success_rate = calculate_success(amount_of_urls)
logger.info(set_color(
"provided query has a {} success rate...".format(success_rate)
))
else:
logger.fatal(set_color(
"did not find any URLs with given query '{}' writing query to blacklist...".format(query), level=50
@ -567,6 +575,7 @@ def search_multiple_pages(query, link_amount, verbose=False, **kwargs):
agent = kwargs.get("agent", None)
xforward = kwargs.get("xforward", False)
batch = kwargs.get("batch", False)
show_success = kwargs.get("show_success", False)
attrib, desc = "a", "href"
retval = set()
search_engine = AUTHORIZED_SEARCH_ENGINES["search-results"]
@ -650,7 +659,13 @@ def search_multiple_pages(query, link_amount, verbose=False, **kwargs):
logger.info(set_color(
"a total of {} URL(s) found out of the requested {}...".format(len(retval), link_amount), level=25
))
write_to_log_file(retval, URL_LOG_PATH, "url-log-{}.log")
file_path = write_to_log_file(retval, URL_LOG_PATH, "url-log-{}.log")
if show_success:
amount_of_urls = len(open(file_path).readlines())
success_rate = calculate_success(amount_of_urls)
logger.info(set_color(
"provided query has a {} success rate...".format(success_rate)
))
return list(retval)
else:
logger.warning(set_color(

View file

@ -163,6 +163,8 @@ if __name__ == "__main__":
help="Show the current version and exit")
misc.add_option("-T", "--x-threads", dest="amountOfThreads", metavar="THREAD-AMOUNT", type=int,
help="Specify how many threads you want to pass")
misc.add_option("--show-success", dest="showSuccessRate", action="store_true",
help="Calculate the dorks success rate and output the calculation in human readable form")
parser.add_option_group(mandatory)
parser.add_option_group(attacks)
@ -330,7 +332,8 @@ if __name__ == "__main__":
search.parse_search_results(
opt.dorkToUse, search_engine, verbose=opt.runInVerbose, proxy=proxy_to_use,
agent=agent_to_use, pull_all=opt.noExclude, parse_webcache=opt.parseWebcache,
forward_for=opt.forwardedForRandomIP, tor=opt.useTor, batch=opt.runInBatch
forward_for=opt.forwardedForRandomIP, tor=opt.useTor, batch=opt.runInBatch,
show_success=opt.showSuccessRate
)
except InvalidProxyType:
supported_proxy_types = ["socks5", "socks4", "https", "http"]
@ -381,7 +384,8 @@ if __name__ == "__main__":
search.search_multiple_pages(
dork_to_use, link_amount_to_search, proxy=proxy_to_use,
agent=agent_to_use, verbose=opt.runInVerbose,
xforward=opt.forwardedForRandomIP, batch=opt.runInBatch
xforward=opt.forwardedForRandomIP, batch=opt.runInBatch,
show_success=opt.showSuccessRate
)
except Exception as e:
if "Error 400" in str(e):