1
0
Fork 0
dnsjit/examples/readme.lua

21 lines
536 B
Lua
Raw Permalink Normal View History

#!/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