Commit d5d23bcc authored by Alexandre Dulaunoy's avatar Alexandre Dulaunoy
Browse files

Merge branch 'master' of github.com:adulau/cve-search

parents 58541e93 2050cd13
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -130,6 +130,12 @@
    To add verbose output, add parameter <span class="code">-v</span><br />
    To let the script run automatically at a regular interval, add parameter <span class="code">-l</span><br />
  </p>
  <h3>Fulltext Search</h3>
  <p>
    If you want to enable fulltext search, you have to enable this in the database. <br />
    To do this, log into the Mongo database (<span class="code">$ mongo</span>) and run the following command: <span class="code">db.adminCommand({"setParameter": 1, "textSearchEnabled":true})</span>. <br />
    <b>Note:</b> when the Mongo database is shut down, fulltext search will be disabled again. Simply run the same command again to activate it.
  </p>
  <h2>Final notes</h2>
  <p>
    After this procedure the database is initialized and up to date. From this point on, to update the database, you only have to repeat the procedure to <a href="#update">update the database</a>.<br />
+3 −3
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ class CPEList:
            print("Error removing item from database: {:d}".format(ex))
            sys.exit()

    def update(self, cpeOld, cpeNew):
    def update(self, cpeOld, cpeNew, cpeType):
        try:
            cpeOld = cpeOld.strip()
            cpeNew = cpeNew.strip()
@@ -97,9 +97,9 @@ class CPEList:
                        # allow multiple comments
                        comments = cpeNew.split('#')
                        del comments[0]
                        cpeListElement = {'id': cpeID, 'comments': comments}
                        cpeListElement = {'id': cpeID, 'comments': comments, 'type':cpeType}
                    else:
                        cpeListElement = {'id': cpeNew}
                        cpeListElement = {'id': cpeNew, 'type':cpeType}
                    cpeDeleteElement = {'id': cpeOld.split('#')[0]}
                    self.collection.update(cpeDeleteElement, cpeListElement, upsert=False, multi=False)
                    return True
+2 −2
Original line number Diff line number Diff line
@@ -74,9 +74,9 @@ def removeBlacklist(cpe):
    return oList.remove(cpe)


def updateBlacklist(cpeOld, cpeNew):
def updateBlacklist(cpeOld, cpeNew, cpeType):
    oList = CPEList(collection, args)
    return oList.update(cpeOld, cpeNew)
    return oList.update(cpeOld, cpeNew, cpeType)

if __name__ == '__main__':
    oList = CPEList(collection, args)
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ runPath = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(runPath, ".."))

import traceback
from pymongo import TEXT

from lib.Config import Configuration

@@ -37,6 +38,7 @@ setIndex('cpeother', 'id')
setIndex('cves', 'id')
setIndex('cves', 'vulnerable_configuration')
setIndex('cves', 'Modified')
setIndex('cves', [("summary",TEXT)])
setIndex('vfeed', 'id')
setIndex('vendor', 'id')
setIndex('d2sec', 'id')
+2 −2
Original line number Diff line number Diff line
@@ -74,9 +74,9 @@ def removeWhitelist(cpe):
    return oList.remove(cpe)


def updateWhitelist(cpeOld, cpeNew):
def updateWhitelist(cpeOld, cpeNew, cpeType):
    oList = CPEList(collection, args)
    return oList.update(cpeOld, cpeNew)
    return oList.update(cpeOld, cpeNew, cpeType)

if __name__ == '__main__':
    oList = CPEList(collection, args)
Loading