cpe-guesser/bin/lookup.py

28 lines
686 B
Python
Raw Normal View History

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
2021-09-15 19:37:41 +00:00
import argparse
import os
2021-09-15 19:37:41 +00:00
import sys
import json
2021-09-15 19:37:41 +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
2024-04-05 14:03:23 +00:00
if __name__ == "__main__":
2021-10-19 16:30:29 +00:00
parser = argparse.ArgumentParser(
2024-04-05 14:03:23 +00:00
description="Find potential CPE names from a list of keyword(s) and return a JSON of the results"
2021-10-19 16:30:29 +00:00
)
parser.add_argument(
2024-04-05 14:03:23 +00:00
"word",
metavar="WORD",
2021-10-19 16:30:29 +00:00
type=str,
2024-04-05 14:03:23 +00:00
nargs="+",
help="One or more keyword(s) to lookup",
2021-10-19 16:30:29 +00:00
)
args = parser.parse_args()
cpeGuesser = CPEGuesser()
print(json.dumps(cpeGuesser.guessCpe(args.word)))