mirror of
https://github.com/cve-search/cpe-guesser.git
synced 2024-11-14 19:08:27 +00:00
new: [import] add an --update option to not flush for production servers
This commit is contained in:
parent
6394f495a6
commit
b87e83909e
1 changed files with 2 additions and 1 deletions
|
@ -94,6 +94,7 @@ if __name__ == '__main__':
|
||||||
argparser = argparse.ArgumentParser(description='Initializes the Redis database with CPE dictionary.')
|
argparser = argparse.ArgumentParser(description='Initializes the Redis database with CPE dictionary.')
|
||||||
argparser.add_argument('--download', '-d', action='count', default=0, help='Download the CPE dictionary even if it already exists.')
|
argparser.add_argument('--download', '-d', action='count', default=0, help='Download the CPE dictionary even if it already exists.')
|
||||||
argparser.add_argument('--replace', '-r', action='count', default=0, help='Flush and repopulated the CPE database.')
|
argparser.add_argument('--replace', '-r', action='count', default=0, help='Flush and repopulated the CPE database.')
|
||||||
|
argparser.add_argument('--update', '-u', action='store_true', default=False, help='Update the CPE database without flushing')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
|
||||||
if args.replace == 0 and rdb.dbsize() > 0:
|
if args.replace == 0 and rdb.dbsize() > 0:
|
||||||
|
@ -122,7 +123,7 @@ if __name__ == '__main__':
|
||||||
elif os.path.isfile(cpe_path):
|
elif os.path.isfile(cpe_path):
|
||||||
print(f"Using existing file {cpe_path} ...")
|
print(f"Using existing file {cpe_path} ...")
|
||||||
|
|
||||||
if rdb.dbsize() > 0:
|
if rdb.dbsize() > 0 and not args.update:
|
||||||
print(f"Flushing {rdb.dbsize()} keys from the database...")
|
print(f"Flushing {rdb.dbsize()} keys from the database...")
|
||||||
rdb.flushdb()
|
rdb.flushdb()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue