本文整理汇总了Python中lib.CVEs.last方法的典型用法代码示例。如果您正苦于以下问题:Python CVEs.last方法的具体用法?Python CVEs.last怎么用?Python CVEs.last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.CVEs
的用法示例。
在下文中一共展示了CVEs.last方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cve
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def cve(cveid):
cveid = cveid.upper()
cvesp = cves.last(rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True,subscorelookup=True)
cve = cvesp.getcve(cveid=cveid)
if cve is None:
return render_template('error.html',status={'except':'cve-not-found','info':{'cve':cveid}},minimal=True)
return render_template('cve.html', cve=cve, minimal=True)
示例2: cve
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def cve(cveid):
cvesp = cves.last(rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True,subscorelookup=True)
cve = cvesp.getcve(cveid=cveid)
if cve is None:
return page_not_found(404)
cve = markCPEs(cve)
return render_template('cve.html', cve=cve)
示例3: cvesForCPE
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def cvesForCPE(cpe):
cpe = tk.toStringFormattedCPE(cpe)
data = []
if cpe:
cvesp = cves.last(rankinglookup=False, namelookup=False, via4lookup=True, capeclookup=False)
for x in db.cvesForCPE(cpe):
data.append(cvesp.getcve(x['id']))
return data
示例4: apiCVEFor
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def apiCVEFor(cpe):
cpe=urllib.parse.unquote_plus(cpe)
cpe=toStringFormattedCPE(cpe)
r = []
cvesp = cves.last(rankinglookup=False, namelookup=False, vfeedlookup=True, capeclookup=False)
for x in dbLayer.cvesForCPE(cpe):
r.append(cvesp.getcve(x['id']))
return json.dumps(r)
示例5: cve
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def cve(cveid):
cveid = cveid.upper()
cvesp = cves.last(rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True,subscorelookup=True)
cve = cvesp.getcve(cveid=cveid)
if cve is None:
return render_template('error.html',status={'except':'cve-not-found','info':{'cve':cveid}})
cve = markCPEs(cve)
if current_user.is_authenticated():
dbLayer.addSeenCVEs(current_user.get_id(), cveid)
return render_template('cve.html', cve=cve)
示例6: apiCVEFor
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def apiCVEFor(cpe):
col = db['cves']
cpe=urllib.parse.unquote_plus(cpe)
cpe=toStringFormattedCPE(cpe)
if not cpe: cpe='None'
vulns = col.find({"vulnerable_configuration": {'$regex': cpe}}).sort("Modified", -1)
r = []
cvesp = cves.last(rankinglookup=False, namelookup=False, vfeedlookup=True, capeclookup=False)
for x in vulns:
r.append(cvesp.getcve(x['id']))
return json.dumps(r)
示例7: cve
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def cve(cveid):
cveid = cveid.upper()
cvesp = cves.last(rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True,subscorelookup=True)
cve = cvesp.getcve(cveid=cveid)
if cve is None:
return render_template('error.html',status={'except':'cve-not-found','info':{'cve':cveid}})
cve = markCPEs(cve)
plugManager.onCVEOpen(cveid, current_user=current_user)
pluginData = plugManager.cvePluginInfo(cveid, current_user=current_user)
return render_template('cve.html', cve=cve, plugins=pluginData)
示例8: cve
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def cve(cveid):
cveid = cveid.upper()
cvesp = cves.last(rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True,subscorelookup=True)
cve = cvesp.getcve(cveid=cveid)
if cve is None:
return render_template('error.html',status={'except':'cve-not-found','info':{'cve':cveid}})
cve = markCPEs(cve)
if current_user.is_authenticated():
l = getSeenCVEs()
if not cveid in l:
col=db.mgmt_seen
col.update({"user":current_user.get_id()},{"$addToSet":{"seen_cves":cveid}})
return render_template('cve.html', cve=cve)
示例9: cve
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def cve(cveid):
cveid = cveid.upper()
cvesp = cves.last(rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True, subscorelookup=True)
cve = cvesp.getcve(cveid=cveid)
if cve is None:
return render_template("error.html", status={"except": "cve-not-found", "info": {"cve": cveid}})
cve = markCPEs(cve)
if current_user.is_authenticated():
db.addSeenCVEs(current_user.get_id(), cveid)
bookmarked = "yes" if cveid in db.bookmarks(current_user.get_id()) else "no"
else:
bookmarked = None
return render_template("cve.html", cve=cve, bookmarked=bookmarked)
示例10: _enhance
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def _enhance(self, scan):
cvesp = cves.last(rankinglookup=False, namelookup=False, via4lookup=True, capeclookup=False)
for system in scan['systems']:
cpe=system['cpes'] if 'cpes' in system else None
if cpe:
cpes=[]
for c in cpe:
c=c.lower()
cpes.append({'cpe':c, 'cves':[cvesp.getcve(x['id'])
for x in db.cvesForCPE(toStringFormattedCPE(c))]})
system['cpes']=cpes
for service in system['services']:
if 'cpe' in service:
service['cves']=db.cvesForCPE(service['cpe'])
scan['enhanced']={"time": int(datetime.now().strftime('%s'))}
return scan
示例11: apilast
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def apilast():
limit = 30
cvesp = cves.last(rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True)
cve = cvesp.get(limit=limit)
return (jsonify({"results": cve} ))
示例12:
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
args = argParser.parse_args()
vSearch = args.p
relaxSearch = args.lax
cveSearch = [x.upper() for x in args.c] if args.c else None
vOutput = args.o
vFreeSearch = args.f
sLatest = args.l
namelookup = args.n
rankinglookup = args.r
capeclookup = args.a
last_ndays = args.t
summary_text= args.s
nlimit =args.i
cves = CVEs.last(rankinglookup=rankinglookup, namelookup=namelookup, capeclookup=capeclookup)
# replace special characters in vSearch with encoded version.
# Basically cuz I'm to lazy to handle conversion on DB creation ...
if vSearch:
vSearch = re.sub(r'\(', '%28', vSearch)
vSearch = re.sub(r'\)', '%29', vSearch)
# define which output to generate.
if vOutput == "csv":
csvOutput = 1
elif vOutput == "html":
htmlOutput = 1
elif vOutput == "xml":
xmlOutput = 1
from xml.etree.ElementTree import Element, SubElement, tostring
示例13: CVE
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
argParser.add_argument('-f', action='store_true', help='output matching CVE(s) in JSON')
argParser.add_argument('-m', type=int, default=False, help='most frequent terms in CVE description (m is top-m values)')
argParser.add_argument('-l', action='store_true', default=False, help='dump all terms encountered in CVE description')
argParser.add_argument('-g', action='store_true', default=False, help='graph of most frequent terms with each matching CVE (JSON output)')
argParser.add_argument('-s', action='store_true', default=False, help='enable stemming on graph JSON output (default is False)')
argParser.add_argument('-n', action='store_true', help='lookup complete cpe (Common Platform Enumeration) name for vulnerable configuration')
argParser.add_argument('-r', action='store_true', help='lookup ranking of vulnerable configuration')
args = argParser.parse_args()
if not args.q and not args.l and not args.g and not args.m:
argParser.print_help()
exit(1)
if args.f or args.t:
from lib import CVEs
cves = CVEs.last(rankinglookup=args.r, namelookup=args.n)
if args.q:
with ix.searcher() as searcher:
query = QueryParser("content", ix.schema).parse(" ".join(args.q))
results = searcher.search(query, limit=None)
for x in results:
if not args.f:
print (x['path'])
else:
print(json.dumps(cves.getcve(x['path']), sort_keys=True, default=json_util.default))
if args.t and not args.f:
print (" -- " + x['title'])
elif args.m:
xr = ix.searcher().reader()
for x in xr.most_frequent_terms("content", number=args.m):
示例14: api_cve
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
def api_cve(self, cveid):
cvesp = cves.last(rankinglookup=True, namelookup=True, via4lookup=True, capeclookup=True)
cve = cvesp.getcve(cveid=cveid.upper())
if not cve: raise(APIError('cve not found', 404))
return cve
示例15: elements
# 需要导入模块: from lib import CVEs [as 别名]
# 或者: from lib.CVEs import last [as 别名]
runPath = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(runPath, ".."))
import argparse
import json
from bson import json_util
import lib.CVEs as cves
import lib.DatabaseLayer as db
from lib.Config import Configuration
argParser = argparse.ArgumentParser(description='Dump database in JSON format')
argParser.add_argument('-r', default=False, action='store_true', help='Include ranking value')
argParser.add_argument('-v', default=False, action='store_true', help='Include vfeed map')
argParser.add_argument('-c', default=False, action='store_true', help='Include CAPEC information')
argParser.add_argument('-l', default=False, type=int, help='Limit output to n elements (default: unlimited)')
args = argParser.parse_args()
rankinglookup = args.r
vfeedlookup = args.v
capeclookup = args.c
l = cves.last(rankinglookup=rankinglookup, vfeedlookup=vfeedlookup, capeclookup=capeclookup)
for cveid in db.getCVEIDs(limit=args.l):
item = l.getcve(cveid=cveid)
if 'cvss' in item:
if type(item['cvss']) == str:
item['cvss'] = float(item['cvss'])
print (json.dumps(item, sort_keys=True, default=json_util.default))