Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 181 additions & 0 deletions src/main/java/de/rub/nds/crawler/data/BulkScan.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ public class BulkScan implements Serializable {
@SuppressWarnings("unused")
private BulkScan() {}

/**
* Creates a new bulk scan with the specified configuration.
*
* @param scannerClass the scanner class used for scanning
* @param crawlerClass the crawler class used for crawling
* @param name the name of the bulk scan
* @param scanConfig the scan configuration
* @param startTime the start time in milliseconds since epoch
* @param monitored whether the scan should be monitored
* @param notifyUrl the URL to notify when scan completes
*/
public BulkScan(
Class<?> scannerClass,
Class<?> crawlerClass,
Expand All @@ -76,140 +87,310 @@ public BulkScan(
this.notifyUrl = notifyUrl;
}

/**
* Gets the unique identifier of the bulk scan.
*
* @return the bulk scan ID
*/
// Getter naming important for correct serialization, do not change!
public String get_id() {
return _id;
}

/**
* Gets the name of the bulk scan.
*
* @return the scan name
*/
public String getName() {
return this.name;
}

/**
* Gets the collection name for this bulk scan.
*
* @return the collection name
*/
public String getCollectionName() {
return this.collectionName;
}

/**
* Gets the scan configuration.
*
* @return the scan configuration
*/
public ScanConfig getScanConfig() {
return this.scanConfig;
}

/**
* Checks if the bulk scan is monitored.
*
* @return true if monitored, false otherwise
*/
public boolean isMonitored() {
return this.monitored;
}

/**
* Checks if the bulk scan has finished.
*
* @return true if finished, false otherwise
*/
public boolean isFinished() {
return this.finished;
}

/**
* Gets the start time of the bulk scan.
*
* @return the start time in milliseconds since epoch
*/
public long getStartTime() {
return this.startTime;
}

/**
* Gets the end time of the bulk scan.
*
* @return the end time in milliseconds since epoch
*/
public long getEndTime() {
return this.endTime;
}

/**
* Gets the number of targets given for scanning.
*
* @return the number of targets
*/
public int getTargetsGiven() {
return this.targetsGiven;
}

/**
* Gets the number of scan jobs published.
*
* @return the number of published scan jobs
*/
public long getScanJobsPublished() {
return this.scanJobsPublished;
}

/**
* Gets the number of successful scans.
*
* @return the number of successful scans
*/
public int getSuccessfulScans() {
return this.successfulScans;
}

/**
* Gets the notification URL.
*
* @return the URL to notify when scan completes
*/
public String getNotifyUrl() {
return this.notifyUrl;
}

/**
* Gets the scanner version used for this bulk scan.
*
* @return the scanner version
*/
public String getScannerVersion() {
return this.scannerVersion;
}

/**
* Gets the crawler version used for this bulk scan.
*
* @return the crawler version
*/
public String getCrawlerVersion() {
return this.crawlerVersion;
}

/**
* Sets the unique identifier of the bulk scan.
*
* @param _id the bulk scan ID
*/
// Setter naming important for correct serialization, do not change!
public void set_id(String _id) {
this._id = _id;
}

/**
* Sets the name of the bulk scan.
*
* @param name the scan name
*/
public void setName(String name) {
this.name = name;
}

/**
* Sets the collection name for this bulk scan.
*
* @param collectionName the collection name
*/
public void setCollectionName(String collectionName) {
this.collectionName = collectionName;
}

/**
* Sets the scan configuration.
*
* @param scanConfig the scan configuration
*/
public void setScanConfig(ScanConfig scanConfig) {
this.scanConfig = scanConfig;
}

/**
* Sets whether the bulk scan is monitored.
*
* @param monitored true to enable monitoring, false otherwise
*/
public void setMonitored(boolean monitored) {
this.monitored = monitored;
}

/**
* Sets whether the bulk scan has finished.
*
* @param finished true if finished, false otherwise
*/
public void setFinished(boolean finished) {
this.finished = finished;
}

/**
* Sets the start time of the bulk scan.
*
* @param startTime the start time in milliseconds since epoch
*/
public void setStartTime(long startTime) {
this.startTime = startTime;
}

/**
* Sets the end time of the bulk scan.
*
* @param endTime the end time in milliseconds since epoch
*/
public void setEndTime(long endTime) {
this.endTime = endTime;
}

/**
* Sets the number of targets given for scanning.
*
* @param targetsGiven the number of targets
*/
public void setTargetsGiven(int targetsGiven) {
this.targetsGiven = targetsGiven;
}

/**
* Sets the number of scan jobs published.
*
* @param scanJobsPublished the number of published scan jobs
*/
public void setScanJobsPublished(long scanJobsPublished) {
this.scanJobsPublished = scanJobsPublished;
}

/**
* Sets the number of successful scans.
*
* @param successfulScans the number of successful scans
*/
public void setSuccessfulScans(int successfulScans) {
this.successfulScans = successfulScans;
}

/**
* Sets the notification URL.
*
* @param notifyUrl the URL to notify when scan completes
*/
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
}

/**
* Sets the scanner version used for this bulk scan.
*
* @param scannerVersion the scanner version
*/
public void setScannerVersion(String scannerVersion) {
this.scannerVersion = scannerVersion;
}

/**
* Sets the crawler version used for this bulk scan.
*
* @param crawlerVersion the crawler version
*/
public void setCrawlerVersion(String crawlerVersion) {
this.crawlerVersion = crawlerVersion;
}

/**
* Gets the map of job status counters.
*
* @return the job status counters map
*/
public Map<JobStatus, Integer> getJobStatusCounters() {
return jobStatusCounters;
}

/**
* Sets the map of job status counters.
*
* @param jobStatusCounters the job status counters map
*/
public void setJobStatusCounters(Map<JobStatus, Integer> jobStatusCounters) {
this.jobStatusCounters = jobStatusCounters;
}

/**
* Gets the number of scan jobs with resolution errors.
*
* @return the number of scan jobs with resolution errors
*/
public long getScanJobsResolutionErrors() {
return scanJobsResolutionErrors;
}

/**
* Sets the number of scan jobs with resolution errors.
*
* @param scanJobsResolutionErrors the number of scan jobs with resolution errors
*/
public void setScanJobsResolutionErrors(long scanJobsResolutionErrors) {
this.scanJobsResolutionErrors = scanJobsResolutionErrors;
}

/**
* Gets the number of scan jobs that were denylisted.
*
* @return the number of denylisted scan jobs
*/
public long getScanJobsDenylisted() {
return scanJobsDenylisted;
}

/**
* Sets the number of scan jobs that were denylisted.
*
* @param scanJobsDenylisted the number of denylisted scan jobs
*/
public void setScanJobsDenylisted(long scanJobsDenylisted) {
this.scanJobsDenylisted = scanJobsDenylisted;
}
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/de/rub/nds/crawler/data/BulkScanInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,51 @@ public class BulkScanInfo implements Serializable {

private final boolean isMonitored;

/**
* Creates a new BulkScanInfo from the given bulk scan.
*
* @param bulkScan the bulk scan to extract information from
*/
public BulkScanInfo(BulkScan bulkScan) {
this.bulkScanId = bulkScan.get_id();
this.scanConfig = bulkScan.getScanConfig();
this.isMonitored = bulkScan.isMonitored();
}

/**
* Gets the bulk scan ID.
*
* @return the bulk scan ID
*/
public String getBulkScanId() {
return bulkScanId;
}

/**
* Gets the scan configuration.
*
* @return the scan configuration
*/
public ScanConfig getScanConfig() {
return scanConfig;
}

/**
* Gets the scan configuration cast to the specified type.
*
* @param clazz the class to cast the scan configuration to
* @param <T> the type to cast to, must extend ScanConfig
* @return the scan configuration cast to the specified type
*/
public <T extends ScanConfig> T getScanConfig(Class<T> clazz) {
return clazz.cast(scanConfig);
}

/**
* Checks if the bulk scan is monitored.
*
* @return true if monitored, false otherwise
*/
public boolean isMonitored() {
return isMonitored;
}
Expand Down
Loading