Skip to content

Commit

Permalink
Take in account ipparse changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jperon committed Nov 28, 2024
1 parent 8f668a2 commit 8695c54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hexdump/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ make xdp.o
## Usage

```sh
sudo lunatik spawn hexdump/hook # runs the Lua kernel script
sudo lunatik start hexdump/hook false # runs the Lua kernel script
sudo xdp-loader load -m skb eth0 xdp.o # if using XDP: replace eth0 by your interface.
sudo journalctl -ft kernel # or use dmesg
sudo xdp-loader unload eth0 --all # unloads the XDP helper
Expand Down
8 changes: 4 additions & 4 deletions hexdump/hook.moon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DEBUG = true
XDP = true
--NETFILTER = true
XDP = false
NETFILTER = not XDP

xdp = require"xdp"
nf = require"netfilter"
Expand All @@ -18,7 +18,7 @@ protocols =
[UDP.protocol_type]: "UDP"

dump = =>
return if not @
return nil if not @
if @is_fragment!
print"Fragment detected: #{@length}" if DEBUG
f_ip = collect @
Expand All @@ -27,7 +27,7 @@ dump = =>
@ = f_ip
pkt = UDP(@data)
print"\n\n#{@src} #{pkt.sport} #{@dst} #{pkt.dport} #{protocols[@protocol] or @protocol}\n"
print l for l in *@hexdump
print l for l in @hexdump!

if XDP
PASS = xdp.action.PASS
Expand Down

0 comments on commit 8695c54

Please sign in to comment.