You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Color and text constants for shell. Checks that we are not inside a dumb terminal which has no color features
74
76
if [[ ${TERM}!="dumb" ]];then
75
-
RED=$(tput setaf 1)
76
-
GREEN=$(tput setaf 2)
77
-
YELLOW=$(tput setaf 3)
77
+
RED=$(tput setaf 1)
78
+
GREEN=$(tput setaf 2)
79
+
YELLOW=$(tput setaf 3)
78
80
BLUE=$(tput setaf 4)
79
81
MAGENTA=$(tput setaf 5)
80
82
CYAN=$(tput setaf 6)
81
-
RESET_COLOR=$(tput init)
83
+
RESET_COLOR=$(tput init)
82
84
BOLD=$(tput bold)
83
85
UNDERLINE=$(tput smul)
84
86
NORMAL=$(tput sgr0)
85
87
fi
86
88
87
89
# Help Message
88
90
help="
89
-
${YELLOW}This script uses multiple static security analysis libraries to scan and find known CVEs and vulnerabilities within golang packages${RESET_COLOR}\n
91
+
${YELLOW}This script uses multiple static security analysis libraries to scan and find known CVEs and vulnerabilities within Golang packages${RESET_COLOR}\n
90
92
${BOLD}${UNDERLINE}Usage${NORMAL}:
91
93
\t$(basename $0) [options] [files...]
92
94
${BOLD}${UNDERLINE}Options${NORMAL}:
93
-
\t-s --scanner=\"arg...\" List of security scanners that will be used currently there ${SCANNERS} are avalible
95
+
\t-s --scanner=\"arg...\" List of security scanners that will be used currently there ${SCANNERS} are available
94
96
\t --[scanner]=\"flags\" Pass in additional command flags to scanner
95
97
\t-d --default Runs scans on specified default locations
96
98
\t-f --fail Prevents script from exiting after first failure
97
99
\t-r --rel=<path> Set the path all commands are run relative to
98
-
\t-i --install Installs latest scanners automatically if missing
99
-
\t-I Installs scanners depenedencies and exits
100
+
\t-i --install Installs latest scanners automatically if missing just before a scan start
101
+
\t-I Installs scanners dependencies before all scanners
100
102
\t-q --quiet Disables additional prints
101
103
\t-c --color Disables color output
102
104
\t-t --tests Enable scanning on test code
103
105
\t-o --out=<file|dir> Set location for debugging output. Defaults to console
104
106
\t-n --name=\"name\" Names of the output file/directory
105
107
\t${GREEN}-h --help Help information${RESET_COLOR}
108
+
\t-g --go=\"version\" Go version override
106
109
${BOLD}${UNDERLINE}Arguments${NORMAL}:
107
110
\t[files...] Defaults to ./... which recursively scans all subpackages of the project
108
111
"
@@ -124,6 +127,28 @@ indexOf() {
124
127
return${#NAMES[@]}
125
128
}
126
129
130
+
# Checks installation of scanners and install based on provided options:
print "${BOLD}${RED}Installation Failed!${NORMAL}${RESET_COLOR} There may be something wrong with installation link"
145
+
exit 1
146
+
else
147
+
print "${BOLD}${RED}Error!${NORMAL}${RESET_COLOR}${CYAN}$1${RESET_COLOR} executable not found. Please install or use ${YELLOW}${name} -i${RESET_COLOR} flag"
148
+
exit 1
149
+
fi
150
+
}
151
+
127
152
# Default option values
128
153
option_s=${NAMES[@]}# List of scanners that will be used this run (defaults to all of them)
print "${BOLD}${RED}Installation Failed!${NORMAL}${RESET_COLOR} There may be something wrong with installation link"
270
-
return 1
271
-
else
272
-
print "${BOLD}${RED}Error!${NORMAL}${RESET_COLOR}${CYAN}$1${RESET_COLOR} executable not found. Please install or use ${YELLOW}${name} -i${RESET_COLOR} flag"
273
-
return 1
274
-
fi
275
-
}
276
-
277
285
# Run the scans depending on options provide
278
286
runScan() {
279
287
local out=0
@@ -343,9 +351,8 @@ elif [[ $# == 0 ]]; then
343
351
print "${GREEN}No package changes found since last commit${RESET_COLOR}. Specify package paths manually or use ${YELLOW}${name} -d${RESET_COLOR} for defaults locations"
0 commit comments