Skip to content

Commit

Permalink
Fix confundo.lua and add an example pcap file
Browse files Browse the repository at this point in the history
  • Loading branch information
hongee authored and cawka committed May 15, 2017
1 parent 8394cd6 commit fb5cd08
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ path to the `tcp.lua` script:

wireshark -X lua_script:./confundo.lua

To dissect tcpdump-recorded file, you can use `-r <pcapfile>` option. For example:

wireshark -X lua_script:./confundo.lua -r confundo.pcap

## TODO

###########################################################
Expand Down
25 changes: 7 additions & 18 deletions confundo.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
confundo = Proto("confundo", "CS118 TCP")
confundo = Proto("confundo", "CS118 Confundo Transport Protocol (CTP)")

local f_seqno = ProtoField.uint32("confundo.seqno", "Sequence Number")
local f_ack = ProtoField.uint32("confundo.ack", "ACK Number")
Expand All @@ -12,35 +12,24 @@ function confundo.dissector(tvb, pInfo, root) -- Tvb, Pinfo, TreeItem
return 0
end

local t = root:add(confundo, tvb(0,8))
local t = root:add(confundo, tvb(0,12))
t:add(f_seqno, tvb(0,4))
t:add(f_ack, tvb(4,4))
t:add(f_id, tvb(8,2))
local f = t:add(f_flags, tvb(10,2))

local flag = tvb(7,1):uint()
local flag = tvb(11,1):uint()

if bit.band(flag, 1) ~= 0 then
f:add(tvb(7,2), "FIN")
f:add(tvb(11,1), "FIN")
end
if bit.band(flag, 2) ~= 0 then
f:add(tvb(7,2), "SYN")
f:add(tvb(11,1), "SYN")
end
if bit.band(flag, 4) ~= 0 then
f:add(tvb(7,2), "ACK")
f:add(tvb(11,1), "ACK")
end

local flag = tvb(6,1):uint()
if bit.band(flag, 1) ~= 0 then
f:add(tvb(6,1), "xFIN")
end
if bit.band(flag, 2) ~= 0 then
f:add(tvb(6,1), "xSYN")
end
if bit.band(flag, 4) ~= 0 then
f:add(tvb(6,1), "xACK")
end


pInfo.cols.protocol = "Confundo"
end

Expand Down
Binary file added confundo.pcap
Binary file not shown.

0 comments on commit fb5cd08

Please sign in to comment.