diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-13 07:54:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-13 07:54:12 +0000 |
commit | 4754ed45b607e82450a5e31fea1da3ba61433b04 (patch) | |
tree | 3554490bdc003e6004f605abe41929cdf98b0651 /examples/readme.lua | |
parent | Initial commit. (diff) | |
download | dnsjit-4754ed45b607e82450a5e31fea1da3ba61433b04.tar.xz dnsjit-4754ed45b607e82450a5e31fea1da3ba61433b04.zip |
Adding upstream version 1.1.0+debian.upstream/1.1.0+debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'examples/readme.lua')
-rwxr-xr-x | examples/readme.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/readme.lua b/examples/readme.lua new file mode 100755 index 0000000..dc6de89 --- /dev/null +++ b/examples/readme.lua @@ -0,0 +1,20 @@ +#!/usr/bin/env dnsjit +require("dnsjit.core.objects") +local input = require("dnsjit.input.pcap").new() +local layer = require("dnsjit.filter.layer").new() +local dns = require("dnsjit.core.object.dns").new() + +input:open_offline(arg[2]) +layer:producer(input) +local producer, ctx = layer:produce() + +while true do + local object = producer(ctx) + if object == nil then break end + if object:type() == "payload" then + dns.obj_prev = object + if dns:parse_header() == 0 then + print(dns.id) + end + end +end |