Update docs
This commit is contained in:
@@ -16,6 +16,7 @@ import ru.serega6531.packmate.service.SubscriptionService;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Slf4j
|
||||
public class FilePcapWorker extends AbstractPcapWorker {
|
||||
@@ -31,8 +32,9 @@ public class FilePcapWorker extends AbstractPcapWorker {
|
||||
super(servicesService, streamService, localIpString);
|
||||
this.subscriptionService = subscriptionService;
|
||||
|
||||
file = new File(filename);
|
||||
file = new File("pcaps", filename);
|
||||
if (!file.exists()) {
|
||||
log.info("Existing files: " + Arrays.toString(new File("pcaps").listFiles()));
|
||||
throw new IllegalArgumentException("File " + file.getAbsolutePath() + " does not exist");
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public class TlsDecryptor {
|
||||
int blockCipherSize = Integer.parseInt(blockCipherParts[1]);
|
||||
String blockCipherMode = blockCipherParts[2];
|
||||
|
||||
if (!blockCipherAlgo.equals("AES")) { //TODO использовать не только AES256
|
||||
if (!blockCipherAlgo.equals("AES")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package ru.serega6531.packmate.tasks;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.serega6531.packmate.service.StreamService;
|
||||
@@ -12,7 +12,7 @@ import java.time.temporal.ChronoUnit;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@ConditionalOnProperty(name = "old-streams-cleanup-enabled", havingValue = "true")
|
||||
@ConditionalOnExpression("${old-streams-cleanup-enabled:false} && '${capture-mode}' == 'LIVE'")
|
||||
public class OldStreamsCleanupTask {
|
||||
|
||||
private final StreamService service;
|
||||
|
||||
@@ -3,6 +3,7 @@ package ru.serega6531.packmate;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import ru.serega6531.packmate.model.Packet;
|
||||
import ru.serega6531.packmate.service.optimization.HttpChunksProcessor;
|
||||
import ru.serega6531.packmate.service.optimization.HttpGzipProcessor;
|
||||
import ru.serega6531.packmate.service.optimization.HttpUrldecodeProcessor;
|
||||
import ru.serega6531.packmate.service.optimization.PacketsMerger;
|
||||
@@ -67,6 +68,18 @@ class StreamOptimizerTest {
|
||||
assertEquals(2, list.get(3).getContent().length);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testChunkedTransferEncoding() {
|
||||
String content = "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n" +
|
||||
"6\r\nChunk1\r\n6\r\nChunk2\r\n0\r\n\r\n";
|
||||
|
||||
List<Packet> packets = new ArrayList<>(List.of(createPacket(content.getBytes(), false)));
|
||||
new HttpChunksProcessor(packets).processChunkedEncoding();
|
||||
|
||||
assertEquals(1, packets.size());
|
||||
assertTrue(packets.get(0).getContentString().contains("Chunk1Chunk2"));
|
||||
}
|
||||
|
||||
private Packet createPacket(int content, boolean incoming) {
|
||||
return createPacket(new byte[] {(byte) content}, incoming);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user