-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·177 lines (172 loc) · 3.67 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/bin/bash
set -e
while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:z:" o; do
case "${o}" in
a)
export scanTarget=${OPTARG}
;;
b)
export userEmail=${OPTARG}
;;
c)
export passwordKey=${OPTARG}
;;
d)
export platformURL=${OPTARG}
;;
e)
export postComment=${OPTARG}
;;
f)
export skipComment=${OPTARG}
;;
g)
export regexFile=${OPTARG}
;;
h)
export configFile=${OPTARG}
;;
i)
export reportFile=${OPTARG}
;;
j)
export secretManager=${OPTARG}
;;
k)
export contactHelp=${OPTARG}
;;
l)
export label=${OPTARG}
;;
m)
export showMatchedSecretOnLogs=${OPTARG}
;;
n)
export debug=${OPTARG}
;;
o)
export reportFormat=${OPTARG}
;;
p)
export timeout=${OPTARG}
;;
q)
export limit=${OPTARG}
;;
r)
export insecure=${OPTARG}
;;
s)
export map=${OPTARG}
;;
t)
export mapFile=${OPTARG}
;;
u)
export scope=${OPTARG}
;;
v)
export owner=${OPTARG}
;;
w)
export repo=${OPTARG}
;;
esac
done
export scanTarget="${scanTarget}"
export userEmail="${userEmail}"
export passwordKey=$(echo "${passwordKey}" | tr -d " ")
export platformURL="${platformURL}"
export postComment="${postComment}"
export skipComment="${skipComment}"
export regexFile="${regexFile}"
export configFile="${configFile}"
export reportFile="${reportFile}"
export secretManager="${secretManager}"
export contactHelp="${contactHelp}"
export label="${label}"
export showMatchedSecretOnLogs="${showMatchedSecretOnLogs}"
export debug="${debug}"
export reportFormat="${reportFormat}"
export timeout="${timeout}"
export limit="${limit}"
export insecure="${insecure}"
export map="${map}"
export mapFile="${mapFile}"
export scope="${scope}"
export owner="${owner}"
export repo="${repo}"
ARGS=""
if [ $userEmail ];then
ARGS="$ARGS --email $userEmail"
fi
if [ $passwordKey ];then
ARGS="$ARGS --api-key $passwordKey"
else
export passwordKey="Warning! Password key will be loaded from environment variables."
fi
if [ $platformURL ];then
ARGS="$ARGS --server $platformURL"
fi
if [ $postComment ];then
ARGS="$ARGS --post-comment"
fi
if [ $skipComment ];then
ARGS="$ARGS --skip-comment"
fi
if [ $regexFile ];then
ARGS="$ARGS --regex-file $regexFile"
fi
if [ $configFile ];then
ARGS="$ARGS --config-file $configFile"
fi
if [ $reportFile ];then
ARGS="$ARGS --report-file $reportFile"
else
export reportFile="n0s1_report.json"
fi
if [ $secretManager ];then
ARGS="$ARGS --secret-manager $secretManager"
fi
if [ $contactHelp ];then
ARGS="$ARGS --contact-help $contactHelp"
fi
if [ $label ];then
ARGS="$ARGS --label $label"
fi
if [ $showMatchedSecretOnLogs ];then
ARGS="$ARGS --show-matched-secret-on-logs"
fi
if [ $debug ];then
ARGS="$ARGS --debug"
fi
if [ $reportFormat ];then
ARGS="$ARGS --report-format $reportFormat"
fi
if [ $timeout ];then
ARGS="$ARGS --timeout $timeout"
fi
if [ $limit ];then
ARGS="$ARGS --limit $limit"
fi
if [ $insecure ];then
ARGS="$ARGS --insecure"
fi
if [ $map ];then
ARGS="$ARGS --map $map"
fi
if [ $mapFile ];then
ARGS="$ARGS --map-file $mapFile"
fi
if [ $scope ];then
ARGS="$ARGS --scope $scope"
fi
if [ $owner ];then
ARGS="$ARGS --owner $owner"
fi
if [ $repo ];then
ARGS="$ARGS --repo $repo"
fi
echo "Running n0s1 with options: n0s1 ${scanTarget} ${ARGS}" | sed "s/$passwordKey/<REDACTED>/g"
n0s1 ${scanTarget} ${ARGS}
returnCode=$?