本文整理汇总了Python中Modules类的典型用法代码示例。如果您正苦于以下问题:Python Modules类的具体用法?Python Modules怎么用?Python Modules使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Modules类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_init_file_no_param_passed
def test_get_init_file_no_param_passed(self):
"""Test the method that gets called when script is run directly when
no params are passed"""
error = 'A single init file name parameter is required by ' \
'Modules.py when invoked directly'
with mock.patch.object(sys, 'argv', ['Modules']):
with self.assertRaisesRegexp(RuntimeError, error):
Modules.get_init_file()
示例2: get_all_modules_paths
def get_all_modules_paths(self):
"""Get common modules and modules from packs if available"""
exploits = Modules.get_modules_names_dict(EXPLOITS_PATH)
if not os.path.exists(PACKS_PATH):
os.makedirs(PACKS_PATH)
files = os.listdir(PACKS_PATH)
for f in files:
path_to_pack = os.path.join(PACKS_PATH, f)
if os.path.isdir(path_to_pack):
pack_dirs = [fname.lower() for fname in os.listdir(path_to_pack)]
if "exploits" in pack_dirs:
full_path_to_pack_exploits = os.path.join(path_to_pack, "exploits")
exploits.update(Modules.get_modules_names_dict(full_path_to_pack_exploits))
return exploits
示例3: test_get_init_file_no_file_found
def test_get_init_file_no_file_found(self):
"""Test the function that gets called when script is run directly
when no init file is returned"""
modules_home = {'MODULESHOME': '/dummy/path/1'}
which_side_effects = ['/path/to/modulecmd', None, None]
find_side_effects = [None, None]
with mock.patch.object(sys, 'argv', ['Modules', 'python']):
with mock.patch.dict(os.environ, modules_home), \
mock.patch('Modules.which',
side_effect=which_side_effects), \
mock.patch('Modules.find_first_binary',
return_value=None), \
mock.patch('Modules.find_file_in_list',
side_effect=find_side_effects), \
mock.patch('__builtin__.execfile') as exec_file:
error = 'Unable to determine init file for python in ' \
'Modules.py'
with self.assertRaisesRegexp(RuntimeError, error):
Modules.get_init_file()
exec_file.assert_not_called()
示例4: test_get_init_file
def test_get_init_file(self):
"""Test the method that gets called when script is run directly"""
modules_home = {'MODULESHOME': '/dummy/path/1'}
which_side_effects = ['/path/to/modulecmd', None, None]
find_side_effects = [None, '/fake/path/modules/init/python.py']
with mock.patch('sys.stdout', new_callable=StringIO) as output:
with mock.patch.object(sys, 'argv', ['Modules', 'python']):
with mock.patch.dict(os.environ, modules_home), \
mock.patch('Modules.which',
side_effect=which_side_effects), \
mock.patch('Modules.find_first_binary',
return_value='/fake/path/modulecmd'), \
mock.patch('Modules.find_file_in_list',
side_effect=find_side_effects), \
mock.patch('__builtin__.execfile') as exec_file:
Modules.get_init_file()
stdout = output.getvalue()
self.assertEqual('/fake/path/modules/init/python.py\n', stdout)
exec_file.assert_not_called()
示例5: call
def call(self, args):
u"""
call methods from parsed command
"""
setting = False
if args.box:
Modules.saveDropBoxPath(args.box)
setting |= True
if args.dir:
Modules.saveDestDirPath(args.dir)
setting |= True
if args.interval:
try:
interval = int(args.interval) * 60
Modules.backupDaemon(interval)
except ValueError, e:
print "usage: %s -i [integer]" % sys.argv[0]
setting |= True
示例6: form_mac
def form_mac(self):
self.Fmac = GUIModules.frm_mac_generator()
self.Fmac.setGeometry(QRect(100, 100, 300, 100))
self.Fmac.show()
示例7: formDauth
def formDauth(self):
self.Fdeauth =GUIModules.frm_deauth()
self.Fdeauth.setGeometry(QRect(100, 100, 200, 200))
self.Fdeauth.show()
示例8: showProbe
def showProbe(self):
self.Fprobe = GUIModules.frm_PMonitor()
self.Fprobe.setGeometry(QRect(100, 100, 400, 400))
self.Fprobe.show()
示例9: show_dhcpDOS
def show_dhcpDOS(self):
self.Fstar = GUIModules.frm_dhcp_Attack()
self.Fstar.setGeometry(QRect(100, 100, 450, 200))
self.Fstar.show()
示例10: show_windows_update
def show_windows_update(self):
self.FWinUpdate = GUIModules.frm_update_attack()
self.FWinUpdate.setGeometry(QRect(100, 100, 450, 300))
self.FWinUpdate.show()
示例11: test_module
def test_module():
"""Test the module function"""
with mock.patch('Modules.Module.module') as mock_module:
Modules.module('load', 'sierra/version')
mock_module.assert_called_once_with('load', 'sierra/version')
示例12: logsnetcreds
def logsnetcreds(self):
self.FnetCreds = GUIModules.frm_NetCredsLogger()
self.FnetCreds.setWindowTitle('NetCreds Logger')
self.FnetCreds.show()
示例13: while
print "Loading modules..."
import Modules
print "Loaded Modules:"
for item in Modules.module_list:
print "\t%s (%s)" % (item.short_name, item.long_name)
import AFX
#ok, let's just loop and take commands and stuff for now...
print "Type ? for help"
s = ""
while (s != 'q'):
s = raw_input("> ")
if (s == 'l'):
Modules.print_modules()
elif (s == '?'):
print "Commands:"
print "\tl: list modules"
print "\ti: module info"
print "\td: reload modules"
print "\tr: run module"
print "\t?: help"
print "\tq: quit\n"
elif (s == 'i'):
s = input("Module #: ")
Modules.print_module_info(s)
elif (s == "d"):
reload(Modules)
elif (s == "r"):
i = input("Module #: ")
示例14: test_module_list
def test_module_list():
"""Test the module_list function"""
with mock.patch('Modules.Module.module_list') as mock_module:
Modules.module_list()
mock_module.assert_called_once_with()
示例15: show_dns_spoof
def show_dns_spoof(self):
self.Fdns = GUIModules.frm_DnsSpoof()
self.Fdns.setGeometry(QRect(100, 100, 450, 300))
self.Fdns.show()