client

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const CONFIG_FILE = "credentials.toml"
View Source
const CONFIG_PATH = ".config/oprand/"

Variables

This section is empty.

Functions

func GetResultQueryUsage

func GetResultQueryUsage() string

GetResultQueryUsage generates the text describing the `results` command usage.

Types

type ApiDomainsResponse

type ApiDomainsResponse struct {
	Results []Domains       `json:"results"`
	Meta    ApiMetaResponse `json:"meta"`
}

type ApiMetaResponse

type ApiMetaResponse struct {
	Total *int
	Error *string
}

ApiMetaResponse is common to all API responses

type ApiResultsResponse

type ApiResultsResponse struct {
	Results []ScanResult    `json:"results"`
	Meta    ApiMetaResponse `json:"meta"`
}

type Credentials

type Credentials struct {
	Apikey    string `toml:"apikey"`
	Apisecret string `toml:"apisecret"`
}

type Domains

type Domains struct {
	Domain   string `json:"domain"`
	IsActive bool   `json:"is_active"`
}

type OprClient

type OprClient struct {
	AllowedResultsKeywords []string
	// contains filtered or unexported fields
}

func New

func New(params OprClientParams) *OprClient

func (*OprClient) DoRequest

func (c *OprClient) DoRequest(req *http.Request) (*[]byte, error)

DoRequest sends the `req` HTTP network request.

func (*OprClient) FetchDomains

func (op *OprClient) FetchDomains(c *cli.Context) error

FetchDomains does an authenticated network request to fetch the domains registered under the user's account.

func (*OprClient) FetchResults

func (op *OprClient) FetchResults(c *urfavcli.Context, domain string) error

FetchResults does an authenticated network request to fetch the scan results for a given domain.

func (*OprClient) GetAsn

func (opr *OprClient) GetAsn(input ...string) (*asn.AsnResponse, error)

GetAsn connects to the oprand.com/asn API to return the ASN data related to the inputs given.

func (*OprClient) NewRequest

func (c *OprClient) NewRequest(method string, resource string, qs *url.Values, headers map[string]string) (*http.Request, error)

NewRequest forges a new HTTP requests, with authentication signature if required

func (*OprClient) SetupConfig

func (op *OprClient) SetupConfig() error

SetupConfig lets user input their API crendetials and saves them in a file. This credential file will be read when needed to authenticate network requests.

func (*OprClient) WithBaseUrl

func (c *OprClient) WithBaseUrl(url string)

type OprClientParams

type OprClientParams struct {
	HttpClient *http.Client
	NeedAuth   bool
}

type ScanResult

type ScanResult struct {
	Domain                    string     `json:"domain"`
	Fuzzer                    string     `json:"fuzzer"`
	FuzzedDomain              string     `json:"fuzzed_domain"`
	FuzzedDomainUnicode       string     `json:"fuzzed_domain_unicode"`
	ScannedAt                 time.Time  `json:"scanned_at"`
	DnsA                      []string   `json:"dns_a"`
	DnsAAAA                   []string   `json:"dns_aaaa"`
	DnsTXT                    []string   `json:"dns_txt"`
	DnsMX                     []string   `json:"dns_mx"`
	DnsNS                     []string   `json:"dns_ns"`
	DnsCNAME                  []string   `json:"dns_cname"`
	DnsSPF                    *string    `json:"dns_spf"`
	DnsDMARC                  *string    `json:"dns_dmarc"`
	DnsDKIM                   *string    `json:"dns_dkim"`
	DnsBIMI                   *string    `json:"-"`
	WhoisRegisteredAt         *string    `json:"whois_created"`
	WhoisUpdatedAt            *string    `json:"whois_updated"`
	WhoisExpiringAt           *string    `json:"whois_expiring"`
	WhoisAbuseEmail           *string    `json:"whois_abuse_email"`
	WhoisAbusePhone           *string    `json:"whois_abuse_phone"`
	WhoisRegistrarName        *string    `json:"whois_registrar"`
	WhoisRegistrarIanaId      *string    `json:"whois_registrar_iana_id"`
	WhoisRegistrantName       *string    `json:"whois_registrant_name"`
	WhoisRegistrantId         *string    `json:"whois_registrant_id"`
	WhoisRegistrantAddress    *string    `json:"whois_registrant_address"`
	WhoisRegistrantEmail      *string    `json:"whois_registrant_email"`
	WhoisRegistrantCountry    *string    `json:"whois_registrant_country"`
	WebHasHttpServer          bool       `json:"web_has_http_server"`
	WebStartUrl               *string    `json:"web_start_url"`
	WebEndUrl                 *string    `json:"web_end_url"`
	WebRedirectToDomain       bool       `json:"web_redirect_to_domain"`
	WebPageContainsDomain     bool       `json:"web_page_contains_domain"`
	WebPageContainsBrandName  bool       `json:"web_page_contains_brand_name"`
	WebHasCredentialHarvester bool       `json:"web_has_credential_harvester"`
	WebHttpStatusCode         *int       `json:"web_http_status_code"`
	WebHtmlTitle              *string    `json:"web_html_title"`
	WebBannerHttp             *string    `json:"banner_http"`
	WebLang                   *string    `json:"web_lang"`
	SslIssuerOrg              *string    `json:"ssl_issuer_org"`
	SslIssuerCountry          *string    `json:"ssl_issuer_country"`
	SslIssuerAddr             *string    `json:"ssl_issuer_addr"`
	SslIssuerCommonName       *string    `json:"ssl_issuer_common_name"`
	SslIssuerRfc2253Name      *string    `json:"ssl_issuer_rfc_2253_name"`
	SslSubjectRfc2253Name     *string    `json:"ssl_subject_rfc_2253_name"`
	SslCertNotBefore          *time.Time `json:"ssl_cert_not_before"`
	SslCertNotAfter           *time.Time `json:"ssl_cert_not_after"`
	SslCertSig                *string    `json:"ssl_cert_sig"`
	SslCertSigAlg             *string    `json:"ssl_cert_sig_alg"`
	// Expanded scan results info for human-friendly format
	WhoisRegistrarAnyInfo  bool
	WhoisRegistrantAnyInfo bool
	AbuseInfoAny           bool
	SslIsCertValid         bool
	SslAnyInfo             bool
	WhoisRegisteredAtSince string
	WhoisUpdatedAtSince    string
	WhoisExpiringAtSince   string
	ScannedAtSince         string
}

Jump to

Keyboard shortcuts

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