本文整理汇总了Python中framework.dependency_management.dependency_resolver.ServiceLocator类的典型用法代码示例。如果您正苦于以下问题:Python ServiceLocator类的具体用法?Python ServiceLocator怎么用?Python ServiceLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServiceLocator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
def run(PluginInfo):
plugin_helper = ServiceLocator.get_component("plugin_helper")
target = ServiceLocator.get_component("target")
resource = ServiceLocator.get_component("resource")
Content = plugin_helper.TransactionTableForURLList(True, target.GetAsList(['target_url', 'top_url']), 'OPTIONS')
Content += plugin_helper.CommandDump('Test Command', 'Output', resource.GetResources('SemiPassiveHTTPMethods'), PluginInfo, []) # No previous output
return Content
示例2: run
def run(PluginInfo):
#ServiceLocator.get_component("config").Show()
Content = DESCRIPTION + " Results:<br />"
plugin_params = ServiceLocator.get_component("plugin_params")
config = ServiceLocator.get_component("config")
for Args in plugin_params.GetArgs({
'Description': DESCRIPTION,
'Mandatory': {
'RHOST': config.Get('RHOST_DESCRIP'),
'RPORT': config.Get('RPORT_DESCRIP'),
'CATEGORY': 'Category to use (i.e. ' + ', '.join(
sorted(CATEGORIES)) + ')',
'SUBCATEGORY': 'Subcategory to use (i.e. ' + ', '.join(
sorted(SUBCATEGORIES)) + ')'
},
'Optional': {
'REPEAT_DELIM': config.Get('REPEAT_DELIM_DESCRIP')
}}, PluginInfo):
plugin_params.SetConfig(Args)
#print "Args="+str(Args)
Content += ServiceLocator.get_component("plugin_helper").DrawCommandDump('Test Command', 'Output',
config.GetResources(
'LaunchExploit_' + Args[
'CATEGORY'] + "_" + Args[
'SUBCATEGORY']), PluginInfo,
"") # No previous output
return Content
示例3: run
def run(PluginInfo):
# ServiceLocator.get_component("config").Show()
config = ServiceLocator.get_component("config")
OWTFLogger.log("WARNING: This plugin requires a small selenium installation, please run '" + config.Get('INSTALL_SCRIPT') + "' if you have issues")
Content = DESCRIPTION + " Results:<br />"
plugin_params = ServiceLocator.get_component("plugin_params")
for Args in plugin_params.GetArgs({
'Description': DESCRIPTION,
'Mandatory': {
'BASE_URL': 'The URL to be pre-pended to the tests',
'CATEGORY': 'Category to use (i.e. ' + ', '.join(sorted(CATEGORIES)) + ')'
},
'Optional': {
'REPEAT_DELIM': config.Get(
'REPEAT_DELIM_DESCRIP')
}}, PluginInfo):
plugin_params.SetConfig(Args)
# print "Args="+str(Args)
InputFile = config.Get("SELENIUM_URL_VECTORS_" + Args['CATEGORY'])
URLLauncher = ServiceLocator.get_component("selenium_handler").CreateURLLauncher(
{'BASE_URL': Args['BASE_URL'], 'INPUT_FILE': InputFile})
URLLauncher.Run()
return Content
示例4: run
def run(PluginInfo):
return ServiceLocator.get_component("plugin_helper").CommandDump(
'Test Command',
'Output',
ServiceLocator.get_component("resource").GetResources('DomainBruteForcing'),
PluginInfo,
"") # No previous output
示例5: run
def run(PluginInfo):
# ServiceLocator.get_component("config").Show()
Content = ServiceLocator.get_component("plugin_helper").ResourceLinkList('Online Resources',
ServiceLocator.get_component(
"resource").GetResources(
'ExternalCrossSiteFlashing'))
return Content
示例6: run
def run(PluginInfo):
# ServiceLocator.get_component("config").Show()
plugin_helper = ServiceLocator.get_component("plugin_helper")
resource = ServiceLocator.get_component("resource")
NiktoOutput = plugin_helper.CommandDump('Test Command', 'Output', resource.GetResources('Nikto_Unauth'), PluginInfo, [])
Content = plugin_helper.CommandDump('Test Command', 'Output', resource.GetResources('Nikto_Verify_Unauth'), PluginInfo, NiktoOutput)
return Content + NiktoOutput # Show Nikto Verify FIRST (more useful, with links to findings, etc)
示例7: run
def run(PluginInfo):
# ServiceLocator.get_component("config").Show()
Core = ServiceLocator.get_component("core")
Content = DESCRIPTION + " Results:<br />"
plugin_params = ServiceLocator.get_component("plugin_params")
config = ServiceLocator.get_component("config")
for Args in plugin_params.GetArgs({
'Description': DESCRIPTION,
'Mandatory': {
'RHOST': config.Get('RHOST_DESCRIP'),
'SBD_PORT': config.Get('SBD_PORT_DESCRIP'),
'SBD_PASSWORD': config.Get('SBD_PASSWORD_DESCRIP'),
'COMMAND_FILE': config.Get('COMMAND_FILE_DESCRIP')
},
'Optional': {
'REPEAT_DELIM': config.Get('REPEAT_DELIM_DESCRIP')
}}, PluginInfo):
plugin_params.SetConfig(Args) # Sets the auxiliary plugin arguments as config
#print "Args="+str(Args)
Core.RemoteShell.Open({
'ConnectVia': config.GetResources('RCE_SBD_Connection')
, 'InitialCommands': None
}, PluginInfo)
Core.RemoteShell.RunCommandList(Core.GetFileAsList(Args['COMMAND_FILE']))
Core.RemoteShell.Close(PluginInfo)
#Content += ServiceLocator.get_component("plugin_helper").DrawCommandDump('Test Command', 'Output', ServiceLocator.get_component("config").GetResources('LaunchExploit_'+Args['CATEGORY']+"_"+Args['SUBCATEGORY']), PluginInfo, "") # No previous output
return Content
示例8: run
def run(PluginInfo):
# ServiceLocator.get_component("config").Show()
Content = DESCRIPTION + " Results:<br />"
plugin_params = ServiceLocator.get_component("plugin_params")
config = ServiceLocator.get_component("config")
for Args in plugin_params.GetArgs({
'Description': DESCRIPTION,
'Mandatory': {
'EMAIL_TARGET': config.Get('EMAIL_TARGET_DESCRIP'),
'EMAIL_FROM': config.Get('EMAIL_FROM_DESCRIP'),
'SMTP_LOGIN': config.Get('SMTP_LOGIN_DESCRIP'),
'SMTP_PASS': config.Get('SMTP_PASS_DESCRIP'),
'SMTP_HOST': config.Get('SMTP_HOST_DESCRIP'),
'SMTP_PORT': config.Get('SMTP_PORT_DESCRIP'),
'EMAIL_PRIORITY': config.Get(
'EMAIL_PRIORITY_DESCRIP'),
'EMAIL_SUBJECT': config.Get(
'EMAIL_SUBJECT_DESCRIP'),
'EMAIL_BODY': config.Get('EMAIL_BODY_DESCRIP'),
},
'Optional': {
'EMAIL_ATTACHMENT': config.Get(
'EMAIL_ATTACHMENT_DESCRIP'),
'REPEAT_DELIM': config.Get('REPEAT_DELIM_DESCRIP')
}}, PluginInfo):
plugin_params.SetConfig(Args) # Update config
#print "Args="+str(Args)
if ServiceLocator.get_component("smtp").Send(Args):
Content += "Email delivered succcessfully"
else:
Content += "Email delivery failed"
#Content += ServiceLocator.get_component("plugin_helper").DrawCommandDump('Test Command', 'Output', ServiceLocator.get_component("config").GetResources('SendPhishingAttackviaSET'), PluginInfo, Content)
return Content
示例9: run
def run(PluginInfo):
# ServiceLocator.get_component("config").Show()
Content = DESCRIPTION + " Results:<br />"
plugin_params = ServiceLocator.get_component("plugin_params")
config = ServiceLocator.get_component("config")
for Args in plugin_params.GetArgs({
'Description': DESCRIPTION,
'Mandatory': {
'EMAIL_TARGET': config.Get('EMAIL_TARGET_DESCRIP'),
'EMAIL_FROM': config.Get('EMAIL_FROM_DESCRIP'),
'PHISHING_PAYLOAD': config.Get(
'PHISHING_PAYLOAD_DESCRIP'),
'SET_FILE_EXTENSION_ATTACK': config.Get(
'SET_FILE_EXTENSION_ATTACK_DESCRIP'),
'SET_EMAIL_TEMPLATE': config.Get(
'SET_EMAIL_TEMPLATE_DESCRIP'),
'SMTP_LOGIN': config.Get('SMTP_LOGIN_DESCRIP'),
'SMTP_PASS': config.Get('SMTP_PASS_DESCRIP'),
'SMTP_HOST': config.Get('SMTP_HOST_DESCRIP'),
'SMTP_PORT': config.Get('SMTP_PORT_DESCRIP'),
'EMAIL_PRIORITY': config.Get(
'EMAIL_PRIORITY_DESCRIP'),
'PDF_TEMPLATE': config.Get('PDF_TEMPLATE_DESCRIP'),
'WORD_TEMPLATE': config.Get(
'WORD_TEMPLATE_DESCRIP'),
'MSF_LISTENER_IP': config.Get(
'MSF_LISTENER_IP_DESCRIP'),
'MSF_LISTENER_PORT': config.Get(
'MSF_LISTENER_PORT_DESCRIP'),
'MSF_LISTENER_SETUP': config.Get(
'MSF_LISTENER_SETUP_DESCRIP'),
'ATTACHMENT_NAME': config.Get(
'ATTACHMENT_NAME_DESCRIP'),
'PHISHING_SCRIPT_DIR': config.Get(
'PHISHING_SCRIPT_DIR_DESCRIP')
},
'Optional': {
'PHISHING_CUSTOM_EXE_PAYLOAD_DIR': config.Get(
'PHISHING_CUSTOM_EXE_PAYLOAD_DIR_DESCRIP'),
'PHISHING_CUSTOM_EXE_PAYLOAD': config.Get(
'PHISHING_CUSTOM_EXE_PAYLOAD_DESCRIP'),
'ISHELL_EXIT_METHOD': config.Get(
'ISHELL_EXIT_METHOD_DESCRIP'),
'ISHELL_DELAY_BETWEEN_COMMANDS': config.Get(
'ISHELL_DELAY_BETWEEN_COMMANDS_DESCRIP'),
'ISHELL_COMMANDS_BEFORE_EXIT': config.Get(
'ISHELL_COMMANDS_BEFORE_EXIT_DESCRIP'),
'ISHELL_COMMANDS_BEFORE_EXIT_DELIM': config.Get(
'ISHELL_COMMANDS_BEFORE_EXIT_DELIM_DESCRIP'),
'REPEAT_DELIM': config.Get('REPEAT_DELIM_DESCRIP')
}}, PluginInfo):
#Let user specify the attachment name:
#Args['ATTACHMENT_NAME'] = Args['ATTACHMENT_NAME']+"_"+Args['PHISHING_PAYLOAD']+"-"+Args['SET_EMAIL_TEMPLATE']
plugin_params.SetConfig(
Args) # Only now, after modifying ATTACHMENT_NAME, update config
#print "Args="+str(Args)
Content += ServiceLocator.get_component("spear_phishing").Run(Args, PluginInfo)
#Content += ServiceLocator.get_component("plugin_helper").DrawCommandDump('Test Command', 'Output', ServiceLocator.get_component("config").GetResources('SendPhishingAttackviaSET'), PluginInfo, Content)
return Content
示例10: intialise_proxy_manager
def intialise_proxy_manager(options):
""" Proxy Manager initialization.
:param dict options: Proxy manager configuration parameters.
"""
proxy_manager = None
if options['Botnet_mode'] is not None:
proxy_manager = Proxy_manager()
answer = "Yes"
proxies = []
if options['Botnet_mode'][0] == "miner":
miner = Proxy_Miner()
proxies = miner.start_miner()
if options['Botnet_mode'][0] == "list": # load proxies from list
proxies = proxy_manager.load_proxy_list(
options['Botnet_mode'][1]
)
answer = raw_input(
"[#] Do you want to check the proxy list? [Yes/no] : "
)
if answer.upper() in ["", "YES", "Y"]:
proxy_q = multiprocessing.Queue()
proxy_checker = multiprocessing.Process(
target=Proxy_Checker.check_proxies,
args=(proxy_q, proxies,)
)
logging.info("Checking Proxies...")
start_time = time.time()
proxy_checker.start()
proxies = proxy_q.get()
proxy_checker.join()
proxy_manager.proxies = proxies
proxy_manager.number_of_proxies = len(proxies)
if options['Botnet_mode'][0] == "miner":
logging.info("Writing proxies to disk(~/.owtf/proxy_miner/proxies.txt)")
miner.export_proxies_to_file("proxies.txt", proxies)
if answer.upper() in ["", "YES", "Y"]:
logging.info(
"Proxy Check Time: %s",
time.strftime(
'%H:%M:%S',
time.localtime(time.time() - start_time - 3600)
)
)
cprint("Done")
if proxy_manager.number_of_proxies is 0:
ServiceLocator.get_component("error_handler").FrameworkAbort("No Alive proxies.")
proxy = proxy_manager.get_next_available_proxy()
# check proxy var... http:// sock://
options['OutboundProxy'] = []
options['OutboundProxy'].append(proxy["proxy"][0])
options['OutboundProxy'].append(proxy["proxy"][1])
示例11: run
def run(PluginInfo):
#Core.Config.Show()
# True = Use Transaction Cache if possible: Visit the start URLs if not already visited
plugin_helper = ServiceLocator.get_component("plugin_helper")
TransactionTable = plugin_helper.TransactionTableForURLList(True, ServiceLocator.get_component("target").GetAsList(['target_url', 'top_url']))
Content = plugin_helper.ResearchFingerprintInlog() + TransactionTable
Content += plugin_helper.CommandDump('Test Command', 'Output', ServiceLocator.get_component("resource").GetResources('SemiPassiveFingerPrint'), PluginInfo, Content)
return Content
示例12: run
def run(PluginInfo):
#ServiceLocator.get_component("config").Show()
urls = ServiceLocator.get_component("url_manager").GetURLsToVisit()
for url in urls: # This will return only unvisited urls
ServiceLocator.get_component("requester").GetTransaction(True, url) # Use cache if possible
Content = str(len(urls))+" URLs were visited"
OWTFLogger.log(Content)
return ServiceLocator.get_component("plugin_helper").HtmlString(Content)
示例13: run
def run(PluginInfo):
#ServiceLocator.get_component("config").Show()
# Define DirBuster Commands to use depending on Interaction Setting:
# DirBuster allows much more control when interactive
# DirBuster can also be run non-interactively for scripting
DirBusterInteraction = { 'true' : 'DirBusterInteractive', 'false' : 'DirBusterNotInteractive' }
Content = ServiceLocator.get_component("plugin_helper").CommandDump('Test Command', 'Output', ServiceLocator.get_component("resource").GetResources(DirBusterInteraction[ServiceLocator.get_component("db_config").Get('INTERACTIVE')]), PluginInfo, [])
Content += ServiceLocator.get_component("plugin_helper").CommandDump('Test Command', 'Output', ServiceLocator.get_component("resource").GetResources('DirBuster_Extract_URLs'), PluginInfo, [])
return Content
示例14: get_handlers
def get_handlers():
db_plugin = ServiceLocator.get_component("db_plugin")
config = ServiceLocator.get_component("config")
plugin_group_re = '(' + '|'.join(db_plugin.GetAllGroups()) + ')?'
plugin_type_re = '(' + '|'.join(db_plugin.GetAllTypes()) + ')?'
plugin_code_re = '([0-9A-Z\-]+)?'
URLS = [
tornado.web.url(r'/api/errors/?([0-9]+)?/?$', api_handlers.ErrorDataHandler, name='errors_api_url'),
tornado.web.url(r'/api/sessions/?([0-9]+)?/?(activate|add|remove)?/?$', api_handlers.OWTFSessionHandler, name='owtf_sessions_api_url'),
tornado.web.url(r'/api/targets/([0-9]+)/transactions/([0-9]+)/forward?$', api_handlers.ForwardToZAPHandler, name='forward_zap_url'),
tornado.web.url(r'/api/targets/([0-9]+)/transactions/([0-9]+)/replay?$', api_handlers.ReplayRequestHandler, name='transaction_replay_api_url'),
tornado.web.url(r'/api/targets/([0-9]+)/transactions/zest/?$', api_handlers.ZestScriptHandler, name='zest_log_url'),
tornado.web.url(r'/api/targets/([0-9]+)/transactions/zconsole/?$', api_handlers.ZestScriptHandler, name='zest_console_api_url'),
tornado.web.url(r'/api/targets/([0-9]+)/transactions/([0-9]+)/zest/?$', api_handlers.ZestScriptHandler, name='zest_api_url'),
tornado.web.url(r'/api/plugins/?' + plugin_group_re + '/?' + plugin_type_re + '/?' + plugin_code_re + '/?$', api_handlers.PluginDataHandler, name='plugins_api_url'),
tornado.web.url(r'/api/plugins/progress/?$', api_handlers.ProgressBarHandler, name='poutput_count'),
tornado.web.url(r'/api/targets/search/?$', api_handlers.TargetConfigSearchHandler, name='targets_search_api_url'),
tornado.web.url(r'/api/targets/?([0-9]+)?/?$', api_handlers.TargetConfigHandler, name='targets_api_url'),
tornado.web.url(r'/api/targets/([0-9]+)/urls/?$', api_handlers.URLDataHandler, name='urls_api_url'),
tornado.web.url(r'/api/targets/([0-9]+)/urls/search/?$', api_handlers.URLSearchHandler, name='urls_search_api_url'),
tornado.web.url(r'/api/targets/([0-9]+)/sessions/?$', api_handlers.SessionsDataHandler, name='sessions_api_url'),
tornado.web.url(r'/api/targets/([0-9]+)/transactions/?([0-9]+)?/?$', api_handlers.TransactionDataHandler, name='transactions_api_url'),
tornado.web.url(r'/api/targets/([0-9]+)/transactions/search/?$', api_handlers.TransactionSearchHandler, name='transactions_search_api_url'),
tornado.web.url(r'/api/targets/([0-9]+)/poutput/?' + plugin_group_re + '/?' + plugin_type_re + '/?' + plugin_code_re + '/?$', api_handlers.PluginOutputHandler, name='poutput_api_url'),
# The following one url is dummy and actually processed in file server
tornado.web.url(r'/api/workers/?([0-9]+)?/?(abort|pause|resume)?/?$', api_handlers.WorkerHandler, name='workers_api_url'),
tornado.web.url(r'/api/worklist/?([0-9]+)?/?(pause|resume|delete)?/?$', api_handlers.WorklistHandler, name='worklist_api_url'),
tornado.web.url(r'/api/worklist/search/?$', api_handlers.WorklistSearchHandler, name='worklist_search_api_url'),
tornado.web.url(r'/api/configuration/?$', api_handlers.ConfigurationHandler, name='configuration_api_url'),
tornado.web.url(r'/api/plugnhack/?$', api_handlers.PlugnhackHandler, name='plugnhack_api_url'),
tornado.web.url(r'/api/update/?$', api_handlers.AutoUpdaterHandler, name='auto_updater_api_url'),
(r'/static/(.*)', tornado.web.StaticFileHandler, {'path': config.FrameworkConfigGet('STATICFILES_DIR')}),
tornado.web.url(r'/output_files/(.*)', ui_handlers.FileRedirectHandler, name='file_redirect_url'),
tornado.web.url(r'/?$', ui_handlers.Redirect, name='redirect_ui_url'),
tornado.web.url(r'/ui/?$', ui_handlers.Home, name='home_ui_url'),
tornado.web.url(r'/ui/targets/?([0-9]+)?/?$', ui_handlers.TargetManager, name='targets_ui_url'),
tornado.web.url(r'/ui/targets/([0-9]+)/transactions/zconsole?$', ui_handlers.ZestScriptConsoleHandler, name='zest_console_url'),
tornado.web.url(r'/ui/targets/([0-9]+)/transactions/([0-9]+)/replay?$', ui_handlers.ReplayRequest, name='transaction_replay_url'),
tornado.web.url(r'/ui/targets/([0-9]+)/transactions/?([0-9]+)?/?$', ui_handlers.TransactionLog, name='transaction_log_url'),
tornado.web.url(r'/ui/targets/([0-9]+)/sessions/?$', ui_handlers.HTTPSessions, name='sessions_ui_url'),
tornado.web.url(r'/ui/targets/([0-9]+)/urls/?$', ui_handlers.UrlLog, name='url_log_url'),
tornado.web.url(r'/ui/targets/([0-9]+)/poutput/?', ui_handlers.PluginOutput, name='poutput_ui_url'),
tornado.web.url(r'/ui/workers/?([0-9])?/?', ui_handlers.WorkerManager, name='workers_ui_url'),
tornado.web.url(r'/ui/worklist/?', ui_handlers.WorklistManager, name='worklist_ui_url'),
tornado.web.url(r'/ui/configuration/?$', ui_handlers.ConfigurationManager, name='configuration_ui_url'),
tornado.web.url(r'/ui/plugnhack/?', ui_handlers.PlugnHack, name='plugnhack_ui_url'),
tornado.web.url(r'/ui/plugnhack/?(.*)', ui_handlers.PlugnHack, name='plugnhack_ui_manifest_url'),
tornado.web.url(r'/ui/help/?', ui_handlers.Help, name='help_ui_url')]
return (URLS)
示例15: run
def run(PluginInfo):
# ServiceLocator.get_component("config").Show()
plugin_helper = ServiceLocator.get_component("plugin_helper")
Content = plugin_helper.CommandDump('Test Command', 'Output',
ServiceLocator.get_component(
"resource").GetResources(
'PassiveSearchEngineDiscoveryCmd'),
PluginInfo, [])
Content += plugin_helper.ResourceLinkList('Online Resources',
ServiceLocator.get_component(
"resource").GetResources(
'PassiveSearchEngineDiscoveryLnk'))
return Content