summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-03 07:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-03 07:49:50 +0000
commit216afbe7cc62a59d1866a6524a214646361d3dc7 (patch)
tree1f334ba713f90066fa6f790ca757b0046cd9a181 /examples
parentAdding upstream version 1.3.0. (diff)
downloaddnsjit-216afbe7cc62a59d1866a6524a214646361d3dc7.tar.xz
dnsjit-216afbe7cc62a59d1866a6524a214646361d3dc7.zip
Adding upstream version 1.4.0.upstream/1.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am2
-rw-r--r--examples/Makefile.in4
-rwxr-xr-xexamples/dumpdns.lua41
3 files changed, 41 insertions, 6 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 45329c6..a184589 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (c) 2018-2023, OARC, Inc.
+# Copyright (c) 2018-2024 OARC, Inc.
# All rights reserved.
#
# This file is part of dnsjit.
diff --git a/examples/Makefile.in b/examples/Makefile.in
index ba58780..ac0905a 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -14,7 +14,7 @@
@SET_MAKE@
-# Copyright (c) 2018-2023, OARC, Inc.
+# Copyright (c) 2018-2024 OARC, Inc.
# All rights reserved.
#
# This file is part of dnsjit.
@@ -297,6 +297,8 @@ libdir = @libdir@
libexecdir = @libexecdir@
liblz4_CFLAGS = @liblz4_CFLAGS@
liblz4_LIBS = @liblz4_LIBS@
+liblzma_CFLAGS = @liblzma_CFLAGS@
+liblzma_LIBS = @liblzma_LIBS@
libpcap_CFLAGS = @libpcap_CFLAGS@
libpcap_LIBS = @libpcap_LIBS@
libzstd_CFLAGS = @libzstd_CFLAGS@
diff --git a/examples/dumpdns.lua b/examples/dumpdns.lua
index 3eab4f4..b243b40 100755
--- a/examples/dumpdns.lua
+++ b/examples/dumpdns.lua
@@ -1,28 +1,61 @@
#!/usr/bin/env dnsjit
local pcap = arg[2]
local compression = arg[3]
+local mmap = arg[4]
if pcap == nil then
- print("usage: "..arg[1].." <pcap> [compression]")
+ print("usage: "..arg[1].." <pcap | '-' for stdin> [compression] [mmap]")
return
end
local object = require("dnsjit.core.objects")
local input = require("dnsjit.input.pcap").new()
local zinput = require("dnsjit.input.zpcap").new()
+if mmap then
+ zinput = require("dnsjit.input.zmmpcap").new()
+end
local layer = require("dnsjit.filter.layer").new()
local dns = require("dnsjit.core.object.dns").new()
if string.lower(string.sub(pcap, -4)) == ".zst" or compression == "zstd" then
zinput:zstd()
- zinput:open(pcap)
+ if pcap == "-" then
+ zinput:openfp(io.stdin)
+ else
+ zinput:open(pcap)
+ end
layer:producer(zinput)
elseif string.lower(string.sub(pcap, -4)) == ".lz4" or compression == "lz4" then
zinput:lz4()
- zinput:open(pcap)
+ if pcap == "-" then
+ zinput:openfp(io.stdin)
+ else
+ zinput:open(pcap)
+ end
+ layer:producer(zinput)
+elseif string.lower(string.sub(pcap, -3)) == ".xz" or compression == "xz" then
+ zinput:lzma()
+ if pcap == "-" then
+ zinput:openfp(io.stdin)
+ else
+ zinput:open(pcap)
+ end
+ layer:producer(zinput)
+elseif string.lower(string.sub(pcap, -3)) == ".gz" or compression == "gz" then
+ zinput:gzip()
+ if pcap == "-" then
+ zinput:openfp(io.stdin)
+ else
+ zinput:open(pcap)
+ end
layer:producer(zinput)
else
- input:open_offline(pcap)
+ if mmap then
+ input = require("dnsjit.input.mmpcap").new()
+ input:open(pcap)
+ else
+ input:open_offline(pcap)
+ end
layer:producer(input)
end
local producer, ctx = layer:produce()