com.metaeffekt.mirror.download.other.CisaKevDownload Maven / Gradle / Ivy
The newest version!
package com.metaeffekt.mirror.download.other;
import com.metaeffekt.mirror.download.documentation.MirrorMetadata;
import com.metaeffekt.mirror.download.Download;
import com.metaeffekt.mirror.download.ResourceLocation;
import java.io.File;
import java.net.URL;
/**
* References:
*
* - CISA KEV Homepage: https://www.cisa.gov/known-exploited-vulnerabilities
*
* CISA maintains the authoritative source of vulnerabilities that have been exploited in the wild.
* This data is available in a single JSON file that can be downloaded from the CISA website.
*/
@MirrorMetadata(directoryName = "kev", mavenPropertyName = "cisaKevDownload")
public class CisaKevDownload extends Download {
public CisaKevDownload(File baseMirrorDirectory) {
super(baseMirrorDirectory, CisaKevDownload.class);
}
@Override
protected void performDownload() {
final URL kevURL = getRemoteResourceLocationUrl(ResourceLocationKEV.CISA_KEV);
final File kevFile = new File(super.downloadIntoDirectory, "cisa-kev.json");
super.downloader.fetchResponseBodyFromUrlToFile(kevURL, kevFile);
}
@Override
public void setRemoteResourceLocation(String location, String url) {
super.setRemoteResourceLocation(ResourceLocationKEV.valueOf(location), url);
}
@Override
protected boolean additionalIsDownloadRequired() {
return false;
}
/**
* The ResourceLocationKEV enum defines the URLs for accessing different KEV APIs.
*/
public enum ResourceLocationKEV implements ResourceLocation {
/**
* URL for the KEV API that is used to fetch all known KEVs known to CISA.
*/
CISA_KEV("https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json");
private final String defaultValue;
ResourceLocationKEV(String defaultValue) {
this.defaultValue = defaultValue;
}
@Override
public String getDefault() {
return this.defaultValue;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy