line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NIST::NVD::Update; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5038
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
67
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
8
|
use NIST::NVD::Query; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
9
|
1
|
|
|
1
|
|
6
|
use base qw{NIST::NVD::Query}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
533
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
NIST::NVD::Update - Query and Update the NVD database |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 VERSION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Version 1.00.00 |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '1.00.00'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use NIST::NVD::Update; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# use convert_nvdcve to generate these files from the XML dumps: |
29
|
|
|
|
|
|
|
# http://nvd.nist.gov/download.cfm |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $u = NIST::NVD::Update->new( |
32
|
|
|
|
|
|
|
store => $some_store, |
33
|
|
|
|
|
|
|
%args |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 new |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# See NIST::NVD::Storage::DB_File or NIST::NVD::Storage::SQLite3 for |
41
|
|
|
|
|
|
|
# an example store implementation |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $NVD_Updater = |
44
|
|
|
|
|
|
|
NIST::NVD::Update->new( store => $store_type, %args ); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 put_cve_idx_cpe |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $result = put_cve_idx_cpe ( $cpe_urn, $cve_list ) |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub put_cve_idx_cpe { |
56
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
57
|
|
|
|
|
|
|
# TODO: Validate |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $result = $self->{store}->put_cve_idx_cpe(@_); |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return $result; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 update_websec_idx_cpe |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $result = update_websec_idx_cpe (); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub update_websec_idx_cpe { |
71
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
72
|
|
|
|
|
|
|
# TODO: Validate |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $result = $self->{store}->update_websec_idx_cpe(@_); |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return $result; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 put_cwe_idx_cpe |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $result = put_cwe_idx_cpe ( $cpe_urn, $cwe_id ) |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub put_cwe_idx_cpe { |
86
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my $result = $self->{store}->put_cwe_idx_cpe(@_); |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
return $result |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 put_cwe_idx_cve |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
my $result = put_cwe_idx_cve ( { NVD_ID0 => $data_about_NVD_ID[0], |
96
|
|
|
|
|
|
|
NVD_ID1 => $data_about_NVD_ID[1], |
97
|
|
|
|
|
|
|
# ... |
98
|
|
|
|
|
|
|
"NVD_ID$N" => $data_about_NVD_ID[$N], |
99
|
|
|
|
|
|
|
} ) |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub put_cwe_idx_cve { |
105
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
my $result = $self->{store}->put_cwe_idx_cve(@_); |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return $result |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 put_cpe |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
my $result = put_cpe ( $cpe_urn ) |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub put_cpe { |
120
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
121
|
|
|
|
|
|
|
# TODO: Validate |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
my $result = $self->{store}->put_cpe(@_); |
124
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
return $result; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 put_nvd_entries |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
my $N = lots(); |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
my $result = put_nvd_entries ( { NVD_ID0 => $data_about_NVD_ID[0], |
134
|
|
|
|
|
|
|
NVD_ID1 => $data_about_NVD_ID[1], |
135
|
|
|
|
|
|
|
# ... |
136
|
|
|
|
|
|
|
"NVD_ID$N" => $data_about_NVD_ID[$N], |
137
|
|
|
|
|
|
|
} ) |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub put_nvd_entries { |
142
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
143
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
my $result = $self->{store}->put_nvd_entries(@_); |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
return $result; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 put_cwe |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
$result = $self->put_cwe( cwe_id => 'CWE-42', |
152
|
|
|
|
|
|
|
cwe_dump => $cwe_dump ); |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub put_cwe { |
157
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
158
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
my $result = $self->{store}->put_cwe(@_); |
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
return $result; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 commit |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
$result = $self->commit($commit_buffer_name); |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=cut |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub commit { |
171
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
my $result = $self->{store}->commit(@_); |
174
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
return $result; |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 put_cwe_data |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
my $N = lots(); |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
my $result = put_cwe_data ( { CWE_ID0 => $data_about_CWE_ID[0], |
184
|
|
|
|
|
|
|
CWE_ID1 => $data_about_CWE_ID[1], |
185
|
|
|
|
|
|
|
# ... |
186
|
|
|
|
|
|
|
"CWE_ID$N" => $data_about_CWE_ID[$N], |
187
|
|
|
|
|
|
|
} ) |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub put_cwe_data { |
192
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
193
|
|
|
|
|
|
|
|
194
|
0
|
|
|
|
|
|
my $result = $self->{store}->put_cwe_data(@_); |
195
|
|
|
|
|
|
|
|
196
|
0
|
|
|
|
|
|
return $result; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head1 AUTHOR |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
C.J. Adams-Collier, C<< <cjac at f5.com> >> |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Copyright 2011, 2012 F5 Networks, Inc. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
CVE(r) and CWE(tm) are marks of The MITRE Corporation and used here with |
209
|
|
|
|
|
|
|
permission. The information in CVE and CWE are copyright of The MITRE |
210
|
|
|
|
|
|
|
Corporation and also used here with permission. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Please include links for CVE(r) <http://cve.mitre.org/> and CWE(tm) |
213
|
|
|
|
|
|
|
<http://cwe.mitre.org/> in all reproductions of these materials. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
216
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
217
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=cut |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
1; # End of NIST::NVD::Update |