Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _set_network_proxy():
if conf.proxy:
debug_msg = "setting the HTTP/SOCKS proxy for all network requests"
logger.debug(debug_msg)
try:
_ = urlsplit(conf.proxy)
except Exception as ex:
err_msg = "invalid proxy address '{0}' ('{1}')".format(conf.proxy, str(ex))
raise PocsuiteSyntaxException(err_msg)
hostname_port = _.netloc.split(":")
scheme = _.scheme.upper()
hostname = hostname_port[0]
port = None
username = None
password = None
if len(hostname_port) == 2:
try:
dirname, filename = os.path.split(found)
plugin_name = os.path.splitext(filename)[0]
if found.endswith(('__init__.py', '__init__.pyc')):
continue
if plugin_name not in conf.plugins:
continue
cache_plugins.remove(plugin_name)
founds.append(found)
if len(cache_plugins) > 0:
for file in cache_plugins:
if os.path.exists(file):
founds.append(file)
for file in founds:
debug_msg = "loading plugin script '{0}'".format(file)
logger.debug(debug_msg)
load_file_to_module(file)
from readline import *
import readline as _readline
except ImportError:
try:
from pyreadline import *
import pyreadline as _readline
except ImportError:
pass
if IS_WIN and _readline:
try:
_outputfile = _readline.GetOutputFile()
except AttributeError:
debugMsg = "Failed GetOutputFile when using platform's "
debugMsg += "readline library"
logger.debug(debugMsg)
_readline = None
# Test to see if libedit is being used instead of GNU readline.
# Thanks to Boyd Waters for this patch.
uses_libedit = False
if PLATFORM == 'mac' and _readline:
import commands
(status, result) = commands.getstatusoutput("otool -L %s | grep libedit" % _readline.__file__)
if status == 0 and len(result) > 0:
# We are bound to libedit - new in Leopard
_readline.parse_and_bind("bind ^I rl_complete")
def _set_kb_attributes(flush_all=True):
"""
This function set some needed attributes into the knowledge base
singleton.
"""
debug_msg = "initializing the knowledge base"
logger.debug(debug_msg)
kb.abs_file_paths = set()
kb.os = None
kb.os_version = None
kb.arch = None
kb.dbms = None
kb.auth_header = None
kb.counters = {}
kb.multi_thread_mode = False
kb.thread_continue = True
kb.thread_exception = False
kb.word_lists = None
kb.single_log_flags = set()
kb.cache = AttribDict()
kb.cache.addrinfo = {}
def _set_conf_attributes():
"""
This function set some needed attributes into the configuration
singleton.
"""
debug_msg = "initializing the configuration"
logger.debug(debug_msg)
conf.url = None
conf.url_file = None
conf.mode = 'verify'
conf.poc = None
conf.cookie = None
conf.host = None
conf.referer = None
conf.agent = None
conf.headers = None
conf.random_agent = None
conf.proxy = None
conf.proxy_cred = None
conf.proxies = {}
conf.timeout = 30
conf.retry = 0
def start():
runtime_check()
tasks_count = kb.task_queue.qsize()
info_msg = "pocsusite got a total of {0} tasks".format(tasks_count)
logger.info(info_msg)
logger.debug("pocsuite will open {} threads".format(conf.threads))
try:
run_threads(conf.threads, task_run)
logger.info("Scan completed,ready to print")
finally:
task_done()
if conf.mode == "shell" and not conf.api:
info_msg = "connect back ip: {0} port: {1}".format(
desensitization(conf.connect_back_host) if conf.ppt else conf.connect_back_host, conf.connect_back_port)
logger.info(info_msg)
info_msg = "watting for shell connect to pocsuite"
logger.info(info_msg)
if conf.console_mode:
handle_listener_connection_for_console()
else:
def config_file_parser(configFile):
"""
Parse configuration file and save settings into the configuration
advanced dictionary.
"""
# global config
debugMsg = "parsing configuration file"
logger.debug(debugMsg)
if not os.path.isfile(configFile):
raise PocsuiteFilePathException("file '{}' don't exist".format(configFile))
config = ConfigParser()
config.read(configFile)
if not config.has_section("Target"):
errMsg = "missing a mandatory section 'Target' in the configuration file"
raise PocsuiteMissingMandatoryOptionException(errMsg)
sections = config.sections()
for section in sections:
options = config.options(section)
if options:
for option in options: