models

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: BSD-2-Clause Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ASNDelegated = []ASNIpDelegate{

	{
		RIRName:     "arin",
		CountryCode: "US",
		Subnet:      "8.8.8.0/24",
		IntIPv4:     134744064,
		Addresses:   256,
		Date:        "20060315",
		ASN:         15169,
		Status:      "allocated",
	},
	{
		RIRName:     "arin",
		CountryCode: "US",
		Subnet:      "54.240.0.0/12",
		IntIPv4:     919076864,
		Addresses:   1048576,
		Date:        "20110505",
		ASN:         16509,
		Status:      "allocated",
	},
}

ASNDelegated contains a list of ASN delegate records for initialization These will be populated by the update_asn.py script in production

View Source
var ASNList = []ASN{

	{
		Number:      15169,
		RIRName:     "arin",
		CountryCode: "US",
		Org:         "Google LLC",
	},
	{
		Number:      16509,
		RIRName:     "arin",
		CountryCode: "US",
		Org:         "Amazon.com, Inc.",
	},
	{
		Number:      8075,
		RIRName:     "arin",
		CountryCode: "US",
		Org:         "Microsoft Corporation",
	},
}

ASNList contains a list of ASN records for initialization These will be populated by the update_asn.py script in production

Functions

func SliceHasResult

func SliceHasResult(s []*Result, r *Result) bool

Types

type ASN added in v0.1.17

type ASN struct {
	Number      int64  `gorm:"primarykey;column:asn" json:"asn"`
	RIRName     string `gorm:"column:rir_name" json:"rir_name"`
	CountryCode string `gorm:"column:country_code" json:"country_code"`
	Org         string `gorm:"column:org" json:"org"`
}

func (*ASN) BeforeCreate added in v0.1.17

func (asn *ASN) BeforeCreate(tx *gorm.DB) (err error)

func (*ASN) TableName added in v0.1.17

func (*ASN) TableName() string

type ASNIpDelegate added in v0.1.17

type ASNIpDelegate struct {
	ID uint `json:"id" gorm:"primarykey"`

	Hash        string `gorm:"column:hash;index:,unique;" json:"hash"`
	RIRName     string `gorm:"column:rir_name" json:"rir_name"`
	CountryCode string `gorm:"column:country_code" json:"country_code"`
	Subnet      string `gorm:"column:subnet" json:"subnet"`
	IntIPv4     int64  `gorm:"column:int_ipv4" json:"int_ipv4"`
	Addresses   int    `gorm:"column:addresses" json:"addresses"`
	Date        string `gorm:"column:date" json:"date"`
	ASN         int64  `gorm:"column:asn" json:"asn"`
	Status      string `gorm:"column:status" json:"status"`
}

func (*ASNIpDelegate) BeforeCreate added in v0.1.17

func (subnet *ASNIpDelegate) BeforeCreate(tx *gorm.DB) (err error)

func (*ASNIpDelegate) TableName added in v0.1.17

func (*ASNIpDelegate) TableName() string

type FQDNData added in v0.1.15

type FQDNData struct {
	ID uint `json:"id" gorm:"primarykey"`

	Hash     string    `gorm:"column:hash;index:,unique;"`
	FQDN     string    `gorm:"column:fqdn"`
	Source   string    `gorm:"column:source"`
	ProbedAt time.Time `gorm:"column:probed_at"`
}

func (*FQDNData) BeforeCreate added in v0.1.15

func (fqdn *FQDNData) BeforeCreate(tx *gorm.DB) (err error)

func (*FQDNData) TableName added in v0.1.15

func (*FQDNData) TableName() string

type Result

type Result struct {
	ID uint `json:"id" gorm:"primarykey"`

	TestId       string    `gorm:"column:test_id"`
	Hash         string    `gorm:"column:hash;index:,unique;"`
	FQDN         string    `gorm:"column:fqdn"`
	RType        string    `gorm:"column:result_type"`
	IPv4         string    `gorm:"column:ipv4"`
	IPv6         string    `gorm:"column:ipv6"`
	ASN          int64     `gorm:"column:asn"`
	Target       string    `gorm:"column:target"`
	Ptr          string    `gorm:"column:ptr"`
	Txt          string    `gorm:"column:txt"`
	CloudProduct string    `gorm:"column:cloud_product"`
	SaaSProduct  string    `gorm:"column:saas_product"`
	Datacenter   string    `gorm:"column:datacenter"`
	ProbedAt     time.Time `gorm:"column:probed_at"`

	DC bool `gorm:"column:dc"`
	GC bool `gorm:"column:gc"`

	Exists bool `gorm:"column:exists"`

	// Failed flag set if the result should be considered failed
	Failed       bool   `gorm:"column:failed;index:idx_exists"`
	FailedReason string `gorm:"column:failed_reason"`
}

Result is a github.com/helviojunior/enumdnsenumdns result

func (*Result) BeforeCreate added in v0.1.15

func (result *Result) BeforeCreate(tx *gorm.DB) (err error)

func (Result) Clone

func (result Result) Clone() *Result

func (Result) Equal added in v0.1.8

func (result Result) Equal(r1 Result) bool

func (Result) FormatSuffix added in v0.1.19

func (result Result) FormatSuffix() string

FormatSuffix formats the cloud/datacenter/DC/GC suffix information

func (Result) FormatValue added in v0.1.19

func (result Result) FormatValue() string

FormatValue extracts just the value part of a result for formatting

func (*Result) GetASN added in v0.1.17

func (result *Result) GetASN(tx *gorm.DB) *ASNIpDelegate

func (Result) GetCompHash added in v0.1.8

func (result Result) GetCompHash() string

func (Result) GetHash added in v0.1.3

func (result Result) GetHash() string

func (Result) MarshalJSON

func (result Result) MarshalJSON() ([]byte, error)

Custom Marshaller for Result

func (Result) String

func (result Result) String() string

func (*Result) TableName added in v0.1.15

func (*Result) TableName() string

func (Result) ToFqdn added in v0.1.15

func (result Result) ToFqdn() *FQDNData

type ThreatResult added in v0.1.19

type ThreatResult struct {
	*Result            // Herda do Result existente
	Technique  string  `gorm:"column:technique" json:"technique"`
	Confidence float64 `gorm:"column:confidence" json:"confidence"`
	Risk       string  `gorm:"column:risk" json:"risk"`
	BaseDomain string  `gorm:"column:base_domain" json:"base_domain"`
	Similarity float64 `gorm:"column:similarity" json:"similarity"`
}

func (*ThreatResult) TableName added in v0.1.19

func (*ThreatResult) TableName() string

Jump to

Keyboard shortcuts

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