2021-09-18 11:32:31 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2021-09-15 19:37:41 +00:00
|
|
|
import argparse
|
2021-09-18 11:32:31 +00:00
|
|
|
import os
|
2021-09-15 19:37:41 +00:00
|
|
|
import sys
|
2021-09-16 05:33:11 +00:00
|
|
|
import json
|
2021-09-15 19:37:41 +00:00
|
|
|
|
2021-09-18 11:32:31 +00:00
|
|
|
runPath = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
sys.path.append(os.path.join(runPath, ".."))
|
|
|
|
from lib.cpeguesser import CPEGuesser
|
2021-09-15 19:37:41 +00:00
|
|
|
|
2021-09-18 11:32:31 +00:00
|
|
|
if __name__ == '__main__':
|
2021-10-19 16:30:29 +00:00
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description='Find potential CPE names from a list of keyword(s) and return a JSON of the results'
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
'word',
|
|
|
|
metavar='WORD',
|
|
|
|
type=str,
|
|
|
|
nargs='+',
|
|
|
|
help='One or more keyword(s) to lookup',
|
|
|
|
)
|
2021-09-18 11:32:31 +00:00
|
|
|
args = parser.parse_args()
|
2021-09-16 05:33:11 +00:00
|
|
|
|
2021-09-18 11:32:31 +00:00
|
|
|
cpeGuesser = CPEGuesser()
|
|
|
|
print(json.dumps(cpeGuesser.guessCpe(args.word)))
|