Работа над фильтрацией через libpcap
This commit is contained in:
@@ -37,7 +37,7 @@ public abstract class AbstractPcapWorker implements PcapWorker, PacketListener {
|
||||
protected PcapHandle pcap = null;
|
||||
protected final ExecutorService loopExecutorService;
|
||||
|
||||
protected String filter = null;
|
||||
protected String filter = "tcp or udp";
|
||||
|
||||
// во время работы должен быть != null
|
||||
protected ExecutorService processorExecutorService;
|
||||
|
||||
@@ -3,6 +3,7 @@ package ru.serega6531.packmate.service;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.serega6531.packmate.model.CtfService;
|
||||
import ru.serega6531.packmate.model.enums.SubscriptionMessageType;
|
||||
@@ -32,7 +33,7 @@ public class ServicesService {
|
||||
@Autowired
|
||||
public ServicesService(ServiceRepository repository,
|
||||
SubscriptionService subscriptionService,
|
||||
PcapService pcapService,
|
||||
@Lazy PcapService pcapService,
|
||||
@Value("${local-ip}") String localIpString) throws UnknownHostException {
|
||||
this.repository = repository;
|
||||
this.subscriptionService = subscriptionService;
|
||||
@@ -63,9 +64,13 @@ public class ServicesService {
|
||||
|
||||
public void deleteByPort(int port) {
|
||||
log.info("Removed service at port {}", port);
|
||||
|
||||
services.remove(port);
|
||||
repository.deleteById(port);
|
||||
|
||||
subscriptionService.broadcast(new SubscriptionMessage(SubscriptionMessageType.DELETE_SERVICE, port));
|
||||
|
||||
pcapService.updateFilter(findAll());
|
||||
}
|
||||
|
||||
public CtfService save(CtfService service) {
|
||||
@@ -73,6 +78,7 @@ public class ServicesService {
|
||||
|
||||
final CtfService saved = repository.save(service);
|
||||
services.put(saved.getPort(), saved);
|
||||
|
||||
subscriptionService.broadcast(new SubscriptionMessage(SubscriptionMessageType.SAVE_SERVICE, saved));
|
||||
|
||||
pcapService.updateFilter(findAll());
|
||||
|
||||
Reference in New Issue
Block a user