core

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UserAgent is the default user agent used by Amass during HTTP requests.
	UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"

	// Accept is the default HTTP Accept header value used by Amass.
	Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"

	// AcceptLang is the default HTTP Accept-Language header value used by Amass.
	AcceptLang = "en-US,en;q=0.8"

	SUBRE = "(([a-zA-Z0-9]{1}|[_a-zA-Z0-9]{1}[_a-zA-Z0-9-]{0,61}[a-zA-Z0-9]{1})[.]{1})+"
)
View Source
const IPv4RE = "((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[.]){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"

IPv4RE is a regular expression that will match an IPv4 address.

View Source
const ReservedCIDRDescription = "Reserved Network Address Blocks"

ReservedCIDRDescription is the description used for reserved address ranges.

View Source
const Version = "0.7"

Variables

View Source
var AsnResults []RecvResult
View Source
var DefaultSubdomain = []string{} /* 103750 elements not displayed */
View Source
var FaildIndex uint64 = 0
View Source
var RecvIndex uint64 = 0
View Source
var ReservedCIDRs = []string{
	"192.168.0.0/16",
	"172.16.0.0/12",
	"10.0.0.0/8",
	"127.0.0.0/8",
	"224.0.0.0/4",
	"240.0.0.0/4",
	"100.64.0.0/10",
	"198.18.0.0/15",
	"169.254.0.0/16",
	"192.88.99.0/24",
	"192.0.0.0/24",
	"192.0.2.0/24",
	"192.94.77.0/24",
	"192.94.78.0/24",
	"192.52.193.0/24",
	"192.12.109.0/24",
	"192.31.196.0/24",
	"192.0.0.0/29",
}

ReservedCIDRs includes all the networks that are reserved for special use.

View Source
var SentIndex uint64 = 0
View Source
var SubNext = []string{} /* 3827 elements not displayed */
View Source
var SuccessIndex uint64 = 0

Functions

func AllHosts

func AllHosts(cidr *net.IPNet) []net.IP

AllHosts returns a slice containing all the IP addresses within the CIDR provided by the parameter. This implementation was obtained/modified from the following: https://gist.github.com/kotakanbe/d3059af990252ba89a82

func AnySubdomainRegex

func AnySubdomainRegex() *regexp.Regexp

AnySubdomainRegex returns a Regexp object initialized to match any DNS subdomain name.

func AnySubdomainRegexString

func AnySubdomainRegexString() string

AnySubdomainRegexString returns a regular expression string to match any DNS subdomain name.

func CIDRSubset

func CIDRSubset(cidr *net.IPNet, addr string, num int) []net.IP

CIDRSubset returns a subset of the IP addresses contained within the cidr parameter with num elements around the addr element.

func FileExists

func FileExists(path string) bool

func FilterWildCard

func FilterWildCard(filename string) []string

func FirstLast

func FirstLast(cidr *net.IPNet) (net.IP, net.IP)

FirstLast return the first and last IP address of the provided CIDR/netblock.

func GenerateFlagIndexFromMap

func GenerateFlagIndexFromMap(index uint32) (uint16, uint16)

func GenerateMapIndex

func GenerateMapIndex(flagid2 uint16, index uint16) int

func GetDefaultSubNextData

func GetDefaultSubNextData() []string

func GetGateMacAddress

func GetGateMacAddress(dvice string) [2]net.HardwareAddr

func GetIpv4Devices

func GetIpv4Devices() (keys []string, data map[string]net.IP)

func GetSubdomainData

func GetSubdomainData() string

func GetWindowWith

func GetWindowWith() int

func IPDec

func IPDec(ip net.IP)

IPDec decrements the IP address provided.

func IPInc

func IPInc(ip net.IP)

IPInc increments the IP address provided.

func IsContain

func IsContain(items []string, item string) bool

func IsIPv4

func IsIPv4(ip net.IP) bool

IsIPv4 returns true when the provided net.IP address is an IPv4 address.

func IsIPv6

func IsIPv6(ip net.IP) bool

IsIPv6 returns true when the provided net.IP address is an IPv6 address.

func IsReservedAddress

func IsReservedAddress(addr string) (bool, string)

IsReservedAddress checks if the addr parameter is within one of the address ranges in the ReservedCIDRs slice.

func IsWildCard

func IsWildCard(domain string) bool

func LinesInFile

func LinesInFile(fileName string) ([]string, error)

func OutputExcel

func OutputExcel(filename string)

func PrintStatus

func PrintStatus()

func RandInt64

func RandInt64(min, max int64) int64

func RandomStr

func RandomStr(n int) string

func Range2CIDR

func Range2CIDR(first, last net.IP) *net.IPNet

Range2CIDR turns an IP range into a CIDR.

func RangeHosts

func RangeHosts(start, end net.IP) []net.IP

RangeHosts returns all the IP addresses (inclusive) between the start and stop addresses provided by the parameters.

func Recv

func Recv(device string, options *Options, flagID uint16, retryChan chan RetryStruct, domainChan chan string)

func RequestWebPage

func RequestWebPage(urlstring string, body io.Reader, hvals map[string]string, uid, secret string) (string, error)

func ShowBanner

func ShowBanner()

func Start

func Start(options *Options, domainChan chan string)

func SubdomainRegex

func SubdomainRegex(domain string) *regexp.Regexp

func SubdomainRegexString

func SubdomainRegexString(domain string) string

SubdomainRegexString returns a regular expression string that matchs subdomain names ending with the domain provided by the parameter.

func Summary

func Summary()

Types

type AsnStruct

type AsnStruct struct {
	ASN      int
	Registry string
	Cidr     *net.IPNet
}

ASN数据结构

func GetAsnData

func GetAsnData() []AsnStruct

type EthTable

type EthTable struct {
	SrcIp  net.IP
	Device string
	SrcMac net.HardwareAddr
	DstMac net.HardwareAddr
}

func AutoGetDevices

func AutoGetDevices() EthTable

func GetDevices

func GetDevices(options *Options) EthTable

type LocalRetryStruct

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

type LocalStruct

type LocalStruct struct {
	// contains filtered or unexported fields
}
var LocalStauts LocalStruct

func NewLocalStruct

func NewLocalStruct() *LocalStruct

Create a new stack

func (*LocalStruct) Append

func (this *LocalStruct) Append(node *StatusTable, index uint32)

func (*LocalStruct) Empty

func (this *LocalStruct) Empty() bool

func (*LocalStruct) GetTimeoutData

func (this *LocalStruct) GetTimeoutData(max int) []LocalRetryStruct

从链表中取出超时的数据,可选每次取出最多多少数据

func (*LocalStruct) Len

func (this *LocalStruct) Len() int

Return the number of items in the stack

func (*LocalStruct) SearchFromIndexAndDelete

func (this *LocalStruct) SearchFromIndexAndDelete(index uint32) (LocalRetryStruct, error)

搜索并删除节点

type Options

type Options struct {
	Rate            int64
	Domain          []string
	FileName        string
	Resolvers       []string
	Output          string
	OutputCSV       bool
	Test            bool
	NetworkId       int
	ListNetwork     bool
	Silent          bool
	TTL             bool
	Verify          bool
	Stdin           bool
	Debug           bool
	DomainLevel     int
	SkipWildCard    bool
	Summary         bool
	API             bool
	FULL            bool
	SubNameFileName string // 三级域名字典文件
	FilterWildCard  bool   // 过滤泛解析结果
	CheckOrigin     bool   // 会从返回包检查DNS是否为设定的,防止其他包的干扰
}

func ParseOptions

func ParseOptions() *Options

ParseOptions parses the command line flags provided by a user

type Pair

type Pair struct {
	Key   string
	Value int
}

type PairList

type PairList []Pair

func (PairList) Len

func (p PairList) Len() int

func (PairList) Less

func (p PairList) Less(i, j int) bool

func (PairList) Swap

func (p PairList) Swap(i, j int)

type RecvResult

type RecvResult struct {
	Subdomain string
	Answers   []layers.DNSResourceRecord
}

接收结果数据结构

type RetryStruct

type RetryStruct struct {
	Domain      string
	Dns         string
	SrcPort     uint16
	FlagId      uint16
	DomainLevel int
}

重发状态数据结构

type Script

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

func (*Script) Close

func (s *Script) Close()

func (*Script) Scan

func (s *Script) Scan(domain string) []string

func (*Script) ScriptName

func (s *Script) ScriptName() (string, error)

Acquires the script name of the script by accessing the global variable.

type SendDog

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

func (*SendDog) BuildStatusTable

func (d *SendDog) BuildStatusTable(domain string, dns string, domainlevel int) (uint16, uint16)

func (*SendDog) ChoseDns

func (d *SendDog) ChoseDns() string

func (*SendDog) Close

func (d *SendDog) Close()

func (*SendDog) Init

func (d *SendDog) Init(ether EthTable, dns []string, flagID uint16, printStatus bool)

func (*SendDog) Lock

func (d *SendDog) Lock()

func (*SendDog) Send

func (d *SendDog) Send(domain string, dnsname string, srcport uint16, flagid uint16)

func (*SendDog) UnLock

func (d *SendDog) UnLock()

type Source

type Source struct {
	Names   []string
	Domains map[string]void
	// contains filtered or unexported fields
}

func (*Source) Feed

func (s *Source) Feed(domain string)

func (*Source) Init

func (s *Source) Init()

func (*Source) Scan

func (s *Source) Scan(sc Script, domain string)

func (*Source) Wait

func (s *Source) Wait()

type Stack

type Stack struct {
	// contains filtered or unexported fields
}
var LocalStack *Stack

func GetWaitChain

func GetWaitChain() *Stack

func NewStack

func NewStack() *Stack

Create a new stack

func (*Stack) Empty

func (this *Stack) Empty() bool

func (*Stack) Len

func (this *Stack) Len() int

Return the number of items in the stack

func (*Stack) Pop

func (this *Stack) Pop() (uint32, error)

Pop the top item of the stack and return it

func (*Stack) Push

func (this *Stack) Push(value uint32)

Push a value onto the top of the stack

type StatusTable

type StatusTable struct {
	Domain      string // 查询域名
	Dns         string // 查询dns
	Time        int64  // 发送时间
	Retry       int    // 重试次数
	DomainLevel int    // 域名层级
}

本地状态表

Jump to

Keyboard shortcuts

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