mirror of
https://github.com/cve-search/cpe-guesser.git
synced 2024-11-24 07:47:23 +00:00
chg: [lookup] add --unique
option to return the best matching CPE
This commit is contained in:
parent
30d9321fc9
commit
22fd8e122e
1 changed files with 15 additions and 1 deletions
|
@ -21,7 +21,21 @@ if __name__ == "__main__":
|
||||||
nargs="+",
|
nargs="+",
|
||||||
help="One or more keyword(s) to lookup",
|
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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
cpeGuesser = CPEGuesser()
|
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))
|
||||||
|
|
Loading…
Reference in a new issue