当前位置: 首页>>代码示例>>Python>>正文


Python lib.CVEs类代码示例

本文整理汇总了Python中lib.CVEs的典型用法代码示例。如果您正苦于以下问题:Python CVEs类的具体用法?Python CVEs怎么用?Python CVEs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CVEs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cve

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)
开发者ID:humbertcostas,项目名称:cve-search,代码行数:10,代码来源:index.py

示例2: cve

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)
开发者ID:dolfje,项目名称:cve-search,代码行数:13,代码来源:index.py

示例3: cve

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)
开发者ID:santosomar,项目名称:cve-search,代码行数:13,代码来源:index.py

示例4:

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
开发者ID:rodac5,项目名称:cve-search,代码行数:31,代码来源:search.py

示例5: CVE

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):
开发者ID:echodaemon,项目名称:cve-search,代码行数:31,代码来源:search_fulltext.py

示例6: type

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))
开发者ID:humbertcostas,项目名称:cve-search,代码行数:30,代码来源:db_dump.py

示例7: exists_in

sys.path.append(os.path.join(runPath, ".."))

import argparse

from lib.Config import Configuration
from lib.ProgressBar import progressbar
import lib.CVEs as cves
import lib.DatabaseLayer as db

argParser = argparse.ArgumentParser(description='Fulltext indexer for the MongoDB CVE collection')
argParser.add_argument('-v', action='store_true', default=False, help='Verbose logging')
argParser.add_argument('-l', default=5, help='Number of last entries to index (Default: 5) - 0 to index all documents')
argParser.add_argument('-n', action='store_true', default=False, help='lookup complete cpe (Common Platform Enumeration) name for vulnerable configuration to add in the index')
args = argParser.parse_args()

c = cves.last(namelookup=args.n)

indexpath = Configuration.getIndexdir()

from whoosh.index import create_in, exists_in, open_dir
from whoosh.fields import Schema, TEXT, ID

schema = Schema(title=TEXT(stored=True), path=ID(stored=True, unique=True), content=TEXT)

if not os.path.exists(indexpath):
    os.mkdir(indexpath)

if not exists_in(indexpath):
    ix = create_in(indexpath, schema)
else:
    ix = open_dir(indexpath)
开发者ID:ClaudineGinther,项目名称:cve-search,代码行数:31,代码来源:db_fulltext.py

示例8: CVEFilePrinter

    argParser.add_argument('-c', type=str, help='Access complexity')
    argParser.add_argument('-l', default=False, action='store_true', help='Print fix-related links')


    args = argParser.parse_args()

    cvss_lower_bound = args.s if args.s else 0.0
    product = args.p
    keyword = args.k if args.k else '.*'

    start_year = args.b if args.b else 1997
    end_year = args.e if args.e else 2050
    start_year = date_parser.parse(str(start_year) + '-01-01').isoformat()
    end_year = date_parser.parse(str(end_year+1) + '-01-01').isoformat()

    cves = CVEs.last(rankinglookup='', namelookup='', capeclookup='')
    printer = CVEFilePrinter(cves=cves, rankinglookup='', namelookup='', capeclookup='')

    if args.p:
        if args.d:
            # print_distinct_cves_to_excel(product, keyword, cvss_lower_bound)
            dump_fixes(product, keyword)
        elif args.y:
            print_cve_counts_by_year_to_excel(product, keyword, cvss_lower_bound)
        elif args.m:
            access_complexity = args.c if args.c != None else ".*"
            print_cve_counts_by_month_to_excel(product, keyword, cvss_lower_bound, access_complexity)
        elif args.t:
            (total, hits) = query.count_keywords(product_pattern=args.p, cvss_lower_bound=cvss_lower_bound, start_year=start_year, end_year=end_year)
            print_summary(total, hits)
        elif args.l:
开发者ID:standash,项目名称:cve-search,代码行数:31,代码来源:query.py

示例9: type

import argparse
import json
from bson import json_util

import lib.CVEs as cves
import lib.DatabaseLayer as db

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 via4 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
via4lookup = args.v
capeclookup = args.c

l = cves.last(rankinglookup=rankinglookup, via4lookup=via4lookup, 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'])
    date_fields = ['cvss-time', 'Modified', 'Published']
    for field in date_fields:
        if field in item:
            item[field] = str(item[field])
    print(json.dumps(item, sort_keys=True, default=json_util.default))
开发者ID:PidgeyL,项目名称:cve-search,代码行数:30,代码来源:db_dump.py

示例10: cve

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)
开发者ID:echodaemon,项目名称:cve-search,代码行数:7,代码来源:minimal-web.py

示例11: cve

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)
开发者ID:Lindatsght,项目名称:cve-search,代码行数:7,代码来源:index.py

示例12: cvesForCPE

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
开发者ID:PidgeyL,项目名称:cve-search,代码行数:8,代码来源:Query.py

示例13: apiCVEFor

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)
开发者ID:crudbug,项目名称:cve-search,代码行数:8,代码来源:index.py

示例14: apiCVEFor

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)
开发者ID:kevinandrewjohnston,项目名称:cve-search,代码行数:11,代码来源:minimal-web.py

示例15: cve

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)
开发者ID:axeliniyes,项目名称:cveScript,代码行数:11,代码来源:index.py


注:本文中的lib.CVEs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。