nimbusec

package module
v0.0.0-...-0ff2760 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 10 Imported by: 1

README

Nimbusec API SDK

This repo contains the Golang SDK for communicating with https://api.nimbusec.com/v3.

Documentation for this API can be found at https://openapi.nimbusec.com/security/

Documentation

Index

Constants

View Source
const (
	IssueEventBlacklist  = "blacklist"
	IssueEventDefacement = "defacement"
	IssueEventMalware    = "malware"

	IssueEventCMSVersion    = "cms-version"
	IssueEventCMSVulnerable = "cms-vulnerable"
	IssueEventCMSTampered   = "cms-tampered"

	IssueEventSuspiciousLink     = "suspicious-link"
	IssueEventSuspiciousLinkV2   = "suspicious-link-v2"
	IssueEventSuspiciousRequest  = "suspicious-request"
	IssueEventSuspiciousRedirect = "suspicious-redirect"
	IssueEventParkedDomain       = "parked"

	IssueEventTLSCipherSuite        = "tls-ciphersuite"
	IssueEventTLSProtocol           = "tls-protocol"
	IssueEventTLSExpires            = "tls-expires"
	IssueEventTLSHostnameMismatch   = "tls-hostname"
	IssueEventTLSNoTrust            = "tls-notrust"
	IssueEventTLSSigAlg             = "tls-sigalg"
	IssueEventTLSLegacy             = "tls-legacy"
	IssueEventTLSMisconfiguredChain = "tls-misconfigured-chain"
	IssueEventTLSRevokedCertificate = "tls-revoked-cert"

	IssueEventBaselineEmpty    = "baseline-empty"
	IssueEventContentViolation = "content-violation"
	IssueEventNoHTTPSRedirect  = "no-https-redirect"
	IssueEventSeospam          = "seospam"
	IssueEventWebshell         = "webshell"

	IssueEventHijackResource = "hijack-resource"
	IssueEventHijackLink     = "hijack-link"
	IssueEvent404Link        = "404-link"
	IssueEventTakeoverDNS    = "takeover-dns"
	IssueEventSRIMissing     = "sri-missing"
	IssueEventSRIInvalid     = "sri-invalid"
)
View Source
const (
	ScreenshotCurrent  ScreenshotType = "current"
	ScreenshotPrevious ScreenshotType = "previous"

	RegionEU   Region = "EU"
	RegionUS   Region = "US"
	RegionASIA Region = "ASIA"

	ViewportDesktop Viewport = "desktop"
	ViewportMobile  Viewport = "mobile"
)

Variables

View Source
var DefaultEndpoint = Endpoint{
	AuthURL:   "https://auth.nimbusec.com/oauth2/token",
	ServerURL: "https://api.nimbusec.com",
}

Functions

func UnmarshalDetails

func UnmarshalDetails(event string, details []byte) (interface{}, error)

UnmarshalDetails converts the given details value to the correct details type

Types

type APIToken

type APIToken struct {
	Name        string    `json:"name"`
	Key         TokenID   `json:"key"`
	Secret      string    `json:"secret"`
	Role        Role      `json:"role"`
	LastCall    time.Time `json:"lastCall"`
	LastVersion int       `json:"lastVersion"`
}

type Agent

type Agent struct {
	Os      string `json:"os"`
	Arch    string `json:"arch"`
	Version string `json:"version"`
	Md5     string `json:"md5"`
	Sha1    string `json:"sha1"`
	Format  string `json:"format"`
	URL     string `json:"url"`
}

type ApplicationOutdatedDetails

type ApplicationOutdatedDetails struct {
	Name          string `json:"name"`
	URL           string `json:"url,omitempty"`
	Path          string `json:"path,omitempty"`
	Version       string `json:"version"`
	LatestVersion string `json:"latestVersion"`
}

type ApplicationVulnerableDetails

type ApplicationVulnerableDetails struct {
	Name            string `json:"name"`
	URL             string `json:"url,omitempty"`
	Path            string `json:"path,omitempty"`
	Version         string `json:"version"`
	Vulnerabilities []struct {
		CVE         string  `json:"cve"`
		Score       float64 `json:"score"`
		Description string  `json:"description"`
		Link        string  `json:"link"`
	} `json:"vulnerabilities"`
}

type BaselineDetails

type BaselineDetails struct {
	ClientID string `json:"clientID"`
}

type BlacklistDetails

type BlacklistDetails struct {
	Blacklist    string   `json:"blacklist"`
	BlacklistURL string   `json:"blacklistURL"`
	Reasons      []string `json:"reasons"`
	Profile      string   `json:"profile"`
}

type Bundle

type Bundle struct {
	ID           BundleID `json:"id"`
	Name         string   `json:"name"`
	StartDate    int64    `json:"startDate"`
	EndDate      int64    `json:"endDate"`
	Price        int      `json:"price"`
	Currency     string   `json:"currency"`
	Active       int      `json:"active"`
	Capacity     int      `json:"capacity"`
	ChargingType string   `json:"chargingType"`

	Features struct {
		Defacement struct {
			Available bool `json:"available"`
			Nimbusec  bool `json:"nimbusec"`
			ZoneH     bool `json:"zoneh"`
		} `json:"defacement"`
		UnwantedContent struct {
			Available bool `json:"available"`
		} `json:"unwantedContent"`
		Malware struct {
			Available bool `json:"available"`
			Nimbusec  bool `json:"nimbusec"`
			Ikarus    bool `json:"ikarus"`
			Avira     bool `json:"avira"` // Deprecated. Avira is not used as of 01.03.2022 anymore
			LastLine  bool `json:"lastline"`
			ClamAV    bool `json:"clamav"`
		} `json:"malware"`
		Reputation struct {
			Available bool `json:"available"`
		} `json:"reputation"`
		TLS struct {
			Available bool `json:"available"`
		} `json:"tls"`
		Webshell struct {
			Available bool `json:"available"`
		} `json:"webshell"`
		Application struct {
			Available bool `json:"available"`
		} `json:"application"`
		Scanning struct {
			Available        bool `json:"available"`
			FastScanInterval int  `json:"fastScanInterval"`
			DeepScanInterval int  `json:"deepScanInterval"`
			Quota            int  `json:"quota"`
			FromEU           bool `json:"fromEU"`
			FromUS           bool `json:"fromUS"`
			FromASIA         bool `json:"fromAsia"`
			Mobile           bool `json:"mobile"`
		} `json:"scanning"`
		Notification struct {
			Available   bool `json:"available"`
			EMail       bool `json:"email"`
			TextMessage bool `json:"textMessage"`
		} `json:"notification"`
	} `json:"features"`
}

type BundleID

type BundleID string

type BundleService

type BundleService service

func (*BundleService) Get

func (srv *BundleService) Get(ctx context.Context, id BundleID) (Bundle, error)

func (*BundleService) List

func (srv *BundleService) List(ctx context.Context) ([]Bundle, error)

type CMSTamperedDetails

type CMSTamperedDetails struct {
	Url          string `json:"url"`
	Name         string `json:"name"`
	Path         string `json:"path"`
	Version      string `json:"version"`
	OriginalHash string `json:"originalHash"`
	TamperedHash string `json:"tamperedHash"`
}

type Client

type Client struct {
	Bundles        *BundleService
	Domains        *DomainService
	DomainMetadata *DomainMetadataService
	DomainStats    *DomainStatsService
	Issues         *IssueService
	Notifications  *NotificationService
	Screenshots    *ScreenshotService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, config Config) *Client

func (*Client) Do

func (client *Client) Do(ctx context.Context, method, url string, in, out interface{}) error

func (*Client) Ping

func (client *Client) Ping(ctx context.Context) error

type Config

type Config struct {
	ClientID     string
	ClientSecret string
	Endpoint     Endpoint
}

type ContentViolationDetails

type ContentViolationDetails struct {
	NewHostnames       map[string][]string `json:"newHostnames"`
	NewAResources      map[string]struct{} `json:"newAResources"`
	NewImgResources    map[string]struct{} `json:"newImgResources"`
	NewInputResources  map[string]struct{} `json:"newInputResources"`
	NewButtonResources map[string]struct{} `json:"newButtonResources"`
	NewEventAttributes map[string]struct{} `json:"newEventAttributes"`
	Profile            string              `json:"profile"`
}

type DefacementDetails

type DefacementDetails struct {
	URL     string `json:"url"`
	Threat  string `json:"threat"`
	Profile string `json:"profile"`
}

type Domain

type Domain struct {
	ID          DomainID     `json:"id"`
	Bundle      BundleID     `json:"bundle"`
	Name        string       `json:"name"`
	URL         string       `json:"url"`
	ExternalIDs []ExternalID `json:"externalIds,omitempty"`
}

type DomainApplication

type DomainApplication struct {
	Name       string `json:"name"`
	Version    string `json:"version"`
	Path       string `json:"path"`
	Category   string `json:"category"`
	Source     string `json:"source"`
	Latest     bool   `json:"latest"`
	Vulnerable bool   `json:"vulnerable"`
}

type DomainConfig

type DomainConfig struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type DomainFilter

type DomainFilter struct {
	Name       string `url:"name,omitempty"`
	ExternalID string `url:"externalId,omitempty"`
}

type DomainID

type DomainID int64

type DomainMetadata

type DomainMetadata struct {
	Domain    DomainID          `json:"domain"`
	Redirects []Redirect        `json:"redirects"`
	Headers   map[string]string `json:"headers"`
}

type DomainMetadataService

type DomainMetadataService service

func (*DomainMetadataService) Get

func (*DomainMetadataService) List

type DomainService

type DomainService service

func (*DomainService) Create

func (srv *DomainService) Create(ctx context.Context, create Domain) (Domain, error)

func (*DomainService) Delete

func (srv *DomainService) Delete(ctx context.Context, id DomainID) error

func (*DomainService) Disable

func (srv *DomainService) Disable(ctx context.Context, id DomainID) error

func (*DomainService) DisableBatch

func (srv *DomainService) DisableBatch(ctx context.Context, ids []DomainID) error

func (*DomainService) Get

func (srv *DomainService) Get(ctx context.Context, id DomainID) (Domain, error)

func (*DomainService) List

func (srv *DomainService) List(ctx context.Context, filter *DomainFilter) ([]Domain, error)

func (*DomainService) Update

func (srv *DomainService) Update(ctx context.Context, id DomainID, update Domain) (Domain, error)

type DomainStats

type DomainStats struct {
	Domains     int `json:"domains"`
	Malware     int `json:"malware"`
	Webshell    int `json:"webshell"`
	Application int `json:"application"`
	TLS         int `json:"tls"`
	Reputation  int `json:"reputation"`
	Defacement  int `json:"defacement"`
}

type DomainStatsService

type DomainStatsService service

func (*DomainStatsService) Get

type Endpoint

type Endpoint struct {
	AuthURL   string
	ServerURL string
}

type Error

type Error struct {
	Message    string `json:"message"`
	StatusCode int    `json:"statusCode"`
}

func (Error) Error

func (e Error) Error() string

type ExternalID

type ExternalID struct {
	ExternalID string `json:"externalId"`
	Comment    string `json:"comment"`
}

type HijackDetails

type HijackDetails struct {
	URL        string   `json:"url"`
	Initiators []string `json:"initiators"`
}

type Image

type Image struct {
	Date time.Time `json:"date"`
	MIME string    `json:"mime"`
	URL  string    `json:"url"`
}

type Initiator

type Initiator struct {
	InitType string `json:"type"`
	URL      string `json:"url"`
	Line     string `json:"line"`
	Column   string `json:"column"`
}

Initiator holds all information about the initiator of an request/malware issue

type Issue

type Issue struct {
	ID          IssueID      `json:"id"`
	Domain      DomainID     `json:"domain"`
	Status      IssueStatus  `json:"status"`
	Event       string       `json:"event"`
	Category    string       `json:"category"`
	Severity    int          `json:"severity"`
	FirstSeen   time.Time    `json:"firstSeen"`
	LastSeen    time.Time    `json:"lastSeen"`
	Regions     []string     `json:"regions,omitempty"`
	Viewports   []string     `json:"viewports,omitempty"`
	Details     interface{}  `json:"details,omitempty"`
	ExternalIDs []ExternalID `json:"externalIds,omitempty"`
}

func (*Issue) UnmarshalJSON

func (issue *Issue) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals Issues and attaches the correct Details type instead of the interface{}

type IssueCount

type IssueCount struct {
	Malware     int `json:"malware"`
	Webshell    int `json:"webshell"`
	Application int `json:"application"`
	TLS         int `json:"tls"`
	Reputation  int `json:"reputation"`
	Defacement  int `json:"defacement"`
}

type IssueFilter

type IssueFilter struct {
	Status     IssueStatus `url:"status,omitempty"`
	Severity   int         `url:"severity,omitempty"`
	Event      string      `url:"event,omitempty"`
	Category   string      `url:"category,omitempty"`
	Limit      int         `url:"limit,omitempty"`
	Sort       string      `url:"sort,omitempty"`
	ExternalID string      `url:"externalId,omitempty"`
}

type IssueHistory

type IssueHistory map[string]IssueCount

type IssueID

type IssueID int64

type IssueService

type IssueService service

func (*IssueService) Get

func (srv *IssueService) Get(ctx context.Context, id IssueID) (Issue, error)

func (*IssueService) List

func (srv *IssueService) List(ctx context.Context, filter *IssueFilter) ([]Issue, error)

func (*IssueService) ListByDomain

func (srv *IssueService) ListByDomain(ctx context.Context, id DomainID, filter *IssueFilter) ([]Issue, error)

func (*IssueService) Update

func (srv *IssueService) Update(ctx context.Context, id IssueID, update IssueUpdate) (Issue, error)

type IssueStatus

type IssueStatus string
const (
	IssueStatusPending       IssueStatus = "pending"
	IssueStatusAcknowledged  IssueStatus = "acknowledged"
	IssueStatusIgnored       IssueStatus = "ignored"
	IssueStatusFalsePositive IssueStatus = "falsepositive"
)

type IssueUpdate

type IssueUpdate struct {
	Status      IssueStatus  `json:"status"`
	Comment     string       `json:"comment"`
	ExternalIDs []ExternalID `json:"externalIds"`
}

type IssuesSummary

type IssuesSummary struct {
	Domain DomainID `json:"domain"`

	MalwareSeverity     int `json:"malwareSeverity"`
	WebshellSeverity    int `json:"webshellSeverity"`
	ApplicationSeverity int `json:"applicationSeverity"`
	TLSSeverity         int `json:"tlsSeverity"`
	ReputationSeverity  int `json:"reputationSeverity"`
	DefacementSeverity  int `json:"defacementSeverity"`

	MalwareCount     int `json:"malwareCount"`
	WebShellCount    int `json:"webShellCount"`
	ApplicationCount int `json:"applicationCount"`
	TLSCount         int `json:"tlsCount"`
	ReputationCount  int `json:"reputationCount"`
	DefacementCount  int `json:"defacementCount"`
}

type LastlineDetails

type LastlineDetails struct {
	Score           int `json:"score"`
	AnalysisSubject struct {
		URL     string `json:"url"`
		Referer string `json:"referer"`
	} `json:"analysis_subject"`
	Threat            string   `json:"threat"`
	ThreatClass       string   `json:"threat_class"`
	MaliciousActivity []string `json:"malicious_activity"`
}

type MalwareDetails

type MalwareDetails struct {
	URL        string      `json:"url"`
	Threat     string      `json:"threat"`
	AV         string      `json:"av"`
	Initiators []Initiator `json:"initiators"`
	Profile    string      `json:"profile"`
}

type Notification

type Notification struct {
	ID         NotificationID `json:"id"`
	Domain     DomainID       `json:"domain"`
	User       UserID         `json:"user"`
	Transport  string         `json:"transport"`
	Blacklist  int            `json:"blacklist"`
	Defacement int            `json:"defacement"`
	Malware    int            `json:"malware"`
	Webhook    *string        `json:"webhook,omitempty"`
}

type NotificationID

type NotificationID int64

type NotificationService

type NotificationService service

func (*NotificationService) Create

func (srv *NotificationService) Create(ctx context.Context, create Notification) (Notification, error)

func (*NotificationService) Delete

func (*NotificationService) Get

func (*NotificationService) List

func (*NotificationService) ListByDomain

func (srv *NotificationService) ListByDomain(ctx context.Context, id DomainID) ([]Notification, error)

func (*NotificationService) ListByUser

func (srv *NotificationService) ListByUser(ctx context.Context, id UserID) ([]Notification, error)

func (*NotificationService) Update

type NotificationUpdate

type NotificationUpdate struct {
	Transport  string `json:"transport"`
	Blacklist  int    `json:"blacklist"`
	Defacement int    `json:"defacement"`
	Malware    int    `json:"malware"`
}

type ParkedDomainDetails

type ParkedDomainDetails struct {
	NsMatch       string `json:"nsMatch"`
	WarcMatch     string `json:"warcMatch"`
	FoundByPython bool   `json:"foundByPython"`
}

type Redirect

type Redirect struct {
	URL        string `json:"url"`
	Address    string `json:"address"`
	StatusCode int    `json:"statusCode"`
}

type Region

type Region string

type Role

type Role string
const (
	RoleAgent    Role = "agent"
	RoleReadOnly Role = "readonly"
)

type SRIDetails

type SRIDetails struct {
	Resource      string `json:"resource"`
	IntegrityHash string `json:"integrityHash"`
}

type Screenshot

type Screenshot struct {
	Target   string `json:"target"`
	Previous Image  `json:"previous"`
	Current  Image  `json:"current"`
}

type ScreenshotFilter

type ScreenshotFilter struct {
	Region   Region   `url:"region,omitempty"`
	Viewport Viewport `url:"viewport,omitempty"`
}

type ScreenshotService

type ScreenshotService service

func (*ScreenshotService) GetImage

func (srv *ScreenshotService) GetImage(ctx context.Context, id DomainID, typez ScreenshotType) ([]byte, error)

func (*ScreenshotService) GetScreenshots

func (srv *ScreenshotService) GetScreenshots(ctx context.Context, id DomainID, filter *ScreenshotFilter) (Screenshot, error)

type ScreenshotType

type ScreenshotType string

type SeospamDetails

type SeospamDetails struct {
	Profile         string        `json:"profile"`
	CrawlerResult   SeospamResult `json:"crawlerResult"`
	GooglebotResult SeospamResult `json:"googlebotResult"`
}

type SeospamResult

type SeospamResult struct {
	Title       string `json:"Title"`
	Keywords    string `json:"Keywords"`
	Description string `json:"Description"`
}

type SuspiciousLinkDetails

type SuspiciousLinkDetails struct {
	URL   string `json:"url"`
	Links []struct {
		Link       string             `json:"link"`
		Blacklists []BlacklistDetails `json:"blacklists"`
	} `json:"links"`
}

type SuspiciousRedirectDetails

type SuspiciousRedirectDetails struct {
	Profile              string     `json:"profile"`
	CurrentRedirects     []Redirect `json:"currentRedirects"`
	ValidRedirectDomains []string   `json:"validRedirectDomains"`
}

type SuspiciousRequestDetails

type SuspiciousRequestDetails struct {
	Entity     string             `json:"entity"`
	URLs       []string           `json:"urls"`
	Blacklists []BlacklistDetails `json:"blacklists"`
}

type TLSCertificateDetails

type TLSCertificateDetails struct {
	Order      int      `json:"order"`
	NotAfter   int64    `json:"notAfter"`
	NotBefore  int64    `json:"notBefore"`
	Issuer     string   `json:"issuer"`
	CName      string   `json:"cName"`
	AltNames   []string `json:"altNames"`
	SigAlgName string   `json:"sigAlgName"`
	SigAlgOID  string   `json:"sigAlgOID"`
}

type TLSConfigurationDetails

type TLSConfigurationDetails struct {
	Protocol string `json:"protocol,omitempty"`
	Cipher   string `json:"cipher,omitempty"`
}

type TakeoverDNSDetails

type TakeoverDNSDetails struct {
	Service     string   `json:"service"`
	Nameservers []string `json:"nameservers"`
}

type TokenID

type TokenID string

type User

type User struct {
	ID           UserID `json:"id"`
	Login        string `json:"login"`
	Mail         string `json:"mail"`
	Role         string `json:"role"`
	Company      string `json:"company"`
	Surname      string `json:"surname"`
	Forename     string `json:"forename"`
	Title        string `json:"title"`
	Mobile       string `json:"mobile"`
	Password     string `json:"password"`
	SignatureKey string `json:"signatureKey"`
}

type UserConfig

type UserConfig struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	Type  string `json:"type"`
}

type UserDomains

type UserDomains struct {
	Domains []DomainID `json:"domains"`
}

type UserID

type UserID string

type Viewport

type Viewport string

type WebshellDetails

type WebshellDetails struct {
	AV          string `json:"av"`
	MD5         string `json:"md5"`
	Path        string `json:"path"`
	Size        int    `json:"size"`
	Owner       string `json:"owner"`
	Group       string `json:"group"`
	MTime       int    `json:"mtime"`
	Threat      string `json:"threat"`
	Permissions string `json:"permissions"`
}

type ZoneHDetails

type ZoneHDetails struct {
	URL    string `json:"url"`
	Threat string `json:"threat"`
}

Jump to

Keyboard shortcuts

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