Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type AnalysesService
- type Analysis
- type AnalysisListOptions
- type AnalysisResponse
- type Client
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)
- func (c *Client) GetUserAgent() string
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) NewUploadRequest(method, urlStr string, reader io.Reader, size int64) (*http.Request, error)
- func (c *Client) SetHTTPTransportParams(proxyURL *url.URL, insecure bool) *Client
- type DRFResponseAnalysis
- type DRFResponseFile
- type DRFResponseOrganization
- type DRFResponseProject
- type DRFResponseReportDownloadUrl
- type Error
- type ErrorResponse
- type File
- type FileListOptions
- type FileResponse
- type FilesService
- type ListOptions
- type Me
- type MeService
- type OWASP
- type OWASPService
- type Organization
- type OrganizationResponse
- type OrganizationsService
- type Project
- type ProjectListOptions
- type ProjectProfileReportPreference
- type ProjectProfilesService
- type ProjectResponse
- type ProjectsService
- type RegulatoryPreference
- type ReportResult
- type ReportsService
- func (s *ReportsService) CreateReport(ctx context.Context, fileID int) (report *ReportResult, err error)
- func (s *ReportsService) DownloadReportData(ctx context.Context, downloadUrl string) (bytes.Buffer, error)
- func (s *ReportsService) GetDownloadUrlCSV(ctx context.Context, reportID int) (string, error)
- func (s *ReportsService) GetDownloadUrlExcel(ctx context.Context, reportID int) (string, error)
- func (s *ReportsService) WriteReportDataToFile(reportData bytes.Buffer, outputFilePath string) (string, error)
- type Response
- type Submission
- type SubmissionsService
- type Upload
- type UploadService
- func (s *UploadService) CheckSubmission(ctx context.Context, submissionID int) (*File, *Response, error)
- func (s *UploadService) UploadFile(ctx context.Context, file *os.File) (*File, *Response, error)
- func (s *UploadService) UploadFileUsingReader(ctx context.Context, file io.Reader, size int64) (*int, error)
- type VulnerabilitiesService
- type Vulnerability
Constants ¶
const (
// DefaultAPIHost the default host value
DefaultAPIHost = "https://api.appknox.com/"
)
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range or equal to 202 Accepted. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type AnalysesService ¶
type AnalysesService service
AnalysesService handles communication with the analyses related methods of the Appknox API.
func (*AnalysesService) ListByFile ¶
func (s *AnalysesService) ListByFile(ctx context.Context, fileID int, opt *AnalysisListOptions) ([]*Analysis, *AnalysisResponse, error)
ListByFile lists the analyses for a file.
type Analysis ¶
type Analysis struct { ID int `json:"id,omitempty"` Risk enums.RiskType `json:"risk,omitempty"` OverRiddenRisk enums.RiskType `json:"overridden_risk,omitempty"` ComputedRisk enums.RiskType `json:"computed_risk,omitempty"` Status enums.AnalysisStateType `json:"status,omitempty"` CvssVector string `json:"cvss_vector,omitempty"` CvssBase float64 `json:"cvss_base,omitempty"` CvssVersion int `json:"cvss_version,omitempty"` Owasp []string `json:"owasp,omitempty"` Pcidss []string `json:"pcidss,omitempty"` Hipaa []string `json:"hipaa,omitempty"` Asvs []string `json:"asvs,omitempty"` Cwe []string `json:"cwe,omitempty"` Gdpr []string `json:"gdpr,omitempty"` Mstg []string `json:"mstg,omitempty"` Owaspapi2023 []string `json:"owaspapi2023,omitempty"` UpdatedOn *time.Time `json:"updated_on,omitempty"` VulnerabilityID int `json:"vulnerability,omitempty"` }
Analysis represents the appknox file analysis.
type AnalysisListOptions ¶
type AnalysisListOptions struct {
ListOptions
}
AnalysisListOptions specifies the optional parameters to the AnalysesService.List method.
type AnalysisResponse ¶
type AnalysisResponse struct {
// contains filtered or unexported fields
}
AnalysisResponse is a wrapper on DRFResponseAnalysis which will help to execute further operations on DRFResponseAnalysis.
func (*AnalysisResponse) GetCount ¶
func (r *AnalysisResponse) GetCount() int
GetCount will return total number of items in the analysis response.
func (*AnalysisResponse) GetNext ¶
func (r *AnalysisResponse) GetNext() ([]*Analysis, *AnalysisResponse, error)
GetNext returns the next page items for a analysis.
func (*AnalysisResponse) GetPrevious ¶
func (r *AnalysisResponse) GetPrevious() ([]*Analysis, *AnalysisResponse, error)
GetPrevious returns the previous page items for a analysis.
type Client ¶
type Client struct { // Base URL for API requests. Defaults to the http://api.appknox.com/. // BaseURL should always be specified with a trailing slash. BaseURL *url.URL // AccessToken used interact with Appknox API. AccessToken string // Service used for uploading an app to Appknox. Upload *UploadService // Service used for getting the current authenticated user. Me *MeService // Submissions service is used to interact with appknox submission api. Submissions *SubmissionsService // Projects service is used to interact with appknox project api. Projects *ProjectsService // Files service is used to interact with appknox file api. Files *FilesService ProjectProfiles *ProjectProfilesService // Analyses service is used to interact with appknox analyses api. Analyses *AnalysesService // Vulnerabilities service is used to interact with appknox vulnerability api. Vulnerabilities *VulnerabilitiesService // OWASP service is used to interact with appknox owasp api. OWASP *OWASPService // Organizaions service is used to interact with appknox organizations api. Organizations *OrganizationsService // Reports service is used to interact with appknox reports api. Reports *ReportsService // contains filtered or unexported fields }
A Client manages communication with the Appknox API.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it. If rate limit is exceeded and reset time is in the future, Do returns *RateLimitError immediately without making a network API call.
The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.
func (*Client) GetUserAgent ¶
func (*Client) NewRequest ¶
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 DRFResponseAnalysis ¶
type DRFResponseAnalysis struct { Count int `json:"count,omitempty"` Next string `json:"next,omitempty"` Previous string `json:"previous,omitempty"` Results []*Analysis `json:"results"` }
DRFResponseAnalysis represents for drf response of the Appknox analyses api.
type DRFResponseFile ¶
type DRFResponseFile struct { Count int64 `json:"count,omitempty"` Next string `json:"next,omitempty"` Previous string `json:"previous,omitempty"` Results []*File `json:"results,omitempty"` }
DRFResponseFile represents for drf response of the Appknox file api.
type DRFResponseOrganization ¶
type DRFResponseOrganization struct { Count int64 `json:"count,omitempty"` Next string `json:"next,omitempty"` Previous string `json:"previous,omitempty"` Results []*Organization `json:"results,omitempty"` }
DRFResponseOrganization represents for drf response of the Appknox organizations api.
type DRFResponseProject ¶
type DRFResponseProject struct { Count int `json:"count,omitempty"` Next string `json:"next,omitempty"` Previous string `json:"previous,omitempty"` Results []*Project `json:"results,omitempty"` }
DRFResponseProject represents for drf response of the Appknox project api.
type DRFResponseReportDownloadUrl ¶
type DRFResponseReportDownloadUrl struct {
Url string `json:"url"`
}
type ErrorResponse ¶
ErrorResponse struct is used for validating the error returned by appknox api.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type File ¶
type File struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` VersionCode string `json:"version_code,omitempty"` DynamicStatus enums.DynamicScanStateType `json:"dynamic_status,omitempty"` APIScanProgress int `json:"api_scan_progress,omitempty"` IsStaticDone bool `json:"is_static_done,omitempty"` IsDynamicDone bool `json:"is_dynamic_done,omitempty"` StaticScanProgress int `json:"static_scan_progress,omitempty"` APIScanStatus enums.AnalysisStateType `json:"api_scan_status,omitempty"` Rating string `json:"rating,omitempty"` IsManualDone bool `json:"is_manual_done,omitempty"` IsAPIDone bool `json:"is_api_done,omitempty"` CreatedOn *time.Time `json:"created_on,omitempty"` ProfileID int `json:"profile,omitempty"` }
File represents a Appknox file.
type FileListOptions ¶
type FileListOptions struct { VersionCode string `url:"version_code,omitempty"` ListOptions }
FileListOptions specifies the optional parameters to the FilesService.List method.
type FileResponse ¶
type FileResponse struct {
// contains filtered or unexported fields
}
FileResponse is a wrapper on DRFResponseFile which will help to execute further operations on DRFResponseFile.
func (*FileResponse) GetNext ¶
func (r *FileResponse) GetNext() ([]*File, *FileResponse, error)
GetNext returns the next page items for a file.
func (*FileResponse) GetPrevious ¶
func (r *FileResponse) GetPrevious() ([]*File, *FileResponse, error)
GetPrevious returns the previous page items for a file.
type FilesService ¶
type FilesService service
FilesService handles communication with the file related methods of the Appknox API.
func (*FilesService) ListByProject ¶
func (s *FilesService) ListByProject(ctx context.Context, projectID int, opt *FileListOptions) ([]*File, *FileResponse, error)
ListByProject lists the files for a project.
type ListOptions ¶
type ListOptions struct { // For paginated result sets, page of results to retrieve. Offset int `url:"offset,omitempty"` // For paginated result sets, the number of results to include per page. Limit int `url:"limit,omitempty"` }
ListOptions specifies the optional parameters to various List methods that support pagination.
type Me ¶
type Me struct { ID int `json:"id,omitempty"` Username string `json:"username,omitempty"` Email string `json:"email,omitempty"` DefaultOrganization int `json:"default_organization,omitempty"` }
Me struct is used to validate the response to returned by me api.
type OWASP ¶
type OWASP struct { Code string `json:"code,omitempty"` Description string `json:"description,omitempty"` ID string `json:"id,omitempty"` Title string `json:"title,omitempty"` Year int `json:"year,omitempty"` }
OWASP represents a Appknox owasp object.
type OWASPService ¶
type OWASPService service
OWASPService is used to interact with appknox owasp api.
type Organization ¶
type Organization struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` ProjectsCount int `json:"projects_count,omitempty"` }
Organization represents a Appknox organization object.
type OrganizationResponse ¶
type OrganizationResponse struct {
// contains filtered or unexported fields
}
OrganizationResponse is a wrapper on DRFResponseOrganization which will help to execute further operations on DRFResponseOrganization.
type OrganizationsService ¶
type OrganizationsService service
OrganizationsService is used to interact with appknox owasp api.
func (*OrganizationsService) List ¶
func (s *OrganizationsService) List(ctx context.Context) ([]*Organization, *OrganizationResponse, error)
List lists organizations for the current user.
type Project ¶
type Project struct { ID int `json:"id,omitempty"` CreatedOn *time.Time `json:"created_on,omitempty"` UpdatedOn *time.Time `json:"updated_on,omitempty"` PackageName string `json:"package_name,omitempty"` Platform enums.PlatformType `json:"platform,omitempty"` FileCount int `json:"file_count,omitempty"` }
Project represents a Appknox project.
type ProjectListOptions ¶
type ProjectListOptions struct { Platform string `url:"platform,omitempty"` PackageName string `url:"package_name,omitempty"` Search string `url:"q,omitempty"` ListOptions }
ProjectListOptions specifies the optional parameters to the ProjectsService.List method.
type ProjectProfileReportPreference ¶
type ProjectProfileReportPreference struct { ShowPcidss RegulatoryPreference `json:"show_pcidss,omitempty"` ShowHipaa RegulatoryPreference `json:"show_hipaa,omitempty"` ShowGdpr RegulatoryPreference `json:"show_gdpr,omitempty"` }
ProjectProfileReportPreference struct is used to validate the response of prpject profile report preference API
type ProjectProfilesService ¶
type ProjectProfilesService service
ProjectProfileService is used to interact with project profile api.
func (*ProjectProfilesService) GetProjectProfileReportPreference ¶
func (s *ProjectProfilesService) GetProjectProfileReportPreference(ctx context.Context, fileID int) (*ProjectProfileReportPreference, *Response, error)
CurrentAuthenticatedUser is used to get the details about the current authenticated user at appknox.
type ProjectResponse ¶
type ProjectResponse struct {
// contains filtered or unexported fields
}
ProjectResponse is a wrapper on DRFResponseProject which will help to execute further operations on DRFResponseProject.
func (*ProjectResponse) GetNext ¶
func (r *ProjectResponse) GetNext() ([]*Project, *ProjectResponse, error)
GetNext returns the next page items for a project.
func (*ProjectResponse) GetPrevious ¶
func (r *ProjectResponse) GetPrevious() ([]*Project, *ProjectResponse, error)
GetPrevious returns the previous page items for a project.
type ProjectsService ¶
type ProjectsService service
ProjectsService handles communication with the project related methods of the Appknox API.
func (*ProjectsService) List ¶
func (s *ProjectsService) List(ctx context.Context, opt *ProjectListOptions) ([]*Project, *ProjectResponse, error)
List lists the files for a project.
type RegulatoryPreference ¶
type RegulatoryPreference struct {
Value bool `json:"value,omitempty"`
}
type ReportResult ¶
type ReportsService ¶
type ReportsService service
func (*ReportsService) CreateReport ¶
func (s *ReportsService) CreateReport(ctx context.Context, fileID int) (report *ReportResult, err error)
func (*ReportsService) DownloadReportData ¶
func (s *ReportsService) DownloadReportData(ctx context.Context, downloadUrl string) (bytes.Buffer, error)
Download Report Data from Url to buffer
func (*ReportsService) GetDownloadUrlCSV ¶
Get Signed URL to download Summary CSV report Data
func (*ReportsService) GetDownloadUrlExcel ¶
func (*ReportsService) WriteReportDataToFile ¶
func (s *ReportsService) WriteReportDataToFile(reportData bytes.Buffer, outputFilePath string) (string, error)
Output report from buffer to file
type Response ¶
Response is a appknox API response. This wraps the standard http.Response returned from appknox and provides convenient access to things like pagination links.
type Submission ¶
type Submission struct { ID int `json:"id,omitempty"` Status string `json:"status,omitempty"` File int `json:"file,omitempty"` PackageName string `json:"package_name,omitempty"` CreatedOn string `json:"created_on,omitempty"` Reason string `json:"reason,omitempty"` }
Submission represents a Appknox submission object.
type SubmissionsService ¶
type SubmissionsService service
SubmissionsService is used to interact with appknox submissions api.
func (*SubmissionsService) GetByID ¶
func (s *SubmissionsService) GetByID(ctx context.Context, submissionID int) (*Submission, *Response, error)
GetByID will get a submission by id.
type Upload ¶
type Upload struct { URL string `json:"url,omitempty"` FileKey string `json:"file_key,omitempty"` FileKeySigned string `json:"file_key_signed,omitempty"` SubmissionID int `json:"submission_id,omitempty"` }
Upload struct is used to validate the response of ile upload api.
type UploadService ¶
type UploadService service
UploadService is used to interact with appknox file upload api.
func (*UploadService) CheckSubmission ¶
func (s *UploadService) CheckSubmission(ctx context.Context, submissionID int) (*File, *Response, error)
CheckSubmission will check submission validation and return a valid file object.
func (*UploadService) UploadFile ¶
UploadFile is used to upload a file to appknox dashboard. Returns the file object.
func (*UploadService) UploadFileUsingReader ¶
func (s *UploadService) UploadFileUsingReader(ctx context.Context, file io.Reader, size int64) (*int, error)
UploadFileUsingReader is used to upload a file to appknox dashboard. Returns the submissionID.
type VulnerabilitiesService ¶
type VulnerabilitiesService service
VulnerabilitiesService is used to interact with appknox vulnerability api.
func (*VulnerabilitiesService) GetByID ¶
func (s *VulnerabilitiesService) GetByID(ctx context.Context, vulnerabilityID int) (*Vulnerability, *Response, error)
GetByID will get a vulnerability by id.
type Vulnerability ¶
type Vulnerability struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Intro string `json:"intro,omitempty"` Compliant string `json:"compliant,omitempty"` NonCompliant string `json:"non_compliant,omitempty"` }
Vulnerability represents a Appknox vulnerability object.