dnsblast

package
v0.0.0-...-b89fbfb Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: MIT Imports: 15 Imported by: 0

README

DNS Blast

An adoption of DNS Stress tool to validate the DNS server throughput. Original source codes: https://github.com/sandeeprenjith/dnsblast.

Heavily relies on the idea of Distinct Heavy Hitter attack:

Sends DNS queries with QType set to 'A'.

Job parameters

  • root_domain - Root domain to use which will be queried for nameservers
  • protocol - DNS net. protocol (udp as default, [udp, tcp, tcp-tls] supported)
  • seed_domains - Domain names to use as base of DNS query (no default, at least one required, like yahoo.com)
  • parallel_queries - Number of DNS queries to send between delays
  • interval_ms - (inherited) delay in MS between query loop iteration

A note from the Author

Use only to test your own services, do not abuse services that you do not own!

Research references:

Documentation

Overview

Package dnsblast [DNS Distinct Heavy Hitter, refer to the scientific article https://faculty.idc.ac.il/bremler/Papers/HotWeb_18.pdf]

Index

Constants

View Source
const (
	DefaultDNSPort        = 53
	DefaultDNSOverTLSPort = 853

	UDPProtoName    = "udp"
	TCPProtoName    = "tcp"
	TCPTLSProtoName = "tcp-tls"
)

Useful contants

Variables

This section is empty.

Functions

func Start

func Start(ctx context.Context, logger *zap.Logger, wg *sync.WaitGroup, config *Config) error

Start starts the job based on provided configuration

Types

type Config

type Config struct {
	RootDomain      string
	Protocol        string        // "udp", "tcp", "tcp-tls"
	SeedDomains     []string      // Used to generate domain names using the Distinct Heavy Hitter algorithm
	Delay           time.Duration // The delay between two packets to send
	ParallelQueries int
	ClientID        string
}

Config contains all the necessary configuration for dns-blast

type DNSBlaster

type DNSBlaster struct{}

DNSBlaster is a main worker struct for the package

func NewDNSBlaster

func NewDNSBlaster() *DNSBlaster

NewDNSBlaster returns properly initialized blaster instance

func (*DNSBlaster) ExecuteStressTest

func (rcv *DNSBlaster) ExecuteStressTest(ctx context.Context, logger *zap.Logger, nameserver string, parameters *StressTestParameters, clientID string) error

ExecuteStressTest executes a stress test based on parameters

func (*DNSBlaster) SimpleQuery

func (rcv *DNSBlaster) SimpleQuery(sharedDNSClient *dns.Client, parameters *QueryParameters) *Response

SimpleQuery performs a simple dns query based on parameters

func (*DNSBlaster) SimpleQueryWithNoResponse

func (rcv *DNSBlaster) SimpleQueryWithNoResponse(logger *zap.Logger, sharedDNSClient *dns.Client, parameters *QueryParameters, clientID string)

SimpleQueryWithNoResponse is like SimpleQuery but with optimizations enabled by not needing a response

type DistinctHeavyHitterGenerator

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

DistinctHeavyHitterGenerator creates an endless stream of fake domain names using the random subdomain.

func NewDistinctHeavyHitterGenerator

func NewDistinctHeavyHitterGenerator(ctx context.Context, seedDomains []string) (*DistinctHeavyHitterGenerator, error)

NewDistinctHeavyHitterGenerator creates an endless stream of fake domain names using the random subdomain.

func (*DistinctHeavyHitterGenerator) Cancel

func (rcv *DistinctHeavyHitterGenerator) Cancel()

Cancel allows to cancel execution prematurely

func (*DistinctHeavyHitterGenerator) Next

func (rcv *DistinctHeavyHitterGenerator) Next() chan string

Next is here for iteration purposes

type QueryParameters

type QueryParameters struct {
	HostAndPort string
	QName       string
	QType       uint16
}

QueryParameters contains parameters of a single dns query

type Response

type Response struct {
	WithErr bool
	Err     error
	Latency time.Duration
}

Response is a dns response struct

type StressTestParameters

type StressTestParameters struct {
	Delay           time.Duration
	ParallelQueries int
	Protocol        string
	SeedDomains     []string
}

StressTestParameters contains parameters for a single stress test

Directories

Path Synopsis
Package qry [general utility functions for the dnsblast package]
Package qry [general utility functions for the dnsblast package]

Jump to

Keyboard shortcuts

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