https://github.com/ronin-rb/ronin-dns-proxy
A configurable DNS proxy server library
https://github.com/ronin-rb/ronin-dns-proxy
dns dns-proxy dns-proxy-server dns-server infosec mitm mitmproxy ronin-rb
Last synced: 4 months ago
JSON representation
A configurable DNS proxy server library
- Host: GitHub
- URL: https://github.com/ronin-rb/ronin-dns-proxy
- Owner: ronin-rb
- License: lgpl-3.0
- Created: 2023-02-26T04:40:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-12T06:55:15.000Z (8 months ago)
- Last Synced: 2025-06-05T08:24:31.453Z (4 months ago)
- Topics: dns, dns-proxy, dns-proxy-server, dns-server, infosec, mitm, mitmproxy, ronin-rb
- Language: Ruby
- Homepage: https://ronin-rb.dev
- Size: 52.7 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: COPYING.txt
Awesome Lists containing this project
README
# ronin-dns-proxy
[](https://github.com/ronin-rb/ronin-dns-proxy/actions/workflows/ruby.yml)
[](https://codeclimate.com/github/ronin-rb/ronin-dns-proxy)* [Website](https://ronin-rb.dev/)
* [Source](https://github.com/ronin-rb/ronin-dns-proxy)
* [Issues](https://github.com/ronin-rb/ronin-dns-proxy/issues)
* [Documentation](https://ronin-rb.dev/docs/ronin-dns-proxy)
* [Discord](https://discord.gg/6WAb3PsVX9) |
[Mastodon](https://infosec.exchange/@ronin_rb)## Description
ronin-dns-proxy is a configurable DNS proxy server library. It supports
returning spoofing DNS results or passing DNS queries through to the upstream
DNS nameserver.## Features
* Supports returning spoofed results to specific DNS queries.
* Supports matching queries with regular expressions.
* Supports dynamic DNS server rules.
* Passing through all other DNS queries.
* Has 95% documentation coverage.
* Has 100% test coverage.## Examples
```ruby
require 'ronin/dns/proxy'Ronin::DNS::Proxy.run('127.0.0.1', 2346) do |server|
server.rule :A, 'example.com', '10.0.0.1'
server.rule :AAAA, 'example.com', 'dead:beef::1'# return multiple values
server.rule :A, 'ftp.example.com', ['10.0.0.42', '10.0.0.43']# match a query using a regex
server.rule :TXT, /^spf\./, "v=spf1 include:10.0.0.1 ~all"# return an error for a valid hostname
server.rule :A, 'updates.example.com', :ServFail# define a dynamic rule
server.rule(:CNAME, /^www\./) do |type,name,transaction|
# append '.hax' to the domain name
names = name.split('.').push('hax')transaction.respond!(names)
end# return MX records
server.rule(:MX, 'example.com') do |type,name,transaction|
transaction.respond!(10, Resolv::DNS::Name.create('email.evil.com' ))
end
end
```Then try running `host -p 2346 example.com 127.0.0.1` once the server is
running.## Requirements
* [Ruby] >= 3.0.0
* [async-dns] ~> 1.0
* [ronin-support] ~> 1.0## Install
```shell
$ gem install ronin-dns-proxy
```### Gemfile
```ruby
gem 'ronin-dns-proxy', '~> 0.1'
```### gemspec
```ruby
gem.add_dependency 'ronin-dns-proxy', '~> 0.1'
```## Development
1. [Fork It!](https://github.com/ronin-rb/ronin-dns-proxy/fork)
2. Clone It!
3. `cd ronin-dns-proxy/`
4. `bundle install`
5. `git checkout -b my_feature`
6. Code It!
7. `bundle exec rake spec`
8. `git push origin my_feature`## License
Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com)
ronin-dns-proxy is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.ronin-dns-proxy 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 Lesser General Public License for more details.You should have received a copy of the GNU Lesser General Public License
along with ronin-dns-proxy. If not, see .[Ruby]: https://www.ruby-lang.org
[async-dns]: https://github.com/socketry/async-dns#readme
[ronin-support]: https://github.com/ronin-rb/ronin-support#readme