Giter Club home page Giter Club logo

dnsgrab's Introduction

Go version Contribute

dnsgrab

This is a simple Go library and CLI tool that allows you to retrieve DNS servers from one or multiple hosts. When querying domains, the library incorporates a curated list of public resolvers from the publicresolvers library, expanding the available options for DNS resolution alongside the ability to provide your own custom resolvers using appropriate flags.

Installation

Go

go install github.com/root4loot/dnsgrab/cmd/dnsgrab@latest

Docker

git clone https://github.com/root4loot/dnsgrab.git && cd dnsgrab
docker build -t dnsgrab .
docker run -it dnsgrab -h

Usage

Usage: ./dnsgrab [options] (-h <host>|-i hosts.txt)

TARGETTING:
   -h,   --host          target host (comma separated)
   -i,   --infile        file containing hosts (newline separated)

CONFIGURATIONS:
   -r,  --resolvers      file containing list of resolvers   
   -c,  --concurrency    number of concurrent requests       (Default: 10 requests)
   -t,  --timeout        max request timeout                 (Default: 3 seconds)
   -d,  --delay          delay between requests              (Default: 0 milliseconds)
   -dj, --delay-jitter   max jitter between requests         (Default: 0 milliseconds)

OUTPUT:
   -o,  --outfile        output results to given file
   -s,  --silence        silence everything
   -v,  --verbose        verbose output
        --version        display version

Examples

$ dnsgrab -h hackerone.com
104.16.99.52:53
$ dnsgrab -i hosts.txt
104.16.62.39:53
104.17.206.78:53
104.18.69.91:53
104.18.110.82:53
104.18.107.24:53
104.17.70.206:53
104.16.99.52:53
104.18.70.91:53
35.166.157.178:53
35.166.157.178:53
104.17.73.206:53
10.13.22.219:53

Library

go get -u github.com/root4loot/dnsgrab
package main

import (
	"fmt"

	"github.com/root4loot/dnsgrab"
)

func main() {
	single()
	multiple()
	multipleStream()
}

func single() {
	fmt.Println("Running against single host")
	result := dnsgrab.Single("hackerone.com")
	fmt.Println("Query host", result.RequestedHost, "Resolver Address", result.ResolverAddress)
}

func multiple() {
	fmt.Println("Running against multiple hosts")
	results := dnsgrab.Multiple([]string{"hackerone.com", "bugcrowd.com", "intigriti.com"})
	for _, result := range results {
		fmt.Println("Query host", result.RequestedHost, "Resolver Address", result.ResolverAddress)
	}
}

func multipleStream() {
	fmt.Println("Running against multiple hosts (async)")
	targets := []string{"hackerone.com", "bugcasdasdrowd.com", "intigriti.com"}

	// initialize runner
	dnsgrab := dnsgrab.NewRunner()

	// OPTIONAL: set options
	// dnsgrab.Options.Resolvers = []string{""}
	// dnsgrab.Options.Concurrency = 0
	// dnsgrab.Options.Timeout = 0
	// dnsgrab.Options.Delay = 0
	// dnsgrab.Options.DelayJitter = 0
	dnsgrab.Options.Verbose = true

	// process results
	go func() {
		for result := range dnsgrab.Results {
			fmt.Println("Query host", result.RequestedHost, "Resolver Address", result.ResolverAddress)
		}
	}()

	// run dnsgrab against targets
	dnsgrab.MultipleStream(targets...)
}

Contributing

See CONTRIBUTING.md

dnsgrab's People

Contributors

root4loot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.