Исправлены фильтры для пустого списка сервисов
This commit is contained in:
@@ -41,13 +41,19 @@ public class PcapService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateFilter(Collection<CtfService> services) {
|
public void updateFilter(Collection<CtfService> services) {
|
||||||
final String ports = services.stream()
|
String filter;
|
||||||
.map(CtfService::getPort)
|
|
||||||
.map(p -> "port " + p)
|
|
||||||
.collect(Collectors.joining(" or "));
|
|
||||||
|
|
||||||
final String format = "(tcp or udp) and (%s)";
|
if (services.isEmpty()) {
|
||||||
String filter = String.format(format, ports);
|
filter = "tcp or udp";
|
||||||
|
} else {
|
||||||
|
final String ports = services.stream()
|
||||||
|
.map(CtfService::getPort)
|
||||||
|
.map(p -> "port " + p)
|
||||||
|
.collect(Collectors.joining(" or "));
|
||||||
|
|
||||||
|
final String format = "(tcp or udp) and (%s)";
|
||||||
|
filter = String.format(format, ports);
|
||||||
|
}
|
||||||
|
|
||||||
log.debug("New filter: " + filter);
|
log.debug("New filter: " + filter);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user