nbt

package
v0.0.0-...-e15bfb5 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPendingReplies int = 256
View Source
const MaxProbeResponseTime time.Duration = time.Second * 2

Variables

View Source
var IPv4_Mask_Sizes = []uint32{
	2147483648,
	1073741824,
	536870912,
	268435456,
	134217728,
	67108864,
	33554432,
	16777216,
	8388608,
	4194304,
	2097152,
	1048576,
	524288,
	262144,
	131072,
	65536,
	32768,
	16384,
	8192,
	4096,
	2048,
	1024,
	512,
	256,
	128,
	64,
	32,
	16,
	8,
	4,
	2,
	1,
}
View Source
var IPv4_Masks = map[uint32]uint32{
	1:          32,
	2:          31,
	4:          30,
	8:          29,
	16:         28,
	32:         27,
	64:         26,
	128:        25,
	256:        24,
	512:        23,
	1024:       22,
	2048:       21,
	4096:       20,
	8192:       19,
	16384:      18,
	32768:      17,
	65536:      16,
	131072:     15,
	262144:     14,
	524288:     13,
	1048576:    12,
	2097152:    11,
	4194304:    10,
	8388608:    9,
	16777216:   8,
	33554432:   7,
	67108864:   6,
	134217728:  5,
	268435456:  4,
	536870912:  3,
	1073741824: 2,
	2147483648: 1,
}
View Source
var Match_IPv4 = regexp.MustCompile(`^(?:(?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2}))$`)
View Source
var Match_IPv6 = regexp.MustCompile(`^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?$`)

Functions

func AddressesFromCIDR

func AddressesFromCIDR(cidr string, o chan<- string)

func IPv4Range2CIDRs

func IPv4Range2CIDRs(s_ip string, e_ip string) ([]string, error)

func IPv4UIntRange2CIDRs

func IPv4UIntRange2CIDRs(s_i uint32, e_i uint32) []string

func IPv4_to_UInt

func IPv4_to_UInt(ips string) (uint32, error)

func Info

func Info(target string)

func PrintVersion

func PrintVersion(app string)

func TrimName

func TrimName(name string) string

func UInt_to_IPv4

func UInt_to_IPv4(ipi uint32) string

Types

type NetbiosInfo

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

type NetbiosReplyAddress

type NetbiosReplyAddress struct {
	Flag    uint16
	Address [4]uint8
}

type NetbiosReplyHeader

type NetbiosReplyHeader struct {
	XID             uint16
	Flags           uint16
	QuestionCount   uint16
	AnswerCount     uint16
	AuthCount       uint16
	AdditionalCount uint16
	QuestionName    [34]byte
	RecordType      uint16
	RecordClass     uint16
	RecordTTL       uint32
	RecordLength    uint16
}

type NetbiosReplyName

type NetbiosReplyName struct {
	Name [15]byte
	Type uint8
	Flag uint16
}

type NetbiosReplyStatus

type NetbiosReplyStatus struct {
	Header    NetbiosReplyHeader
	HostName  [15]byte
	UserName  [15]byte
	Names     []NetbiosReplyName
	Addresses []NetbiosReplyAddress
	HWAddr    string
}

type Probe

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

func (*Probe) AddTarget

func (this *Probe) AddTarget(t string)

func (*Probe) CheckRateLimit

func (this *Probe) CheckRateLimit()

func (*Probe) CloseInput

func (this *Probe) CloseInput()

func (*Probe) Initialize

func (this *Probe) Initialize()

func (*Probe) SetLimiter

func (this *Probe) SetLimiter(limiter *rate.Limiter)

func (*Probe) SetOutput

func (this *Probe) SetOutput(c_out chan<- ScanResult)

func (*Probe) Setup

func (this *Probe) Setup()

func (*Probe) String

func (this *Probe) String() string

func (*Probe) Wait

func (this *Probe) Wait()

type ProbeNetbios

type ProbeNetbios struct {
	Probe
	// contains filtered or unexported fields
}

func (*ProbeNetbios) CreateNameRequest

func (this *ProbeNetbios) CreateNameRequest(name string) []byte

func (*ProbeNetbios) CreateStatusRequest

func (this *ProbeNetbios) CreateStatusRequest() []byte

func (*ProbeNetbios) DecodeNetbiosName

func (this *ProbeNetbios) DecodeNetbiosName(name [32]byte) [16]byte

func (*ProbeNetbios) EncodeNetbiosName

func (this *ProbeNetbios) EncodeNetbiosName(name [16]byte) [32]byte

func (*ProbeNetbios) Initialize

func (this *ProbeNetbios) Initialize()

func (*ProbeNetbios) ParseReply

func (this *ProbeNetbios) ParseReply(buff []byte) NetbiosReplyStatus

func (*ProbeNetbios) ProcessReplies

func (this *ProbeNetbios) ProcessReplies()

func (*ProbeNetbios) ReportIncompleteResults

func (this *ProbeNetbios) ReportIncompleteResults()

func (*ProbeNetbios) ReportResult

func (this *ProbeNetbios) ReportResult(ip string)

func (*ProbeNetbios) ResultFromIP

func (this *ProbeNetbios) ResultFromIP(ip string) ScanResult

func (*ProbeNetbios) SendNameRequest

func (this *ProbeNetbios) SendNameRequest(ip string)

func (*ProbeNetbios) SendRequest

func (this *ProbeNetbios) SendRequest(ip string, req []byte)

func (*ProbeNetbios) SendStatusRequest

func (this *ProbeNetbios) SendStatusRequest(ip string)

type Prober

type Prober interface {
	Setup()
	Initialize()
	Wait()
	AddTarget(string)
	CloseInput()
	SetOutput(chan<- ScanResult)
	CheckRateLimit()
	SetLimiter(*rate.Limiter)
}

type ScanResult

type ScanResult struct {
	Host  string            `json:"host"`
	Port  string            `json:"port,omitempty"`
	Proto string            `json:"proto,omitempty"`
	Probe string            `json:"probe,omitempty"`
	Name  string            `json:"name,omitempty"`
	Nets  []string          `json:"nets,omitempty"`
	Info  map[string]string `json:"info"`
}

Jump to

Keyboard shortcuts

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