Skip to content

indented-automation/Indented.Net.Dns

Repository files navigation

Indented.Net.Dns

Build status

PowerShell based DNS client providing similar functionality to Resolve-DnsName, nslookup, and dig.

Supports all known record types.

Installation

Indented.Net.Dns can be installed from the PowerShell gallery.

Install-Module Indented.Net.Dns

Indented.Net.Dns is compatible with PowerShell 5, 6 and 7 and has been tested on Windows and CentOS.

Commands

Indented.Net.Dns provides a number of commands to execute DNS queries against name servers.

Get-Dns

Get-Dns [[-Name] <String>]
        [[-RecordType] <RecordType>]
        [-RecordClass <RecordClass>]
        [-NoRecursion]
        [-DnsSec]
        [-EDns]
        [-EDnsBufferSize <UInt16>]
        [-NoTcpFallback]
        [-SearchList <String[]>]
        [-Tcp]
        [-Port <UInt16>]
        [-Timeout <Byte>]
        [-IPv6]
        [-ComputerName <String>]
        [-DnsDebug]

Get-DnsVersion

Short-cut to execute a query for bind.version.

Get-DnsVersion [-Tcp]
               [[-Port] <UInt16>]
               [-IPv6]
               [[-ComputerName] <String>]

Equivalent to:

Get-Dns -Name bind.version. -RecordType TXT -RecordClass CH

Get-DnsZoneTransfer

Get-DnsZoneTransfer [-ZoneName] <String>
                    [-SerialNumber <UInt32>]
                    [-Port <UInt16>]
                    [-Timeout <Byte>]
                    [-IPv6]
                    [-ComputerName <String>]

Search-Dns

Uses Get-Dns to search the authoritative name servers of a zone for a specific record.

Search-Dns [-Name] <String>
           [-ZoneName] <String>
           [[-RecordType] <RecordType>]
           [-Tcp]
           [-Port <UInt16>]
           [-IPv6]
           [-ComputerName <String>]

Trace-Dns

Performs an iterative search for a record from either root hints of a specified DNS server.

Trace-Dns [-Name] <String>
          [-ZoneName] <String>
          [[-RecordType] <RecordType>]
          [-Tcp]
          [-Port <UInt16>]
          [-IPv6]
          [-ComputerName <String>]

Classes

The classes within this module are accessible by using the module.

using module Indented.Net.Dns

This module contains a large number of classes. Notable classes are shown below.

DnsMessage

Describes a DNS message to send or receive.

Constructors

DnsMessage new()
DnsMessage new(String name, RecordType recordType)
DnsMessage new(String name, RecordType recordType, RecordClass recordClass)
DnsMessage new(String name, RecordType recordType, RecordClass recordClass)
DnsMessage new(String name, RecordType recordType, RecordClass recordClass, UInt32 serial)
DnsMessage new(Byte[] bytes)

Methods

void SetEDnsBufferSize()
void SetEDnsBufferSize(UInt16 size)
void SetAcceptDnsSec()
void DisableRecursion()

DnsClient

The DnsClient class uses TCP and UDP sockets to communicate with a remote DNS server.

Constructors

DnsClient new()
DnsClient new(Boolean useTcp, Boolean useIPv6)
DnsClient new(Boolean useTcp, Boolean useIPv6, Int32 receiveTimeout, Int32 sendTimeout)

Methods

void SendQuestion(DnsMessage message, IPAddress ipAddress)
void SendQuestion(DnsMessage message, IPAddress ipAddress, UInt16 port)
DnsMessage ReceiveAnswer()
Byte[] ReceiveBytes()
void Close()

About

PowerShell based DNS client

Resources

License

Stars

Watchers

Forks

Packages

No packages published