This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen-cve-stats.sh
135 lines (121 loc) · 7.69 KB
/
gen-cve-stats.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
#!/bin/bash
#
# http://cve.mitre.org/data/downloads/allitems.csv.gz
CAT=/bin/cat
GREP=/bin/grep
WC=/usr/bin/wc
WGET=/usr/bin/wget
CLEAR=/usr/bin/clear
ECHO=/bin/echo
GZIP=/bin/gzip
CVEFILE=/tmp/cve_stats/allitems.csv
OUTFILE=/tmp/cve_stats/report-working.txt
FINALFILE=/tmp/cve_stats/report.txt
DATE=/bin/date
MAIL=/bin/mail
/bin/rm /tmp/cve_stats/allitems*
/bin/rm /tmp/cve_stats/report-working.txt /tmp/cve_stats/report.txt
/bin/touch /tmp/cve_stats/report-working.txt /tmp/cve_stats/report.txt
/bin/chmod 600 /tmp/cve_stats/report-working.txt /tmp/cve_stats/report.txt
$WGET -q -O /tmp/cve_stats/allitems.csv.gz http://cve.mitre.org/data/downloads/allitems.csv.gz
$GZIP -d /tmp/cve_stats/allitems.csv.gz
if [ -f $CVEFILE ]
then
echo " "
else
echo "CVE master file not found."
exit -1
fi
CVEDATE=`/bin/date +"%Y-%m-%d"`
$CLEAR
$ECHO " " >> $OUTFILE
$ECHO "Stats as of $CVEDATE" >> $OUTFILE
$ECHO " " >> $OUTFILE
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-1999 > /tmp/cve_stats/cve-1999-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2000 > /tmp/cve_stats/cve-2000-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2001 > /tmp/cve_stats/cve-2001-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2002 > /tmp/cve_stats/cve-2002-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2003 > /tmp/cve_stats/cve-2003-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2004 > /tmp/cve_stats/cve-2004-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2005 > /tmp/cve_stats/cve-2005-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2006 > /tmp/cve_stats/cve-2006-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2007 > /tmp/cve_stats/cve-2007-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2008 > /tmp/cve_stats/cve-2008-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2009 > /tmp/cve_stats/cve-2009-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2010 > /tmp/cve_stats/cve-2010-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2011 > /tmp/cve_stats/cve-2011-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2012 > /tmp/cve_stats/cve-2012-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2013 > /tmp/cve_stats/cve-2013-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2014 > /tmp/cve_stats/cve-2014-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2015 > /tmp/cve_stats/cve-2015-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2016 > /tmp/cve_stats/cve-2016-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2017 > /tmp/cve_stats/cve-2017-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2018 > /tmp/cve_stats/cve-2018-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2019 > /tmp/cve_stats/cve-2019-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2020 > /tmp/cve_stats/cve-2020-identifiers
$CAT $CVEFILE | cut -f1 -d\, | $GREP CVE-2021 > /tmp/cve_stats/cve-2021-identifiers
$WC -l /tmp/cve_stats/cve-????-identifiers >> $OUTFILE
$ECHO " " >> $OUTFILE
$CAT $CVEFILE | $GREP CVE-1999 | $GREP RESERVED > /tmp/cve_stats/cve-1999-reserved
$CAT $CVEFILE | $GREP CVE-2000 | $GREP RESERVED > /tmp/cve_stats/cve-2000-reserved
$CAT $CVEFILE | $GREP CVE-2001 | $GREP RESERVED > /tmp/cve_stats/cve-2001-reserved
$CAT $CVEFILE | $GREP CVE-2002 | $GREP RESERVED > /tmp/cve_stats/cve-2002-reserved
$CAT $CVEFILE | $GREP CVE-2003 | $GREP RESERVED > /tmp/cve_stats/cve-2003-reserved
$CAT $CVEFILE | $GREP CVE-2004 | $GREP RESERVED > /tmp/cve_stats/cve-2004-reserved
$CAT $CVEFILE | $GREP CVE-2005 | $GREP RESERVED > /tmp/cve_stats/cve-2005-reserved
$CAT $CVEFILE | $GREP CVE-2006 | $GREP RESERVED > /tmp/cve_stats/cve-2006-reserved
$CAT $CVEFILE | $GREP CVE-2007 | $GREP RESERVED > /tmp/cve_stats/cve-2007-reserved
$CAT $CVEFILE | $GREP CVE-2008 | $GREP RESERVED > /tmp/cve_stats/cve-2008-reserved
$CAT $CVEFILE | $GREP CVE-2009 | $GREP RESERVED > /tmp/cve_stats/cve-2009-reserved
$CAT $CVEFILE | $GREP CVE-2010 | $GREP RESERVED > /tmp/cve_stats/cve-2010-reserved
$CAT $CVEFILE | $GREP CVE-2011 | $GREP RESERVED > /tmp/cve_stats/cve-2011-reserved
$CAT $CVEFILE | $GREP CVE-2012 | $GREP RESERVED > /tmp/cve_stats/cve-2012-reserved
$CAT $CVEFILE | $GREP CVE-2013 | $GREP RESERVED > /tmp/cve_stats/cve-2013-reserved
$CAT $CVEFILE | $GREP CVE-2014 | $GREP RESERVED > /tmp/cve_stats/cve-2014-reserved
$CAT $CVEFILE | $GREP CVE-2015 | $GREP RESERVED > /tmp/cve_stats/cve-2015-reserved
$CAT $CVEFILE | $GREP CVE-2016 | $GREP RESERVED > /tmp/cve_stats/cve-2016-reserved
$CAT $CVEFILE | $GREP CVE-2017 | $GREP RESERVED > /tmp/cve_stats/cve-2017-reserved
$CAT $CVEFILE | $GREP CVE-2018 | $GREP RESERVED > /tmp/cve_stats/cve-2018-reserved
$CAT $CVEFILE | $GREP CVE-2019 | $GREP RESERVED > /tmp/cve_stats/cve-2019-reserved
$CAT $CVEFILE | $GREP CVE-2020 | $GREP RESERVED > /tmp/cve_stats/cve-2020-reserved
$CAT $CVEFILE | $GREP CVE-2021 | $GREP RESERVED > /tmp/cve_stats/cve-2021-reserved
$WC -l /tmp/cve_stats/cve-????-reserved >> $OUTFILE
$ECHO " " >> $OUTFILE
$CAT $CVEFILE | $GREP CVE-1999 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-1999-reject
$CAT $CVEFILE | $GREP CVE-2000 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2000-reject
$CAT $CVEFILE | $GREP CVE-2001 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2001-reject
$CAT $CVEFILE | $GREP CVE-2002 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2002-reject
$CAT $CVEFILE | $GREP CVE-2003 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2003-reject
$CAT $CVEFILE | $GREP CVE-2004 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2004-reject
$CAT $CVEFILE | $GREP CVE-2005 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2005-reject
$CAT $CVEFILE | $GREP CVE-2006 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2006-reject
$CAT $CVEFILE | $GREP CVE-2007 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2007-reject
$CAT $CVEFILE | $GREP CVE-2008 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2008-reject
$CAT $CVEFILE | $GREP CVE-2009 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2009-reject
$CAT $CVEFILE | $GREP CVE-2010 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2010-reject
$CAT $CVEFILE | $GREP CVE-2011 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2011-reject
$CAT $CVEFILE | $GREP CVE-2012 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2012-reject
$CAT $CVEFILE | $GREP CVE-2013 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2013-reject
$CAT $CVEFILE | $GREP CVE-2014 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2014-reject
$CAT $CVEFILE | $GREP CVE-2015 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2015-reject
$CAT $CVEFILE | $GREP CVE-2016 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2016-reject
$CAT $CVEFILE | $GREP CVE-2017 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2017-reject
$CAT $CVEFILE | $GREP CVE-2018 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2018-reject
$CAT $CVEFILE | $GREP CVE-2019 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2019-reject
$CAT $CVEFILE | $GREP CVE-2020 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2020-reject
$CAT $CVEFILE | $GREP CVE-2021 | $GREP REJECT | $GREP "DO NOT USE" > /tmp/cve_stats/cve-2021-reject
$WC -l /tmp/cve_stats/cve-????-reject >> $OUTFILE
$ECHO " " >> $OUTFILE
$ECHO "Summary Stats" >> $FINALFILE
$ECHO "-------------" >> $FINALFILE
$ECHO " " >> $FINALFILE
$ECHO "Identifiers:" >> $FINALFILE
$WC -l /tmp/cve_stats/cve-????-identifiers | grep total >> $FINALFILE
$ECHO "Reserved:" >> $FINALFILE
$WC -l /tmp/cve_stats/cve-????-reserved | grep total >> $FINALFILE
$ECHO "Rejected:" >> $FINALFILE
$WC -l /tmp/cve_stats/cve-????-reject | grep total >> $FINALFILE
$ECHO " " >> $FINALFILE
$ECHO "-------------" >> $FINALFILE
/bin/cat $OUTFILE >> $FINALFILE
# $MAIL -s "CVE Dump Stats as of $CVEDATE" [YOUR ADDRESS HERE] < $FINALFILE