sdk

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

README

go-sdk

A dead simple SDK for Go language.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	API_PATH      = "https://elmasy.com/api"
	USER_AGENT    = "Elmasy-SDK"
	DefaultClient = &http.Client{}
)

Functions

func DNSLookup

func DNSLookup(t, n string) ([]string, error)

func Get

func Get(endpoint string) ([]byte, int, error)

Get query API_PATH + endpoint. Returns the body, the status code and error.

func GetIP

func GetIP() (string, error)

func GetRandomIP

func GetRandomIP(version string) (string, error)

func GetRandomPort

func GetRandomPort() (string, error)

func PortScan

func PortScan(technique, ip, ports, timeout string) (string, error)

func Probe

func Probe(protocol, network, ip, port string) (bool, error)

Types

type Additional

type Additional struct {
	CommonName         string `json:"commonName"`
	Hash               string `json:"hash"`
	NotAfter           string `json:"notAfter"`
	Issuer             string `json:"issuer"`
	PublicKey          PubKey `json:"publicKey"`
	SignatureAlgorithm string `json:"signatureAlgorithm"`
}

Additional is the additional certificates (eg.: intermediate cert)

type Cert

type Cert struct {
	CommonName         string       `json:"commonName"`
	Hash               string       `json:"hash"` // SHA256
	AlternativeNames   []string     `json:"alternativeNames"`
	SignatureAlgorithm string       `json:"signatureAlgorithm"`
	PublicKey          PubKey       `json:"publicKey"`
	SerialNumber       string       `json:"serialNumber"`
	Issuer             string       `json:"issuer"`
	NotBefore          string       `json:"notBefore"`
	NotAfter           string       `json:"notAfter"`
	Verified           bool         `json:"verified"`
	VerifiedError      string       `json:"verifiedError"`
	Chain              []Additional `json:"chain"`
}

Cert is hold the fields "interesting" part of the certficate chain.

func GetCertificate

func GetCertificate(network, ip, port, servername string) (Cert, error)

type Cipher

type Cipher struct {
	Name     string `json:"name"`
	Security string `json:"security"`
}

type Error

type Error struct {
	Err string `json:"error"`
}

func (Error) Error

func (e Error) Error() string

type PubKey

type PubKey struct {
	Algo     string `json:"algo"`
	Size     int    `json:"size"` // Bits
	Key      string `json:"key"`
	Exponent int    `json:"exponent"`
	Modulus  string `json:"modulus"`
}

type Result

type Result struct {
	Domain  string   `json:"domain"`
	Targets []Target `json:"targets"`
	Errors  []string `json:"errors"`
}

func Scan

func Scan(target, port, network string) (Result, error)

type ResultBool

type ResultBool struct {
	Result bool `json:"result"`
}

type ResultStr

type ResultStr struct {
	Result string `json:"result"`
}

type ResultStrs

type ResultStrs struct {
	Results []string `json:"results"`
}

type TLS

type TLS struct {
	Versions []TLSVersion `json:"version"`
	Cert     Cert         `json:"cert"`
}

type TLSVersion

type TLSVersion struct {
	Version   string   `json:"version"`
	Supported bool     `json:"supported"`
	Ciphers   []Cipher `json:"ciphers"`
}

func AnalyzeTLS

func AnalyzeTLS(version, network, ip, port, servername string) (TLSVersion, error)

type Target

type Target struct {
	IP  string `json:"ip"`
	TLS TLS    `json:"tls"`
}

Jump to

Keyboard shortcuts

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