diff --git a/scripts/common-functions b/scripts/common-functions index d606d68..fb45223 100644 --- a/scripts/common-functions +++ b/scripts/common-functions @@ -58,6 +58,28 @@ cve2cvss() echo ${cvss##*:} } +cve2sha() +{ + local arg=$1 + sha="$(cd $VULNS_GIT_PATH; scripts/cve_search $arg 2>/dev/null | cut -d" " -f7)" + + if [ $(echo $sha | wc -c) -eq 41 ] + then + echo $sha + fi +} + +sha2cve() +{ + local arg=$1 + cve_sha="$(cd $VULNS_GIT_PATH; scripts/cve_search $arg 2>/dev/null | cut -d" " -f1,7)" + + if [ $(echo ${cve_sha##* } | wc -c) -eq 41 ] + then + echo ${cve_sha%% *} + fi +} + current_branch() { git branch --show-current