-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathepsseeker.sh
executable file
·66 lines (59 loc) · 1.2 KB
/
epsseeker.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
#!/bin/bash
usage() {
echo "Usage: $0 [-c cve] [-d date] [-D days] [-g epss-gt] [-G percentile-gt] [-l epss-lt] [-L percentile-lt]" 1>&2
exit 1
}
while getopts "c:d:D:g:G:l:L:" opt; do
case ${opt} in
c )
cve=$OPTARG
;;
d )
date=$OPTARG
;;
D )
days=$OPTARG
;;
g )
epss_gt=$OPTARG
;;
G )
percentile_gt=$OPTARG
;;
l )
epss_lt=$OPTARG
;;
L )
percentile_lt=$OPTARG
;;
* )
usage
;;
esac
done
if [ -z "${cve}" ]; then
echo "Error: The -c option is required" >&2
usage
fi
api_url="https://api.first.org/data/v1/epss"
curl_cmd="curl -sS -X GET '${api_url}?cve=${cve}"
if [ -n "${date}" ]; then
curl_cmd="${curl_cmd}&date=${date}"
fi
if [ -n "${days}" ]; then
curl_cmd="${curl_cmd}&days=${days}"
fi
if [ -n "${epss_gt}" ]; then
curl_cmd="${curl_cmd}&epss-gt=${epss_gt}"
fi
if [ -n "${percentile_gt}" ]; then
curl_cmd="${curl_cmd}&percentile-gt=${percentile_gt}"
fi
if [ -n "${epss_lt}" ]; then
curl_cmd="${curl_cmd}&epss-lt=${epss_lt}"
fi
if [ -n "${percentile_lt}" ]; then
curl_cmd="${curl_cmd}&percentile-lt=${percentile_lt}"
fi
curl_cmd="${curl_cmd}&pretty=true'"
eval $curl_cmd