blob: 83d81c9e8e2349f5c537fb34338ea4518805cde4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env lua
--
-- (C) 2021 - ntop.org
--
package.path = "lib/?.lua;" .. package.path
local tshark = require "tshark"
local pcap_file = "../../tests/pcap/tor.pcap"
local t = tshark:open(pcap_file, "tcp")
if(t == nil) then
io.write("Unable to read pcap file "..pcap_file.."\n")
exit()
end
local num_tcp = 0
while(true) do
local l = t:read()
if(l == nil) then break end
io.write(".")
io.flush()
num_tcp = num_tcp + 1
end
t:close()
io.write("\nFound "..num_tcp.." TCP packets on pcap "..pcap_file.."\n")
|