-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcve_states
executable file
·47 lines (44 loc) · 1.06 KB
/
cve_states
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
#!/bin/bash
#
# For the given Ubuntu release codename (e.g. 'bionic'), report whether the given CVEs are still to be handled
#
# WARNING:
# This is very crude and will likely return incorrect or misleading results, don't rely on it for anything serious.
usage() {
SCRIPTNAME=$(basename $0)
echo 'Usage:'
echo "$SCRIPTNAME [<CODENAME>] <CVE ID #1> [<CVE ID #2> <..>]"
echo
echo 'Example:'
echo "$SCRIPTNAME bionic CVE-2017-5753 CVE-2018-3639 CVE-2018-3620"
}
case $1 in
-h|--help )
usage
exit 0
;;
precise|trusty|xenial|bionic|cosmic|disco ) :
RELEASE=$1
shift
;;
'' )
echo 'ERROR: Please provide a valid codename as first argument (e.g. "bionic").' >&2
usage
exit 1
;;
* )
RELEASE=bionic
;;
esac
if [[ "$1" == '' ]]
then
echo 'ERROR: Please provide a list of CVE IDs to check (e.g. "CVE-2018-1234").' >&2
usage
exit 2
fi
CVEIDS=$@
for CVEID in $CVEIDS
do
echo "# $CVEID"
curl -s https://git.launchpad.net/ubuntu-cve-tracker/plain/active/$CVEID | grep -E '^'"$RELEASE"'_.* (needs-triage|needed|pending)$'
done