1
0
Fork
You've already forked dnsjit
0
forked from DNS-OARC/dnsjit
Engine for capturing, parsing and replaying DNS
  • C 45.8%
  • Lua 30.2%
  • C++ 9.1%
  • M4 8.8%
  • Makefile 2.9%
  • Other 3.2%
2026年03月22日 10:29:47 +01:00
.builds CI updates 2025年09月10日 10:18:49 +02:00
.forgejo/workflows actions 2026年03月22日 10:27:00 +01:00
debian Release 1.5.1 2026年02月04日 14:43:06 +01:00
examples copyright 2026年01月28日 14:10:56 +01:00
include Example modules - input 2021年06月22日 16:32:59 +02:00
m4 copyright 2026年01月28日 14:10:56 +01:00
rpm Release 1.5.1 2026年02月04日 14:43:06 +01:00
src Release 1.5.1 2026年02月04日 14:43:06 +01:00
.clang-format dnsjit - initial commit 2018年01月26日 13:58:21 +01:00
.gitignore pkg-config 2023年12月06日 13:45:05 +01:00
autogen.sh copyright 2026年01月28日 14:10:56 +01:00
CHANGES Release 1.5.1 2026年02月04日 14:43:06 +01:00
configure.ac Release 1.5.1 2026年02月04日 14:43:06 +01:00
fmt.sh copyright 2026年01月28日 14:10:56 +01:00
LICENSE dnsjit - initial commit 2018年01月26日 13:58:21 +01:00
Makefile.am copyright 2026年01月28日 14:10:56 +01:00
README.md copyright 2026年01月28日 14:10:56 +01:00

Engine for capturing, parsing and replaying DNS

Bugs Security Rating

dnsjit is a combination of parts taken from dsc, dnscap, drool, and put together around Lua to create a script-based engine for easy capturing, parsing and statistics gathering of DNS messages while also providing facilities for replaying DNS traffic.

One of the core functionality that dnsjit brings is to tie together C and Lua modules through a receiver/producer interface. This allows creation of custom chains of functionality to meet various requirements. Another core functionality is the ability to parse and process DNS messages even if the messages are non-compliant with the DNS standards.

The following Lua module categories exists:

  • dnsjit.core: Core modules for handling things like logging, DNS messages and receiver/receive functionality.
  • dnsjit.lib: Various Lua libraries or C library bindings.
  • dnsjit.input: Input modules used to read DNS messages in various ways.
  • dnsjit.filter: Filter modules to process or manipulate DNS messages.
  • dnsjit.output: Output modules used to display DNS message, export to various formats or replay them against other targets.

See each category's man-page for more information.

More information may be found here:

Issues should be reported here:

General support and discussion:

Packages

https://dev.dns-oarc.net/packages

Packages for Debian, Ubuntu, EPEL, SLE, openSUSE can be found in the PRE-RELEASE channel. Some distributions are limited to certain architectures because of LuaJIT.

Dependencies

Debian/Ubuntu: apt-get install libluajit-5.1-dev libpcap-dev luajit liblmdb-dev libck-dev libgnutls28-dev liblz4-dev libzstd-dev

  • Note: On Xenial you'll need to install libzstd1-dev

CentOS: yum install luajit-devel libpcap-devel lmdb-devel ck-devel gnutls-devel lz4-devel libzstd-devel

  • Note: You might need EPEL and/or PowerTools repositories enabled

FreeBSD: pkg install luajit libpcap lmdb gnutls concurrencykit zstd liblz4

OpenBSD: pkg_add luajit gnutls lz4 zstd + manual install of libpcap, liblmdb and libck

On some version of SUSE Linux Enterprise moonjit is used as an compatible alternative to luajit.

Build

git clone https://codeberg.org/DNS-OARC/dnsjit
cd dnsjit
sh autogen.sh
./configure
make

Documentation

Most documentation exists in man-pages and you do not have to install to access them, after building you can do:

man src/dnsjit.1
man src/dnsjit.core.3
man src/dnsjit.lib.3
man src/dnsjit.input.3
man src/dnsjit.filter.3
man src/dnsjit.output.3

Usage

Run a Lua script:

dnsjit file.lua ...

Shebang-style:

#!/usr/bin/env dnsjit
...

Example

Following example display the DNS ID found in queries.

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:reset()
 dns.obj_prev = object
 if dns:parse_header() == 0 then
 print(dns.id)
 end
 end
end

Disclaimer, to keep the above example short it only works on pre-prepared PCAPs with only UDP DNS traffic in them.

See more examples in the examples directory.

Copyright (c) 2018-2026 OARC, Inc.

All rights reserved.

This file is part of dnsjit.
dnsjit is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnsjit is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnsjit. If not, see <http://www.gnu.org/licenses/>.