Работа над распаковкой websocket
This commit is contained in:
@@ -22,6 +22,6 @@ public class CtfService {
|
|||||||
|
|
||||||
private boolean mergeAdjacentPackets;
|
private boolean mergeAdjacentPackets;
|
||||||
|
|
||||||
private boolean inflateWebSockets = true; //TODO
|
private boolean inflateWebSockets;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -52,6 +52,8 @@ public class Packet {
|
|||||||
|
|
||||||
private boolean ungzipped;
|
private boolean ungzipped;
|
||||||
|
|
||||||
|
private boolean webSocketInflated;
|
||||||
|
|
||||||
private byte[] content;
|
private byte[] content;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public class StreamOptimizer {
|
|||||||
final List<Packet> cut = packets.subList(start, end);
|
final List<Packet> cut = packets.subList(start, end);
|
||||||
final long timestamp = cut.get(0).getTimestamp();
|
final long timestamp = cut.get(0).getTimestamp();
|
||||||
final boolean ungzipped = cut.stream().anyMatch(Packet::isUngzipped);
|
final boolean ungzipped = cut.stream().anyMatch(Packet::isUngzipped);
|
||||||
|
final boolean webSocketInflated = cut.stream().anyMatch(Packet::isWebSocketInflated);
|
||||||
boolean incoming = cut.get(0).isIncoming();
|
boolean incoming = cut.get(0).isIncoming();
|
||||||
//noinspection OptionalGetWithoutIsPresent
|
//noinspection OptionalGetWithoutIsPresent
|
||||||
final byte[] content = cut.stream()
|
final byte[] content = cut.stream()
|
||||||
@@ -101,6 +102,7 @@ public class StreamOptimizer {
|
|||||||
.incoming(incoming)
|
.incoming(incoming)
|
||||||
.timestamp(timestamp)
|
.timestamp(timestamp)
|
||||||
.ungzipped(ungzipped)
|
.ungzipped(ungzipped)
|
||||||
|
.webSocketInflated(webSocketInflated)
|
||||||
.content(content)
|
.content(content)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
@@ -221,6 +223,7 @@ public class StreamOptimizer {
|
|||||||
.incoming(false)
|
.incoming(false)
|
||||||
.timestamp(cut.get(0).getTimestamp())
|
.timestamp(cut.get(0).getTimestamp())
|
||||||
.ungzipped(true)
|
.ungzipped(true)
|
||||||
|
.webSocketInflated(false)
|
||||||
.content(newContent)
|
.content(newContent)
|
||||||
.build();
|
.build();
|
||||||
} catch (ZipException e) {
|
} catch (ZipException e) {
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ public class WebSocketsParser {
|
|||||||
.timestamp(lastPacket.getTimestamp())
|
.timestamp(lastPacket.getTimestamp())
|
||||||
.ttl(lastPacket.getTtl())
|
.ttl(lastPacket.getTtl())
|
||||||
.ungzipped(lastPacket.isUngzipped())
|
.ungzipped(lastPacket.isUngzipped())
|
||||||
|
.webSocketInflated(true)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user