1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.owasp.dependencycheck.dependency;
19
20 import us.springett.parsers.cpe.Cpe;
21 import us.springett.parsers.cpe.CpeBuilder;
22 import us.springett.parsers.cpe.exceptions.CpeParsingException;
23 import us.springett.parsers.cpe.exceptions.CpeValidationException;
24 import us.springett.parsers.cpe.values.LogicalValue;
25 import us.springett.parsers.cpe.values.Part;
26
27
28
29
30
31
32 public class VulnerableSoftwareBuilder extends CpeBuilder {
33
34
35
36
37
38 private String versionEndExcluding = null;
39
40
41
42
43 private String versionEndIncluding = null;
44
45
46
47
48 private String versionStartExcluding = null;
49
50
51
52
53 private String versionStartIncluding = null;
54
55
56
57 private boolean vulnerable = true;
58
59
60
61
62
63
64
65
66 @Override
67 public VulnerableSoftware build() throws CpeValidationException {
68 final VulnerableSoftware vs = new VulnerableSoftware(getPart(), getVendor(), getProduct(),
69 getVersion(), getUpdate(), getEdition(),
70 getLanguage(), getSwEdition(), getTargetSw(), getTargetHw(), getOther(),
71 versionEndExcluding, versionEndIncluding, versionStartExcluding,
72 versionStartIncluding, vulnerable);
73 reset();
74 return vs;
75 }
76
77
78
79
80 @Override
81 protected void reset() {
82 super.reset();
83 versionEndExcluding = null;
84 versionEndIncluding = null;
85 versionStartExcluding = null;
86 versionStartIncluding = null;
87 vulnerable = true;
88 }
89
90
91
92
93
94
95
96 public VulnerableSoftwareBuilder cpe(Cpe cpe) {
97 this.part(cpe.getPart()).wfVendor(cpe.getWellFormedVendor()).wfProduct(cpe.getWellFormedProduct())
98 .wfVersion(cpe.getWellFormedVersion()).wfUpdate(cpe.getWellFormedUpdate())
99 .wfEdition(cpe.getWellFormedEdition()).wfLanguage(cpe.getWellFormedLanguage())
100 .wfSwEdition(cpe.getWellFormedSwEdition()).wfTargetSw(cpe.getWellFormedTargetSw())
101 .wfTargetHw(cpe.getWellFormedTargetHw()).wfOther(cpe.getWellFormedOther());
102 return this;
103 }
104
105
106
107
108
109
110
111
112 public VulnerableSoftwareBuilder versionEndExcluding(String versionEndExcluding) {
113 this.versionEndExcluding = versionEndExcluding;
114 return this;
115 }
116
117
118
119
120
121
122
123
124 public VulnerableSoftwareBuilder versionEndIncluding(String versionEndIncluding) {
125 this.versionEndIncluding = versionEndIncluding;
126 return this;
127 }
128
129
130
131
132
133
134
135
136 public VulnerableSoftwareBuilder versionStartExcluding(String versionStartExcluding) {
137 this.versionStartExcluding = versionStartExcluding;
138 return this;
139 }
140
141
142
143
144
145
146
147
148 public VulnerableSoftwareBuilder versionStartIncluding(String versionStartIncluding) {
149 this.versionStartIncluding = versionStartIncluding;
150 return this;
151 }
152
153
154
155
156
157
158
159
160 public VulnerableSoftwareBuilder vulnerable(boolean vulnerable) {
161 this.vulnerable = vulnerable;
162 return this;
163 }
164
165
166 @Override
167 public VulnerableSoftwareBuilder wfOther(String other) {
168 return (VulnerableSoftwareBuilder) super.wfOther(other);
169 }
170
171 @Override
172 public VulnerableSoftwareBuilder wfTargetHw(String targetHw) {
173 return (VulnerableSoftwareBuilder) super.wfTargetHw(targetHw);
174 }
175
176 @Override
177 public VulnerableSoftwareBuilder wfTargetSw(String targetSw) {
178 return (VulnerableSoftwareBuilder) super.wfTargetSw(targetSw);
179 }
180
181 @Override
182 public VulnerableSoftwareBuilder wfSwEdition(String swEdition) {
183 return (VulnerableSoftwareBuilder) super.wfSwEdition(swEdition);
184 }
185
186 @Override
187 public VulnerableSoftwareBuilder wfLanguage(String language) {
188 return (VulnerableSoftwareBuilder) super.wfLanguage(language);
189 }
190
191 @Override
192 public VulnerableSoftwareBuilder wfEdition(String edition) {
193 return (VulnerableSoftwareBuilder) super.wfEdition(edition);
194 }
195
196 @Override
197 public VulnerableSoftwareBuilder wfUpdate(String update) {
198 return (VulnerableSoftwareBuilder) super.wfUpdate(update);
199 }
200
201 @Override
202 public VulnerableSoftwareBuilder wfVersion(String version) {
203 return (VulnerableSoftwareBuilder) super.wfVersion(version);
204 }
205
206 @Override
207 public VulnerableSoftwareBuilder wfProduct(String product) {
208 return (VulnerableSoftwareBuilder) super.wfProduct(product);
209 }
210
211 @Override
212 public VulnerableSoftwareBuilder wfVendor(String vendor) {
213 return (VulnerableSoftwareBuilder) super.wfVendor(vendor);
214 }
215
216 @Override
217 public VulnerableSoftwareBuilder other(LogicalValue other) {
218 return (VulnerableSoftwareBuilder) super.other(other);
219 }
220
221 @Override
222 public VulnerableSoftwareBuilder targetHw(LogicalValue targetHw) {
223 return (VulnerableSoftwareBuilder) super.targetHw(targetHw);
224 }
225
226 @Override
227 public VulnerableSoftwareBuilder targetSw(LogicalValue targetSw) {
228 return (VulnerableSoftwareBuilder) super.targetSw(targetSw);
229 }
230
231 @Override
232 public VulnerableSoftwareBuilder swEdition(LogicalValue swEdition) {
233 return (VulnerableSoftwareBuilder) super.swEdition(swEdition);
234 }
235
236 @Override
237 public VulnerableSoftwareBuilder language(LogicalValue language) {
238 return (VulnerableSoftwareBuilder) super.language(language);
239 }
240
241 @Override
242 public VulnerableSoftwareBuilder update(LogicalValue update) {
243 return (VulnerableSoftwareBuilder) super.update(update);
244 }
245
246 @Override
247 public VulnerableSoftwareBuilder version(LogicalValue version) {
248 return (VulnerableSoftwareBuilder) super.version(version);
249 }
250
251 @Override
252 public VulnerableSoftwareBuilder product(LogicalValue product) {
253 return (VulnerableSoftwareBuilder) super.product(product);
254 }
255
256 @Override
257 public VulnerableSoftwareBuilder vendor(LogicalValue vendor) {
258 return (VulnerableSoftwareBuilder) super.vendor(vendor);
259 }
260
261 @Override
262 public VulnerableSoftwareBuilder other(String other) {
263 return (VulnerableSoftwareBuilder) super.other(other);
264 }
265
266 @Override
267 public VulnerableSoftwareBuilder targetHw(String targetHw) {
268 return (VulnerableSoftwareBuilder) super.targetHw(targetHw);
269 }
270
271 @Override
272 public VulnerableSoftwareBuilder targetSw(String targetSw) {
273 return (VulnerableSoftwareBuilder) super.targetSw(targetSw);
274 }
275
276 @Override
277 public VulnerableSoftwareBuilder swEdition(String swEdition) {
278 return (VulnerableSoftwareBuilder) super.swEdition(swEdition);
279 }
280
281 @Override
282 public VulnerableSoftwareBuilder language(String language) {
283 return (VulnerableSoftwareBuilder) super.language(language);
284 }
285
286 @Override
287 public VulnerableSoftwareBuilder update(String update) {
288 return (VulnerableSoftwareBuilder) super.update(update);
289 }
290
291 @Override
292 public VulnerableSoftwareBuilder version(String version) {
293 return (VulnerableSoftwareBuilder) super.version(version);
294 }
295
296 @Override
297 public VulnerableSoftwareBuilder product(String product) {
298 return (VulnerableSoftwareBuilder) super.product(product);
299 }
300
301 @Override
302 public VulnerableSoftwareBuilder vendor(String vendor) {
303 return (VulnerableSoftwareBuilder) super.vendor(vendor);
304 }
305
306 @Override
307 public VulnerableSoftwareBuilder part(String part) throws CpeParsingException {
308 return (VulnerableSoftwareBuilder) super.part(part);
309 }
310
311 @Override
312 public VulnerableSoftwareBuilder part(Part part) {
313 return (VulnerableSoftwareBuilder) super.part(part);
314 }
315
316 @Override
317 public VulnerableSoftwareBuilder edition(LogicalValue edition) {
318 return (VulnerableSoftwareBuilder) super.edition(edition);
319 }
320
321 @Override
322 public VulnerableSoftwareBuilder edition(String edition) {
323 return (VulnerableSoftwareBuilder) super.edition(edition);
324 }
325
326
327 }