本文整理汇总了Python中owtf.dependency_management.dependency_resolver.ServiceLocator类的典型用法代码示例。如果您正苦于以下问题:Python ServiceLocator类的具体用法?Python ServiceLocator怎么用?Python ServiceLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServiceLocator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
def run(PluginInfo):
urls = ServiceLocator.get_component("url_manager").get_urls_to_visit()
for url in urls: # This will return only unvisited urls
ServiceLocator.get_component("requester").get_transaction(True, url) # Use cache if possible
Content = "%s URLs were visited" % str(len(urls))
OWTFLogger.log(Content)
return ServiceLocator.get_component("plugin_helper").HtmlString(Content)
示例2: main
def main(args):
""" The main wrapper which loads everything
:param args: User supplied arguments dictionary
:type args: `dict`
:return:
:rtype: None
"""
banner()
# Get tool path from script path:
root_dir = os.path.dirname(os.path.abspath(args[0])) or '.'
owtf_pid = os.getpid()
try:
ComponentInitialiser.initialisation_phase_1(root_dir, owtf_pid)
except DatabaseNotRunningException:
exit(-1)
args = process_options(args[1:])
ServiceLocator.get_component("config").process_phase1(args)
ComponentInitialiser.initialisation_phase_2(args)
# Initialise Framework.
core = Core()
logging.warn(
"OWTF Version: %s, Release: %s " % (
ServiceLocator.get_component("config").get_val('VERSION'),
ServiceLocator.get_component("config").get_val('RELEASE'))
)
run_owtf(core, args)
示例3: run
def run(PluginInfo):
Content = []
plugin_params = ServiceLocator.get_component("plugin_params")
config = ServiceLocator.get_component("config")
args = {
'Description': DESCRIPTION,
'Mandatory': {
'RHOST': config.get_val('RHOST_DESCRIP'),
'RPORT': config.get_val('RPORT_DESCRIP'),
'CATEGORY': 'Category to use (i.e. ' + ', '.join(sorted(CATEGORIES)) + ')'
},
'Optional': {
'BRUTEFORCER': 'Bruteforcer to use (i.e. ' + ', '.join(sorted(BRUTEFORCER)) + ')',
'ONLINE_USER_LIST': config.get_val('ONLINE_USER_LIST_DESCRIP'),
'ONLINE_PASSWORD_LIST': config.get_val('ONLINE_PASSWORD_LIST_DESCRIP'),
'THREADS': config.get_val('THREADS_DESCRIP'),
'_RESPONSE_WAIT': config.get_val('_RESPONSE_WAIT_DESCRIP'),
'CONNECT_WAIT': config.get_val('CONNECT_WAIT_DESCRIP'),
'REPEAT_DELIM': config.get_val('REPEAT_DELIM_DESCRIP')
}
}
for Args in plugin_params.get_args(args, PluginInfo):
plugin_params.set_config(Args)
resource = config.get_resources('PassBruteForce_' + Args['BRUTEFORCER'] + "_" + Args['CATEGORY'])
Content += ServiceLocator.get_component("plugin_helper").CommandDump('Test Command', 'Output', resource,
PluginInfo, "") # No previous output
return Content
示例4: run
def run(PluginInfo):
Content = []
plugin_params = ServiceLocator.get_component("plugin_params")
config = ServiceLocator.get_component("config")
args = {
'Description': DESCRIPTION,
'Mandatory': {
'EMAIL_TARGET': config.get_val('EMAIL_TARGET_DESCRIP'),
'EMAIL_FROM': config.get_val('EMAIL_FROM_DESCRIP'),
'SMTP_LOGIN': config.get_val('SMTP_LOGIN_DESCRIP'),
'SMTP_PASS': config.get_val('SMTP_PASS_DESCRIP'),
'SMTP_HOST': config.get_val('SMTP_HOST_DESCRIP'),
'SMTP_PORT': config.get_val('SMTP_PORT_DESCRIP'),
'EMAIL_PRIORITY': config.get_val('EMAIL_PRIORITY_DESCRIP'),
'EMAIL_SUBJECT': config.get_val('EMAIL_SUBJECT_DESCRIP'),
'EMAIL_BODY': config.get_val('EMAIL_BODY_DESCRIP'),
},
'Optional': {
'EMAIL_ATTACHMENT': config.get_val('EMAIL_ATTACHMENT_DESCRIP'),
'REPEAT_DELIM': config.get_val('REPEAT_DELIM_DESCRIP')
}
}
for Args in plugin_params.get_args(args, PluginInfo):
plugin_params.set_config(Args) # Update config
if ServiceLocator.get_component("smtp").Send(Args):
cprint("Email delivered succcessfully")
else:
cprint("Email delivery failed")
resource = ServiceLocator.get_component("config").get_resources('SendPhishingAttackviaSET')
Content += ServiceLocator.get_component("plugin_helper").CommandDump('Test Command', 'Output', resource,
PluginInfo, Content)
return Content
示例5: run
def run(PluginInfo):
Content = []
plugin_params = ServiceLocator.get_component("plugin_params")
config = ServiceLocator.get_component("config")
smb = ServiceLocator.get_component("smb")
args = {
'Description': DESCRIPTION,
'Mandatory': {
'SMB_HOST': config.get_val('SMB_HOST_DESCRIP'),
'SMB_SHARE': config.get_val('SMB_SHARE_DESCRIP'),
'SMB_MOUNT_POINT': config.get_val('SMB_MOUNT_POINT_DESCRIP'),
},
'Optional': {
'SMB_USER': config.get_val('SMB_USER_DESCRIP'),
'SMB_PASS': config.get_val('SMB_PASS_DESCRIP'),
'SMB_DOWNLOAD': config.get_val('SMB_DOWNLOAD_DESCRIP'),
'SMB_UPLOAD': config.get_val('SMB_UPLOAD_DESCRIP'),
'REPEAT_DELIM': config.get_val('REPEAT_DELIM_DESCRIP')
}
}
for Args in plugin_params.get_args(args, PluginInfo):
plugin_params.set_config(Args) # Sets the auxiliary plugin arguments as config
smb.Mount(Args, PluginInfo)
smb.Transfer()
if not smb.IsClosed(): # Ensure clean exit if reusing connection
smb.UnMount(PluginInfo)
return Content
示例6: run
def run(PluginInfo):
Content = []
config = ServiceLocator.get_component("config")
OWTFLogger.log("WARNING: This plugin requires a small selenium installation, please run '%s' if you have issues" %
config.get_val('INSTALL_SCRIPT'))
plugin_params = ServiceLocator.get_component("plugin_params")
args = {
'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_val('REPEAT_DELIM_DESCRIP')}
}
for Args in plugin_params.get_args(args, PluginInfo):
plugin_params.set_config(Args)
InputFile = config.get_val("SELENIUM_URL_VECTORS_" + Args['CATEGORY'])
URLLauncher = ServiceLocator.get_component("selenium_handler").CreateURLLauncher({
'BASE_URL': Args['BASE_URL'],
'INPUT_FILE': InputFile
})
URLLauncher.run()
return Content
示例7: run
def run(PluginInfo):
return ServiceLocator.get_component("plugin_helper").CommandDump(
'Test Command',
'Output',
ServiceLocator.get_component("resource").get_resources('DomainBruteForcing'),
PluginInfo,
"") # No previous output
示例8: run
def run(PluginInfo):
plugin_helper = ServiceLocator.get_component("plugin_helper")
resource = ServiceLocator.get_component("resource").get_resources('PassiveSearchEngineDiscoveryCmd')
resource_online = ServiceLocator.get_component("resource").get_resources('PassiveSearchEngineDiscoveryLnk')
Content = plugin_helper.CommandDump('Test Command', 'Output', resource, PluginInfo, [])
Content += plugin_helper.resource_linklist('Online Resources', resource_online)
return Content
示例9: run
def run(PluginInfo):
plugin_helper = ServiceLocator.get_component("plugin_helper")
resource = ServiceLocator.get_component("resource")
NiktoOutput = plugin_helper.CommandDump('Test Command', 'Output', resource.get_resources('Nikto_Unauth'),
PluginInfo, [])
Content = plugin_helper.CommandDump('Test Command', 'Output', resource.get_resources('Nikto_Verify_Unauth'),
PluginInfo, NiktoOutput)
return Content + NiktoOutput # Show Nikto Verify FIRST (more useful, with links to findings, etc)
示例10: run
def run(PluginInfo):
# 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").get_as_list(
['target_url', 'top_url']))
resource = ServiceLocator.get_component("resource").get_resources('SemiPassiveFingerPrint')
Content = plugin_helper.ResearchFingerprintInlog() + TransactionTable
Content += plugin_helper.CommandDump('Test Command', 'Output', resource, PluginInfo, Content)
return Content
示例11: run
def run(PluginInfo):
target = ServiceLocator.get_component("target")
URL = target.get('top_url')
# TODO: PUT not working right yet
plugin_helper = ServiceLocator.get_component("plugin_helper")
Content = plugin_helper.TransactionTableForURL(True, URL, Method='TRACE')
resource = ServiceLocator.get_component("resource")
Content += plugin_helper.CommandDump('Test Command', 'Output', resource.get_resources('ActiveHTTPMethods'),
PluginInfo, Content)
return Content
示例12: run
def run(PluginInfo):
Content = []
plugin_params = ServiceLocator.get_component("plugin_params")
config = ServiceLocator.get_component("config")
args = {
'Description': DESCRIPTION,
'Mandatory': {
'RHOST': config.get_val('RHOST_DESCRIP'),
'SBD_PORT': config.get_val('SBD_PORT_DESCRIP'),
'SBD_PASSWORD': config.get_val('SBD_PASSWORD_DESCRIP'),
'COMMAND_FILE': config.get_val('COMMAND_FILE_DESCRIP')
},
'Optional': {'REPEAT_DELIM': config.get_val('REPEAT_DELIM_DESCRIP')}
}
for Args in plugin_params.get_args(args, PluginInfo):
plugin_params.set_config(Args) # Sets the auxiliary plugin arguments as config
ServiceLocator.get_component("interactive_shell").Open({
'ConnectVia': ServiceLocator.get_component("resource").get_resources('RCE_SBD_Connection'),
'InitialCommands': None,
'ExitMethod': Args['ISHELL_EXIT_METHOD'],
'CommandsBeforeExit': Args['ISHELL_COMMANDS_BEFORE_EXIT'],
'CommandsBeforeExitDelim': Args['ISHELL_COMMANDS_BEFORE_EXIT_DELIM'],
'RHOST': Args['RHOST'],
'RPORT': Args['SBD_PORT']
}, PluginInfo)
Content += ServiceLocator.get_component("interactive_shell").RunCommandList(get_file_as_list(
Args['COMMAND_FILE']), PluginInfo)
if not ServiceLocator.get_component("interactive_shell").IsClosed(): # Ensure clean exit if reusing connection
ServiceLocator.get_component("interactive_shell").Close(PluginInfo)
return Content
示例13: run
def run(PluginInfo):
resource = ServiceLocator.get_component("resource")
Content = ServiceLocator.get_component("plugin_helper").Tabbedresource_linklist([
['DNS', resource.get_resources('PassiveAppDiscoveryDNS')],
['WHOIS', resource.get_resources('PassiveAppDiscoveryWHOIS')],
['DB Lookups', resource.get_resources('PassiveAppDiscoveryDbLookup')],
['Ping', resource.get_resources('PassiveAppDiscoveryPing')],
['Traceroute', resource.get_resources('PassiveAppDiscoveryTraceroute')],
['Misc', resource.get_resources('PassiveAppDiscoveryMisc')]
])
return Content
示例14: run
def run(PluginInfo):
url_list = []
for File in ["crossdomain.xml", "clientaccesspolicy.xml"]:
for url in ServiceLocator.get_component("target").get_as_list(['target_url', 'top_url']):
url_list.append(url + "/" + File) # Compute all URL + File combinations
# The requester owtf component will unique the URLs
TransactionList = ServiceLocator.get_component("requester").get_transactions(True, url_list)
# Even though we have transaction list, those transactions do not have id
# because our proxy stores the transactions and not the requester. So the
# best way is to use the url list to retrieve transactions while making the
# report
return ServiceLocator.get_component("plugin_helper").TransactionTableForURLList(True, url_list, "GET")
示例15: run
def run(PluginInfo):
Content = []
Iteration = 1 # Iteration counter initialisation
plugin_params = ServiceLocator.get_component("plugin_params")
config = ServiceLocator.get_component("config")
args = {
'Description': DESCRIPTION,
'Mandatory': {
'RHOST': config.get_val('RHOST_DESCRIP'),
'SBD_PORT': config.get_val('SBD_PORT_DESCRIP'),
'SBD_PASSWORD': config.get_val('SBD_PASSWORD_DESCRIP'),
'COMMAND_PREFIX': 'The command string to be pre-pended to the tests (i.e. /usr/lib/firefox... http...)',
},
'Optional': {
'TEST': 'The test to be included between prefix and suffix',
'COMMAND_SUFFIX': 'The URL to be appended to the tests (i.e. ...whatever)',
'ISHELL_REUSE_CONNECTION': config.get_val('ISHELL_REUSE_CONNECTION_DESCRIP'),
'ISHELL_EXIT_METHOD': config.get_val('ISHELL_EXIT_METHOD_DESCRIP'),
'ISHELL_DELAY_BETWEEN_COMMANDS': config.get_val('ISHELL_DELAY_BETWEEN_COMMANDS_DESCRIP'),
'ISHELL_COMMANDS_BEFORE_EXIT': config.get_val('ISHELL_COMMANDS_BEFORE_EXIT_DESCRIP'),
'ISHELL_COMMANDS_BEFORE_EXIT_DELIM': config.get_val('ISHELL_COMMANDS_BEFORE_EXIT_DELIM_DESCRIP'),
'REPEAT_DELIM': config.get_val('REPEAT_DELIM_DESCRIP')
}
}
for Args in plugin_params.get_args(args, PluginInfo):
plugin_params.set_config(Args) # Sets the auxiliary plugin arguments as config
REUSE_CONNECTION = (Args['ISHELL_REUSE_CONNECTION'] == 'yes')
DELAY_BETWEEN_COMMANDS = Args['ISHELL_DELAY_BETWEEN_COMMANDS']
if (Iteration == 1) or (not REUSE_CONNECTION):
ServiceLocator.get_component("interactive_shell").Open({
'ConnectVia': config.get_resources('RCE_SBD_Connection'),
'InitialCommands': None,
'ExitMethod': Args['ISHELL_EXIT_METHOD'],
'CommandsBeforeExit': Args['ISHELL_COMMANDS_BEFORE_EXIT'],
'CommandsBeforeExitDelim': Args['ISHELL_COMMANDS_BEFORE_EXIT_DELIM'],
'RHOST': Args['RHOST'],
'RPORT': Args['SBD_PORT']
}, PluginInfo)
else:
OWTFLogger.log("Reusing initial connection..")
Content += ServiceLocator.get_component("interactive_shell").run(
Args['COMMAND_PREFIX'] + Args['TEST'] + Args['COMMAND_SUFFIX'], PluginInfo)
OWTFLogger.log("Sleeping " + DELAY_BETWEEN_COMMANDS + " second(s) (increases reliability)..")
time.sleep(int(DELAY_BETWEEN_COMMANDS))
if not REUSE_CONNECTION:
ServiceLocator.get_component("interactive_shell").Close(PluginInfo)
Iteration += 1 # Increase Iteration counter
if not ServiceLocator.get_component("interactive_shell").IsClosed(): # Ensure clean exit if reusing connection
ServiceLocator.get_component("interactive_shell").Close(PluginInfo)
return Content