Skip to content

Latest commit

 

History

History
118 lines (86 loc) · 3.33 KB

README.md

File metadata and controls

118 lines (86 loc) · 3.33 KB

ronin-dns-proxy

CI Code Climate

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

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

Install

$ gem install ronin-dns-proxy

Gemfile

gem 'ronin-dns-proxy', '~> 0.1'

gemspec

gem.add_dependency 'ronin-dns-proxy', '~> 0.1'

Development

  1. Fork It!
  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 https://www.gnu.org/licenses/.