FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pcap-lua/pcapx.lua at master · sam-github/pcap-lua · GitHub
sam-github
/
pcap-lua
Public
Notifications
You must be signed in to change notification settings
Fork
12
Star
44
Code
Issues
0
Pull requests
2
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
pcap-lua
/
pcapx.lua
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (43 loc) · 1.18 KB
Breadcrumbs
pcap-lua
/
pcapx.lua
Copy path
File metadata and controls
53 lines (43 loc) · 1.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--[[
-
pcapx - extensions to pcap
]]
local
pcap
=
require
"
pcap
"
require
"
net
"
local
function
NOP
()
end
--[[
-
- pcap.recode(incap, outcap, progress, debug)
- incap, name of input pcap
- outcap, name of output pcap, default to "recoded-"..incap
- progress, pass print-like function to receive progress messages,
defaults to no progress
- debug, as above, but for debug output
Re-encode file.pcap as recoded-file.pcap, using print()
to report progress:
pcap.recode("file.pcap", nil, print)
]]
function
pcap
.
recode
(
incap
,
outcap
,
progress
,
debug
)
progress
=
progress
or
NOP
debug
=
debug
or
NOP
if
not
outcap
then
outcap
=
"
recoded-
"
..
incap
end
os.remove
(
outcap
)
local
cap
=
assert
(
pcap
.
open_offline
(
incap
))
local
dmp
=
assert
(
cap
:
dump_open
(
outcap
))
local
n
=
assert
(
net
.
init
())
local
i
=
0
for
pkt
,
time
,
len
in
cap
.
next
,
cap
do
i
=
i
+
1
progress
(
"
packet
"
,
i
,
"
wirelen
"
,
len
,
"
timestamp
"
,
time
,
os.date
(
"
!%c
"
,
time
))
assert
(
n
:
clear
())
assert
(
n
:
decode_eth
(
pkt
))
assert
(
dmp
:
dump
(
n
:
block
(),
time
,
len
))
debug
(
n
:
dump
())
end
dmp
:
close
()
cap
:
close
()
n
:
destroy
()
return
outcap
end
return
pcap
Back
|
FazBrowse Home
|
New Git URL