Ejemplo n.º 1
0
                       help='Verbose logging')
argParser.add_argument('-l',
                       default=None,
                       help='Number of last entries to index')
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 = 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)