nowsecure

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMonitorNotFound = errors.New("Monitor not found")

ErrMonitorNotFound represents a 404

View Source
var (
	ErrNotFound = errors.New("not found")
)

Errors.

Functions

This section is empty.

Types

type AndroidLibrariesList

type AndroidLibrariesList []struct {
	Prefix             string `json:"prefix"`
	Groupid            string `json:"groupid"`
	Artifactid         string `json:"artifactid"`
	Version            string `json:"version"`
	LatestKnownVersion string `json:"latest_known_version"`
	Metadata           struct {
		A         string   `json:"a"`
		G         string   `json:"g"`
		P         string   `json:"p"`
		V         string   `json:"v"`
		Ec        []string `json:"ec"`
		ID        string   `json:"id"`
		Tags      []string `json:"tags"`
		Timestamp int64    `json:"timestamp"`
	} `json:"metadata"`
	PomJSON struct {
		Project struct {
			XML struct {
				Xmlns             string `json:"xmlns"`
				XmlnsXsi          string `json:"xmlns:xsi"`
				XsiSchemaLocation string `json:"xsi:schemaLocation"`
			} `json:"$"`
			Scm []struct {
				URL                 []string `json:"url"`
				Connection          []string `json:"connection"`
				DeveloperConnection []string `json:"developerConnection"`
			} `json:"scm"`
			URL      []string `json:"url"`
			Name     []string `json:"name"`
			GroupID  []string `json:"groupId"`
			Version  []string `json:"version"`
			Licenses []struct {
				License []struct {
					URL          []string `json:"url"`
					Name         []string `json:"name"`
					Distribution []string `json:"distribution"`
				} `json:"license"`
			} `json:"licenses"`
			Packaging  []string `json:"packaging"`
			ArtifactID []string `json:"artifactId"`
			Developers []struct {
				Developer []struct {
					ID   []string `json:"id"`
					Name []string `json:"name"`
				} `json:"developer"`
			} `json:"developers"`
			Description  []string `json:"description"`
			Dependencies []struct {
				Dependency []struct {
					Scope      []string `json:"scope"`
					GroupID    []string `json:"groupId"`
					Version    []string `json:"version"`
					ArtifactID []string `json:"artifactId"`
				} `json:"dependency"`
			} `json:"dependencies"`
			ModelVersion []string `json:"modelVersion"`
		} `json:"project"`
	} `json:"pom_json"`
}

AndroidLibrariesList represents a list of librariers

type AndroidMetadata

type AndroidMetadata []struct {
	ID                      string    `json:"id"`
	TotalVersions           int       `json:"total_versions"`
	UpdatedAt               time.Time `json:"updated_at"`
	Vendor                  string    `json:"vendor"`
	VersionCode             string    `json:"version_code"`
	PackageName             string    `json:"package_name"`
	Name                    string    `json:"name"`
	VersionString           string    `json:"version_string"`
	ApplicationKey          string    `json:"application_key"`
	LatestPublishedVersion  string    `json:"latest_published_version"`
	IsFree                  bool      `json:"is_free"`
	LatestStatusDate        time.Time `json:"latest_status_date"`
	IconURL                 string    `json:"icon_url"`
	LatestAnalysisCreatedAt time.Time `json:"latest_analysis_created_at"`
}

AndroidMetadata represents metadata for Android

type Client

type Client struct {

	// Base URL for API requests.
	// always be specified with a trailing slash.
	BaseURL *url.URL

	// Services used for talking to different parts of the nowsecure API.
	MetaData *MetaDataService
	Searches *SearchesService
	Reports  *ReportsService
	Monitors *MonitorsService
	Users    *UsersService
	Legacy   *LegacyService
	// contains filtered or unexported fields
}

A Client manages communication with the Nowsecure API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new nowsecure API Client.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do sends an API request and returns the API response.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body map[string]string) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

type IOSMetadata

type IOSMetadata []struct {
	ID                      string    `json:"id"`
	TotalVersions           int       `json:"total_versions"`
	ItunesVersion           string    `json:"itunes_version"`
	Title                   string    `json:"title"`
	ApplicationID           string    `json:"application_id"`
	ApplicationKey          string    `json:"application_key"`
	PackageName             string    `json:"package_name"`
	LatestPublishedVersion  string    `json:"latest_published_version"`
	IsFree                  bool      `json:"is_free"`
	LatestStatusDate        time.Time `json:"latest_status_date"`
	IconURL                 string    `json:"icon_url"`
	LatestAnalysisCreatedAt time.Time `json:"latest_analysis_created_at"`
}

IOSMetadata represents metadata for IOS

type IosLibrariesList

type IosLibrariesList []struct {
	Name               string `json:"name"`
	Version            string `json:"version"`
	IsLatest           bool   `json:"is_latest"`
	LatestKnownVersion string `json:"latest_known_version"`
	Spec               struct {
		Name   string `json:"name"`
		Source struct {
			Git        string `json:"git"`
			Tag        string `json:"tag"`
			Submodules bool   `json:"submodules"`
		} `json:"source"`
		Authors struct {
			MatttThompson string `json:"Mattt Thompson"`
		} `json:"authors"`
		License  string `json:"license"`
		Summary  string `json:"summary"`
		Version  string `json:"version"`
		Homepage string `json:"homepage"`
		Subspecs []struct {
			Ios struct {
				Frameworks []string `json:"frameworks"`
			} `json:"ios,omitempty"`
			Osx struct {
				Frameworks string `json:"frameworks"`
			} `json:"osx,omitempty"`
			Name    string `json:"name"`
			Watchos struct {
				Frameworks []string `json:"frameworks"`
			} `json:"watchos,omitempty"`
			SourceFiles       string `json:"source_files"`
			PublicHeaderFiles string `json:"public_header_files"`
			Frameworks        string `json:"frameworks,omitempty"`
			Platforms         struct {
				Ios  string `json:"ios"`
				Osx  string `json:"osx"`
				Tvos string `json:"tvos"`
			} `json:"platforms,omitempty"`
			Tvos struct {
				Dependencies struct {
					AFNetworkingReachability []interface{} `json:"AFNetworking/Reachability"`
				} `json:"dependencies"`
			} `json:"tvos,omitempty"`
			Dependencies struct {
				AFNetworkingSecurity      []interface{} `json:"AFNetworking/Security"`
				AFNetworkingSerialization []interface{} `json:"AFNetworking/Serialization"`
			} `json:"dependencies,omitempty"`
		} `json:"subspecs"`
		Platforms struct {
			Ios     string `json:"ios"`
			Osx     string `json:"osx"`
			Tvos    string `json:"tvos"`
			Watchos string `json:"watchos"`
		} `json:"platforms"`
		RequiresArc          bool   `json:"requires_arc"`
		SourceFiles          string `json:"source_files"`
		SocialMediaURL       string `json:"social_media_url"`
		PublicHeaderFiles    string `json:"public_header_files"`
		PrefixHeaderContents string `json:"prefix_header_contents"`
	} `json:"spec"`
}

IosLibrariesList represents a list of libraries

type LatestAnalysis added in v0.2.4

type LatestAnalysis struct {
	PlatformID              string    `json:"platform_id"`
	ApplicationKey          string    `json:"application_key"`
	BuildVersion            string    `json:"build_version"`
	LatestDynamicRecordedAt time.Time `json:"latest_dynamic_recorded_at"`
	LatestStaticRecordedAt  time.Time `json:"latest_static_recorded_at"`
	ReportPath              string    `json:"report_path"`
}

LatestAnalysis represents a single item in the list of latest analysis.

type LatestAnalysisList added in v0.2.4

type LatestAnalysisList []LatestAnalysis

LatestAnalysisList represents a list of latest analysis.

type LegacyService added in v0.2.4

type LegacyService service

LegacyService handles communication w.r.t. legacy API endpoints.

func (*LegacyService) GetLatestAnalysisList added in v0.2.4

func (s *LegacyService) GetLatestAnalysisList(ctx context.Context, platformIdentifier, applicationKey, listType string, since, until time.Time, pageNum, perPage int) (LatestAnalysisList, error)

GetLatestAnalysisList retrieves the latest analysis from Intel. https://docs.nowsecure.com/intel/api/spec/#api-Legacy-LatestAnalysis

type MetaDataService

type MetaDataService service

MetaDataService handles communication regarding MetaData

func (*MetaDataService) AppIcon

func (s *MetaDataService) AppIcon(ctx context.Context, plattformID string, applicationKey string) (image.Image, *http.Response, error)

AppIcon returns the app icon

func (*MetaDataService) Publisher

func (s *MetaDataService) Publisher(ctx context.Context, plattformID string, publisherID string) (*Publisher, *http.Response, error)

Publisher returns the publisher

type Monitor

type Monitor struct {
	PlatformID     string    `json:"platform_id"`
	ApplicationKey string    `json:"application_key"`
	RequestedAt    time.Time `json:"requested_at"`
	ApprovedAt     time.Time `json:"approved_at"`
	RequestedBy    struct {
		ID    string `json:"id"`
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"requested_by"`
	ApprovedBy struct {
		ID    string `json:"id"`
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"approved_by"`
	Metadata struct {
		PlatformID             string `json:"platform_id"`
		ApplicationKey         string `json:"application_key"`
		PackageName            string `json:"package_name"`
		Title                  string `json:"title"`
		LatestPublishedVersion string `json:"latest_published_version"`
		LatestReleaseDate      string `json:"latest_release_date"`
		PublisherName          string `json:"publisher_name"`
		IconURL                string `json:"icon_url"`
	} `json:"metadata"`
}

Monitor represents a monitor

type MonitorAnalysis

type MonitorAnalysis struct {
	PlatformID              string    `json:"platform_id"`
	ApplicationKey          string    `json:"application_key"`
	BuildVersion            string    `json:"build_version"`
	LatestDynamicRecordedAt time.Time `json:"latest_dynamic_recorded_at"`
	LatestStaticRecordedAt  time.Time `json:"latest_static_recorded_at"`
	ReportPath              string    `json:"report_path"`
}

MonitorAnalysis represents the latest analysis for a monitor

type MonitorList

type MonitorList []struct {
	MonitorRequestedAt         time.Time `json:"monitor_requested_at"`
	MonitorApprovedAt          time.Time `json:"monitor_approved_at"`
	MonitorExpiresAt           time.Time `json:"monitor_expires_at"`
	PlatformID                 string    `json:"platform_id"`
	PackageName                string    `json:"package_name"`
	ApplicationKey             string    `json:"application_key"`
	Title                      string    `json:"title"`
	LatestPublishedVersion     string    `json:"latest_published_version"`
	LatestReleaseDate          time.Time `json:"latest_release_date"`
	PublisherName              string    `json:"publisher_name"`
	IconURL                    string    `json:"icon_url"`
	Startkey                   time.Time `json:"_startkey"`
	LatestAnalysisCreatedAt    time.Time `json:"latest_analysis_created_at"`
	LatestReportBuildVersion   string    `json:"latest_report_build_version"`
	LatestReportReleaseVersion string    `json:"latest_report_release_version"`
}

MonitorList represents a list of monitors

type MonitorRequest

type MonitorRequest struct {
	PlatformID     string `json:"platform_id,omitempty"`
	ApplicationKey string `json:"application_key,omitempty"`
}

MonitorRequest represents a request to create a monitor

type MonitorsService

type MonitorsService service

MonitorsService handles communication regarding Monitors

func (*MonitorsService) Add

Add a monitor for an app

func (*MonitorsService) Analysis

func (s *MonitorsService) Analysis(ctx context.Context, since time.Time) (*[]MonitorAnalysis, *http.Response, error)

Analysis lists latest monitors with analysis

func (*MonitorsService) Delete

Delete a monitor for an app

func (*MonitorsService) Get

Get a monitor for an app

func (*MonitorsService) List

List monitors

type Publisher

type Publisher struct {
	ID                string   `json:"publisher_id"`
	Name              string   `json:"publisher_name"`
	VendorEmail       string   `json:"vendor_email"`
	VendorURL         string   `json:"vendor_url"`
	VendorName        string   `json:"vendor_name"`
	ApplicationKeys   []string `json:"application_keys"`
	ApplicationTitles []string `json:"application_titles"`
}

Publisher defines a publisher

type Report

type Report interface{}

Report represents a report

type ReportsService

type ReportsService service

ReportsService handles communication regarding Reports

func (*ReportsService) Get

func (s *ReportsService) Get(ctx context.Context, platformID string, packageName string, buildVersion string) (*Report, *http.Response, error)

Get a report for an app

type SearchesService

type SearchesService service

SearchesService handles communication regarding searches

func (*SearchesService) AndroidLibraries

func (s *SearchesService) AndroidLibraries(ctx context.Context, classPrefix string, version string) (*AndroidLibrariesList, *http.Response, error)

AndroidLibraries search for 3rd Party Libraries for Android

func (*SearchesService) AndroidMetadata

func (s *SearchesService) AndroidMetadata(ctx context.Context, search string) (*AndroidMetadata, *http.Response, error)

AndroidMetadata search

func (*SearchesService) IOSLibraries

func (s *SearchesService) IOSLibraries(ctx context.Context, name string, version string) (*IosLibrariesList, *http.Response, error)

IOSLibraries search for 3rd Party Libraries for iOS

func (*SearchesService) IOSMetadata

func (s *SearchesService) IOSMetadata(ctx context.Context, search string) (*IOSMetadata, *http.Response, error)

IOSMetadata search

type UserToken

type UserToken struct {
	Jti         string `json:"jti"`
	Description string `json:"description"`
}

UserToken represents a user token

type UserTokenRequest

type UserTokenRequest struct {
	Description string `json:"description,omitempty"`
}

UserTokenRequest represents a request to create a user token

type UsersService

type UsersService service

UsersService handles communication regarding users

func (*UsersService) Add

Add a user token

func (*UsersService) Delete

func (s *UsersService) Delete(ctx context.Context, jti string) (*http.Response, error)

Delete a user token

func (*UsersService) List

func (s *UsersService) List(ctx context.Context) (*[]UserToken, *http.Response, error)

List user tokens

Jump to

Keyboard shortcuts

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