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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public class DenylistFileProvider implements IDenylistProvider {
private final List<SubnetUtils.SubnetInfo> cidrDenylist = new ArrayList<>();
private final Set<String> domainDenylistSet = new HashSet<>();

/**
* Creates a new denylist provider from a file containing denylist entries.
*
* @param denylistFilename the path to the denylist file
*/
public DenylistFileProvider(String denylistFilename) {
List<String> denylist = List.of();
try (Stream<String> lines = Files.lines(Paths.get(denylistFilename))) {
Expand Down Expand Up @@ -67,6 +72,12 @@ private boolean isInSubnet(String ip, SubnetUtils.SubnetInfo subnetInfo) {
}
}

/**
* Checks if a given scan target is on the denylist.
*
* @param target the scan target to check
* @return true if the target is denylisted, false otherwise
*/
@Override
public synchronized boolean isDenylisted(ScanTarget target) {
return domainDenylistSet.contains(target.getHostname())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,11 @@

public interface IDenylistProvider {

/**
* Checks if a given scan target is on the denylist.
*
* @param target the scan target to check
* @return true if the target is denylisted, false otherwise
*/
boolean isDenylisted(ScanTarget target);
}