mirror of
https://github.com/cve-search/git-vuln-finder.git
synced 2024-11-22 14:57:20 +00:00
improved cli. removed useless import
This commit is contained in:
parent
fe4a656412
commit
2fa7b4583e
3 changed files with 82 additions and 81 deletions
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
# This software is part of cve-search.org
|
# This software is part of cve-search.org
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 Alexandre Dulaunoy - a@foo.be
|
# Copyright (c) 2019-2020 Alexandre Dulaunoy - a@foo.be
|
||||||
|
|
||||||
|
|
||||||
import git
|
import git
|
||||||
|
@ -17,15 +17,16 @@ import argparse
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from git_vuln_finder import (
|
from git_vuln_finder import (
|
||||||
build_pattern,
|
|
||||||
get_patterns,
|
get_patterns,
|
||||||
find_vuln,
|
find_vuln,
|
||||||
summary,
|
summary
|
||||||
extract_cve
|
|
||||||
)
|
)
|
||||||
|
|
||||||
PATTERNS_PATH="./git_vuln_finder/patterns"
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Point of entry for the script.
|
||||||
|
"""
|
||||||
|
# Parsing arguments
|
||||||
parser = argparse.ArgumentParser(description = "Finding potential software vulnerabilities from git commit messages.", epilog = "More info: https://github.com/cve-search/git-vuln-finder")
|
parser = argparse.ArgumentParser(description = "Finding potential software vulnerabilities from git commit messages.", epilog = "More info: https://github.com/cve-search/git-vuln-finder")
|
||||||
parser.add_argument("-v", help="increase output verbosity", action="store_true")
|
parser.add_argument("-v", help="increase output verbosity", action="store_true")
|
||||||
parser.add_argument("-r", type=str, help="git repository to analyse")
|
parser.add_argument("-r", type=str, help="git repository to analyse")
|
||||||
|
@ -42,6 +43,7 @@ vulnpatterns = patterns["en"]["medium"]["vuln"]
|
||||||
cryptopatterns = patterns["en"]["medium"]["crypto"]
|
cryptopatterns = patterns["en"]["medium"]["crypto"]
|
||||||
cpatterns = patterns["en"]["medium"]["c"]
|
cpatterns = patterns["en"]["medium"]["c"]
|
||||||
|
|
||||||
|
|
||||||
if args.p == "vulnpatterns":
|
if args.p == "vulnpatterns":
|
||||||
defaultpattern = vulnpatterns
|
defaultpattern = vulnpatterns
|
||||||
elif args.p == "cryptopatterns":
|
elif args.p == "cryptopatterns":
|
||||||
|
@ -61,13 +63,11 @@ else:
|
||||||
repo = git.Repo(args.r)
|
repo = git.Repo(args.r)
|
||||||
|
|
||||||
|
|
||||||
|
# Initialization of the variables for the results
|
||||||
found = 0
|
found = 0
|
||||||
all_potential_vulnerabilities = {}
|
all_potential_vulnerabilities = {}
|
||||||
cve_found = set()
|
cve_found = set()
|
||||||
|
|
||||||
def main():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
repo_heads = repo.heads
|
repo_heads = repo.heads
|
||||||
repo_heads_names = [h.name for h in repo_heads]
|
repo_heads_names = [h.name for h in repo_heads]
|
||||||
|
@ -109,6 +109,7 @@ for branch in repo_heads_names:
|
||||||
commit_state=args.s)
|
commit_state=args.s)
|
||||||
all_potential_vulnerabilities.update(potential_vulnerabilities)
|
all_potential_vulnerabilities.update(potential_vulnerabilities)
|
||||||
found += 1
|
found += 1
|
||||||
|
|
||||||
if not args.c:
|
if not args.c:
|
||||||
print(json.dumps(all_potential_vulnerabilities))
|
print(json.dumps(all_potential_vulnerabilities))
|
||||||
elif args.c:
|
elif args.c:
|
||||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
# This software is part of cve-search.org
|
# This software is part of cve-search.org
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 Alexandre Dulaunoy - a@foo.be
|
# Copyright (c) 2019-2020 Alexandre Dulaunoy - a@foo.be
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
Loading…
Reference in a new issue