DNS proxy tool

Overview

updns

GitHub Workflow Status Crates.io Crates.io


updns is a simple DNS proxy server developed using Rust. You can intercept any domain name and return the ip you need

Install

Download the binary from the release page

Or use cargo to install

cargo install updns

Start to use 🚀

updns
# or
updns -c /your/hosts

You may use sudo to run this command because you will use the 53 port

Running in docker

Build docker image

docker build -t updns .

Start up

docker run -d --name updns -p 53:53/udp -v /root/updns/:/root/.updns/ --restart always updns

Command

Usage:
    updns [COMMAND] [OPTION]
            
Command:
    add        Add a DNS record
    ls         Print all configured DNS records
    config     Call 'vim' to edit the configuration file
    path       Print related directories
    help       Print help information
    version    Print version information

Option:
    -c    Specify a config file
    -i    Check the interval time of the configuration file
          format: 1ms, 1s, 1m, 1h, 1d

Config

You can use updns config command and then call vim edit, or find ~/.updns/config edit

You can specify standard domains, or utilize regular expressions for dynamic matching

Regular expression starts with ~

bind     0.0.0.0:53      # Binding address
proxy    8.8.8.8:53      # Proxy address
timeout  2s              # Proxy timeout (format: 1ms, 1s, 1m, 1h, 1d)

# Domain matching
example.com              1.1.1.1
*.example.com            2.2.2.2
~^\w+\.example\.[a-z]+$  3.3.3.3

# IPv6
test.com                ::

# Import from other file
import /other/hosts

Reference

Building a DNS server in Rust

License

MIT license

Comments
  • Updns has vulnerability in downstream dependencies

    Updns has vulnerability in downstream dependencies

    Updns depends on Logs v 0.5.0, which in turn depends on time 0.1.44

    This version of time has a vulnerability: https://rustsec.org/advisories/RUSTSEC-2020-0071

    If logs is upgraded to the latest 0.6.2, it will be upgrade time to 0.3.14+ which doesn't have this vulnerability.

    opened by vronin 2
  • wrong arguments passed to buffer::copy

    wrong arguments passed to buffer::copy

    Hello @wyhaya there's a bug in https://github.com/wyhaya/updns/blob/4fb62c6fa6863089c8443d737ad1de61031280af/lib/parse.js#L125-L126 The third argument should be a number indicating sourceStart, see https://nodejs.org/api/buffer.html#buffer_buf_copy_target_targetstart_sourcestart_sourceend

    opened by refack 1
  • global install update: bind param in hosts, watch hosts for changes, regex RFC update, support regex hosts

    global install update: bind param in hosts, watch hosts for changes, regex RFC update, support regex hosts

    I committed in small batches to make it easy(ier) for you to follow along. There are comments in the code, as well as on the larger (and less obvious) commits. I rebased it from your recent changes, so if you like what you see, it should be an easy merge.

    1. Specify bind parameters in the hosts/config file.
    2. Watches & automatically loads changes to the hosts file.
    3. Did my best to adhere to RFC spec for domain name matching, updated the regex.
    4. Allow regular expressions in the hosts file (requests are still validated to RFC spec).
    opened by ksteckert 1
  • readme updates

    readme updates

    1. updated hosts example
    2. added INI syntax highlighting to hosts code-block
    3. mentioned IP:port binding
    4. mentioned regex matching with a link to RegexPal (for testing regex on JS)
    5. Updated module example with demonstratioin IP binding, with a mention that it's optional
    opened by ksteckert 0
  • bind to address

    bind to address

    Allow binding to a specific address. Services such as dnsmasq and ssystemd-resolved often bind to port 53, this will allow a user to bind to their external address, (or any valid loopback: 127.x.x.x).

    I did this for my dev environment. I have updns bound to 127.0.0.2, and I updated my dns settings to point to 127.0.0.2, and have the script running in PM2, works like a champ. Without this change, any other process using port 53 (bound to any address) will cause NodeJS to throw an exception about the port already in use. This allows the user to bind to a specific address.

    opened by ksteckert 0
  • bind to address

    bind to address

    Allow binding to a specific address. Services such as dnsmasq often bind to 127.0.0.1:53, this will allow a user to bind to their external address, or a different loopback (127.0.0.2). I did this for my dev environment. I have the updns bound to 127.0.0.2, with a regex pattern match so I don't have to add a bunch of entries to my hosts file. I updated my dns settings to point to 127.0.0.2, and have the script running in PM2, works like a champ. I have the default set as 127.0.0.1 so it's fully backwards compatible, no breaking changes.

    opened by ksteckert 0
Owner
null
A purpose-built proxy for the Linkerd service mesh. Written in Rust.

This repo contains the transparent proxy component of Linkerd2. While the Linkerd2 proxy is heavily influenced by the Linkerd 1.X proxy, it comprises

Linkerd 1.7k Jan 7, 2023
DNS Server written in Rust for fun, see https://dev.to/xfbs/writing-a-dns-server-in-rust-1gpn

DNS Fun Ever wondered how you can write a DNS server in Rust? No? Well, too bad, I'm telling you anyways. But don't worry, this is going to be a fun o

Patrick Elsen 26 Jan 13, 2023
DNS proxy tool

updns updns is a simple DNS proxy server developed using Rust. You can intercept any domain name and return the ip you need Install Download the binar

null 60 Dec 24, 2022
Flexible DNS hijacking and proxy tool.

kungfu Flexible DNS hijacking and proxy tool. Features Flexible rules e.g. glob pattern domain, static routes, response CIDR Host file include /etc/ho

yinheli 30 Dec 22, 2022
Proxy sentry request to a sentry server using a tunnel/proxy endpoint

Sentry Tunnel This is a proxy that forwards tunneled sentry requests to the real sentry server. The implementation is based on the explanation provide

Paul FLORENCE 14 Dec 20, 2022
UDP proxy with Proxy Protocol and mmproxy support

udppp UDP proxy with Proxy Protocol and mmproxy support. Features Async Support Proxy Protocol V2 SOCKET preserve client IP addresses in L7 proxies(mm

b23r0 10 Dec 18, 2022
Lightweight proxy that allows redirect HTTP(S) traffic through a proxy.

Proxyswarm Proxyswarm is a lightweight proxy that allows redirect HTTP(S) traffic through a proxy. WARNING: This app isn't recomended for download lar

Jorge Alejandro Jimenez Luna 4 Apr 16, 2022
Web3-proxy: a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers.

web3-proxy Web3-proxy is a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers. Signed transactions (eth_sendRawTrans

null 55 Jan 8, 2023
A TCP proxy using HTTP - Reach SSH behind a Nginx reverse proxy

?? TCP over HTTP ?? The Questions ?? What does it do? You can proxy TCP traffic over HTTP. A basic setup would be: [Your TCP target] <--TCP-- [Exit No

Julian 185 Dec 15, 2022
Cross-platform tool to update DNS such as Gandi.net with your dynamic IP address

GDU | Generic DNS Update A cross-platform tool to update DNS zonefiles (such as Gandi.net) when you have a dynamic public IP address. It's a DynDNS or

Damien Lecan 10 Jan 20, 2022
Library + CLI-Tool to measure the TTFB (time to first byte) of HTTP requests. Additionally, this crate measures the times of DNS lookup, TCP connect and TLS handshake.

TTFB: CLI + Lib to Measure the TTFB of HTTP/1.1 Requests Similar to the network tab in Google Chrome or Mozilla Firefox, this crate helps you find the

Philipp Schuster 24 Dec 1, 2022
Userspace libpcap-based tool to mirror your dns traffic

DNS traffic mirroring tool (dns-mirror) Description Userspace libpcap-based tool. dns-mirror sniffs dns packets on the given interface and proxies it

Timofey 1 Mar 15, 2022
Dns subdomain finding tool, based off of the c application of the same name

dnsmap-rs Tool for brute-forcing/scanning for existing subdomains in a domain. Based on dnsmap c application that is packaged in kali linux. Can query

Tomás Alvarez 3 Oct 19, 2022
RDE1 (Rusty Data Exfiltrator) is client and server tool allowing auditor to extract files from DNS and HTTPS protocols written in Rust. 🦀

Information: RDE1 is an old personal project (end 2022) that I didn't continue development on. It's part of a list of projects that helped me to learn

Quentin Texier (g0h4n) 32 Oct 6, 2023
spy on the DNS queries your computer is making

dnspeep dnspeep lets you spy on the DNS queries your computer is making. Here's some example output: $ sudo dnspeep query name

Julia Evans 1.2k Dec 29, 2022
Utility for working with reverse DNS

RDNS RDNS is a small Rust CLI utility for performing single and bulk reverse DNS (PTR) lookups. Usage RDNS 0.1.0 Joe Banks <[email protected]> Utilities for

Joe Banks 2 Sep 22, 2021
Dropping GFW DNS contaminated packets based on Rust + eBPF

Dropping GFW DNS contaminated packets based on Rust + eBPF

ihc童鞋@提不起劲 1k Jan 3, 2023
Implementation of algorithms for Domain Name System (DNS) Cookies construction

DNS Cookie RFC7873 left the construction of Server Cookies to the discretion of the DNS Server (implementer) which has resulted in a gallimaufry of di

Rushmore Mushambi 2 Feb 4, 2022
Third party Google DNS client for rust.

google-dns-rs Documentation Install Add the following line to your Cargo.toml file: google-dns-rs = "0.3.0" Usage use google_dns_rs::api::{Dns, DoH, R

Eduardo Stuart 2 Nov 13, 2021
A wrapper for the Google Cloud DNS API

cloud-dns is a crate providing a client to interact with Google Cloud DNS v1

Embark 5 May 24, 2022