Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
Fix update process with custom config file
Browse files Browse the repository at this point in the history
  • Loading branch information
ra1nb0rn committed Feb 22, 2024
1 parent 5bf9d7b commit 3793dda
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Changelog
This file keeps track of all notable changes between the different versions of search_vulns.

## v0.4.13 - 2024-02-22
### Added
- Store a client's configuration in the web app persistently on the client.
- Improve CPE retrieval for THE Flask from PalletsProjects.

### Fixed
- Display bug of related queries in web frontend.
- Bug in version comparison with more complex versions.
- Bug in update process with custom config file.


## v0.4.12 - 2024-02-06
### Added
- New config file concept, which simplifies a web server deployment
Expand Down
4 changes: 2 additions & 2 deletions search_vulns.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,10 +566,10 @@ def main():

if args.update == True:
from updater import run as run_updater
run_updater(False, args.api_key)
run_updater(False, args.api_key, args.config)
elif args.full_update == True:
from updater import run as run_updater
run_updater(True, args.api_key)
run_updater(True, args.api_key, args.config)

if not args.queries:
return
Expand Down
18 changes: 12 additions & 6 deletions updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
CPE_DICT_ARTIFACT_URL = "https://github.com/ra1nb0rn/search_vulns/releases/latest/download/cpe-search-dictionary.db3"
CPE_DEPRECATIONS_ARTIFACT_URL = "https://github.com/ra1nb0rn/search_vulns/releases/latest/download/deprecated-cpes.json"
CVE_EDB_MAP_ARTIFACT_URL = "https://github.com/ra1nb0rn/search_vulns/releases/latest/download/cveid_to_edbid.json"

CONFIG = _load_config()
CONFIG['DATABASE_BACKUP_FILE'] = CONFIG['DATABASE_FILE'] + '.bak'
CONFIG['CPE_DATABASE_BACKUP_FILE'] = CONFIG['cpe_search']['CPE_DATABASE_FILE'] + '.bak'
CONFIG['DEPRECATED_CPES_BACKUP_FILE'] = CONFIG['cpe_search']['DEPRECATED_CPES_FILE'] + '.bak'
POC_IN_GITHUB_REPO = "https://github.com/nomi-sec/PoC-in-GitHub.git"
POC_IN_GITHUB_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "PoC-in-GitHub")
REQUEST_HEADERS = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/62.0"}
Expand Down Expand Up @@ -409,7 +404,18 @@ def create_poc_in_github_table():
shutil.rmtree(POC_IN_GITHUB_DIR)


def run(full=False, nvd_api_key=None):
def run(full=False, nvd_api_key=None, config_file=""):
global CONFIG

# load config
if config_file:
CONFIG = _load_config(config_file)
else:
CONFIG = _load_config()
CONFIG['DATABASE_BACKUP_FILE'] = CONFIG['DATABASE_FILE'] + '.bak'
CONFIG['CPE_DATABASE_BACKUP_FILE'] = CONFIG['cpe_search']['CPE_DATABASE_FILE'] + '.bak'
CONFIG['DEPRECATED_CPES_BACKUP_FILE'] = CONFIG['cpe_search']['DEPRECATED_CPES_FILE'] + '.bak'

# create file dirs as needed
update_files = [CONFIG['DATABASE_FILE'], CONFIG['cpe_search']['CPE_DATABASE_FILE'],
CONFIG['CVE_EDB_MAP_FILE'], CONFIG['cpe_search']['DEPRECATED_CPES_FILE'],
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.12
0.4.13

0 comments on commit 3793dda

Please sign in to comment.