Commit 29b005dd authored by PidgeyL's avatar PidgeyL
Browse files

remove unneeded imports, vars and the like

parent 6dec4443
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ from optparse import OptionParser
import sleekxmpp
import json

from lib.Config import Configuration
from lib.Query import lastentries, apigetcve, apibrowse, apisearch
# BSON MongoDB include ugly stuff that needs to be processed for standard JSON
from bson import json_util
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@ def sanitize(x):
  return x

# DB Functions
def ensureIndex(col, field):
  db[col].ensure_index(field)

def setColUpdate(collection, date):
  colINFO.update({"db": collection}, {"$set": {"last-modified": date}}, upsert=True)

+2 −3
Original line number Diff line number Diff line
@@ -14,18 +14,17 @@ import sys
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
import lib.DatabaseLayer as dbLayer

db = Configuration.getMongoConnection()


def setIndex(col, field):
    try:
        collection = db[col]
        collection.ensure_index(field)
        dbLayer.ensureIndex(col, field)
        print('[+]Success to create index %s on %s' % (field, col))
    except Exception as e:
        print('[-]Failed to create index %s on %s: %s' % (col, field, e))
+0 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ from lxml.html import fromstring
runPath = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(runPath, ".."))

from urllib.request import urlopen
import zipfile
import shutil
verbose = False
+0 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from flask import Flask, render_template, request, jsonify
from flask.ext.pymongo import PyMongo
from redis import exceptions as redisExceptions

import json
@@ -180,7 +179,6 @@ def cpe22(cpe):

@app.route('/api/cvefor/<path:cpe>', methods=['GET'])
def apiCVEFor(cpe):
    col = db['cves']
    cpe=urllib.parse.unquote_plus(cpe)
    cpe=toStringFormattedCPE(cpe)
    if not cpe: cpe='None'