fakedns

package module
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 10 Imported by: 0

README

fakedns

Tiny DNS proxy for Penetration Testers and Malware Analysts

Features

  • Regular Expression based DNS server
  • IPV4 & IPV6
  • DNS Rebinding
  • DNS Round-Robin
  • Upstream DNS Resolver

Installing

You can install the pre-compiled binary in several different ways

homebrew tap:
brew tap hupe1980/fakedns
brew install fakedns
snapcraft:

Get it from the Snap Store

sudo snap install fakedns
scoop:
scoop bucket add fakedns https://github.com/hupe1980/fakedns-bucket.git
scoop install fakedns
deb/rpm/apk:

Download the .deb, .rpm or .apk from the releases page and install them with the appropriate tools.

manually:

Download the pre-compiled binaries from the releases page and copy to the desired location.

Building from source

Install a Go 1.17 compiler and run the following command in the checked-out repository:

make build

(Add the appropriate .exe extension on Windows systems, of course.)

Docker Support

git clone https://github.com/hupe1980/fakedns
cd fakedns
make docker-build

# Run fakedns for example.org on port 4444
docker run -it --rm -p 4444:53/udp fakedns example.org -v --ipv4 127.0.0.1

# Use dig to test fakedns
dig example.org @localhost -p 4444

How to use

Usage:
  fakedns [domains] [flags]

Examples:
- IPV4: fakedns example.org --ipv4 127.0.0.1
- Wildcards: fakedns example.* --ipv4 127.0.0.1
- RoundRobin: fakedns example.org --ipv4 127.0.0.1,10.10.10.10
- Rebind: fakedns example.org --ipv4 127.0.0.1 --rebind-v4 10.10.10.10
- Upstream: fakedns example.org --ipv4 127.0.0.1 --upstream 8.8.8.8

Flags:
  -a, --addr string            fakeDNS address (default "0.0.0.0:53")
  -h, --help                   help for fakedns
      --ipv4 strings           IPV4 address to return
      --ipv6 strings           IPV6 address to return
      --mx string              host name of mail exchange server
  -n, --net string             fakeDNS network protocol (default "udp")
      --rebind-threshold int   rebind threshold (default 1)
      --rebind-v4 string       IPV4 rebind address
      --rebind-v6 string       IPV6 rebind address
      --text strings           TXT text value
      --ttl uint32             time to live (default 60)
      --upstream string        upstream dns server
  -v, --verbose                print detailed logging messages
      --version                version for fakedns

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeDNS

type FakeDNS struct {
	// contains filtered or unexported fields
}

func New

func New(domain *regexp.Regexp, options *Options) *FakeDNS

func (*FakeDNS) ListenAndServe

func (t *FakeDNS) ListenAndServe(addr, network string) error

func (*FakeDNS) ListenAndServeTLS added in v0.0.4

func (t *FakeDNS) ListenAndServeTLS(addr, certFile, keyFile string) error

func (*FakeDNS) Shutdown added in v0.0.4

func (t *FakeDNS) Shutdown() error

type Options

type Options struct {
	FallbackDNSResolver string
	TTL                 uint32
	IPsV4               []string
	IPsV6               []string
	Rebind              *Rebind
	Text                []string
	MX                  string
	Logger              golog.Logger
}

type Rebind

type Rebind struct {
	// contains filtered or unexported fields
}

func NewRebind

func NewRebind(rebindV4, rebindV6 string, threshold int) (*Rebind, error)

func (*Rebind) IPV4

func (r *Rebind) IPV4() net.IP

func (*Rebind) IPV6

func (r *Rebind) IPV6() net.IP

func (*Rebind) Inc

func (r *Rebind) Inc(domain string)

func (*Rebind) IsV4Activ

func (r *Rebind) IsV4Activ(domain string) bool

func (*Rebind) IsV6Activ

func (r *Rebind) IsV6Activ(domain string) bool

type RoundRobin

type RoundRobin interface {
	Next() net.IP
	HasEntries() bool
}

func NewRoundRobin

func NewRoundRobin(ips ...string) RoundRobin

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL