| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
package org.owasp.dependencycheck.data.update; |
| 19 | |
|
| 20 | |
import java.net.MalformedURLException; |
| 21 | |
import java.util.logging.Level; |
| 22 | |
import java.util.logging.Logger; |
| 23 | |
import org.owasp.dependencycheck.data.update.exception.UpdateException; |
| 24 | |
import org.owasp.dependencycheck.utils.DownloadFailedException; |
| 25 | |
import org.owasp.dependencycheck.utils.Settings; |
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | 0 | public class NvdCveUpdater implements CachedWebDataSource { |
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | 0 | private static final Logger LOGGER = Logger.getLogger(NvdCveUpdater.class.getName()); |
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
@Override |
| 46 | |
public void update() throws UpdateException { |
| 47 | |
try { |
| 48 | 0 | final StandardUpdate task = new StandardUpdate(); |
| 49 | 0 | if (task.isUpdateNeeded()) { |
| 50 | 0 | task.update(); |
| 51 | |
} |
| 52 | 0 | } catch (MalformedURLException ex) { |
| 53 | 0 | LOGGER.log(Level.WARNING, |
| 54 | |
"NVD CVE properties files contain an invalid URL, unable to update the data to use the most current data."); |
| 55 | 0 | LOGGER.log(Level.FINE, null, ex); |
| 56 | 0 | } catch (DownloadFailedException ex) { |
| 57 | 0 | LOGGER.log(Level.WARNING, |
| 58 | |
"Unable to download the NVD CVE data; the results may not include the most recent CPE/CVEs from the NVD."); |
| 59 | 0 | if (Settings.getString(Settings.KEYS.PROXY_SERVER) == null) { |
| 60 | 0 | LOGGER.log(Level.INFO, |
| 61 | |
"If you are behind a proxy you may need to configure dependency-check to use the proxy."); |
| 62 | |
} |
| 63 | 0 | LOGGER.log(Level.FINE, null, ex); |
| 64 | 0 | } |
| 65 | 0 | } |
| 66 | |
} |