diff --git a/bin/lookup.py b/bin/lookup.py index ddbef29..62ee813 100644 --- a/bin/lookup.py +++ b/bin/lookup.py @@ -21,7 +21,21 @@ if __name__ == "__main__": nargs="+", help="One or more keyword(s) to lookup", ) + parser.add_argument( + "--unique", + action="store_true", + help="Return the best CPE matching the keywords given", + default=False, + ) args = parser.parse_args() cpeGuesser = CPEGuesser() - print(json.dumps(cpeGuesser.guessCpe(args.word))) + r = cpeGuesser.guessCpe(args.word) + if not args.unique: + print(json.dumps(r)) + else: + try: + r = r[:1][0][1] + except: + r = [] + print(json.dumps(r))