brute

package module
v0.0.0-...-f853d0f Latest Latest
Warning

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

Go to latest
Published: May 15, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

README

brute

Go Report Card Documentation

Package brute allows concurrently bruteforce subdomains for a domain using a list of DNS servers and querying a desired DNS record.

Install

go get -u github.com/jimen0/brute

Usage

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/jimen0/brute"
)

func main() {
	f, err := os.Open("/home/jimeno/top100.txt")
	if err != nil {
		log.Fatalf("could not open file: %v", err)
	}
	defer f.Close()

	out := make(chan string)
	done := make(chan struct{})
	go func() {
		for v := range out {
			fmt.Printf("%s\n", v)
		}
		done <- struct{}{}
	}()

	br := brute.Bruter{
		Domain:  "yahoo.com",
		Retries: 1,
		Record:  "A",
		Servers: []string{"1.1.1.1:53", "8.8.8.8:53", "1.0.0.1:53", "8.8.4.4:53"},
		Workers: 10, // increment this value to use more goroutines
	}
	err = br.Brute(context.Background(), f, out)
	if err != nil {
		log.Printf("failed to brute: %v", err)
	}
	<-done
}

Test

Just run go test -race -v github.com/jimen0/brute/...

Improvements

Send a PR or open an issue. Just make sure that your PR passes gofmt, golint and govet.

Documentation

Overview

Package brute allows concurrently bruteforce subdomains for a domain using a list of DNS servers and querying a desired DNS record.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsWildcard

func IsWildcard(ctx context.Context, d string, srv string) bool

IsWildcard checks wheter a domain supports wildcard subdomains or not.

Types

type Bruter

type Bruter struct {
	// Domain is the DNS name for which subdomains are bruteforced.
	Domain string
	// Record is the DNS record that is queried.
	Record string
	// Retries is the number of retries done for each subdomain resolution.
	Retries int
	// Servers is the list of DNS servers that are used.
	Servers []string
	// Workers represents the number of concurrent resolutions that are done.
	Workers int
}

Bruter represents the bruteforcing configuration.

func (Bruter) Brute

func (b Bruter) Brute(ctx context.Context, r io.Reader, out chan<- string) error

Brute bruteforces subdomains for a given domain using subdomain names readed from r.

Jump to

Keyboard shortcuts

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