Skip to content

Commit cb35f89

Browse files
committed
Utility to split one pcap into a pcap per packet.
1 parent fe42a7c commit cb35f89

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pcap-split

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env lua5.1
2+
3+
require"pcap"
4+
5+
file = assert(arg[1])
6+
cap = assert(pcap.open_offline(file))
7+
8+
for pkt, time, len in cap.next, cap do
9+
i = (i or 0) + 1
10+
print("packet", i, "wirelen", len, "timestamp", time, os.date("!%c", time))
11+
dumper = assert(cap:dump_open(i..".pcap"))
12+
assert(dumper:dump(pkt, time, len))
13+
dumper:close()
14+
end
15+

0 commit comments

Comments
 (0)