Skip to content

Commit

Permalink
chg: [lookup] add --unique option to return the best matching CPE
Browse files Browse the repository at this point in the history
  • Loading branch information
adulau committed Nov 23, 2024
1 parent 30d9321 commit 22fd8e1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion bin/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,21 @@
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))

0 comments on commit 22fd8e1

Please sign in to comment.