pdcp

package
v3.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

pdcp contains projectdiscovery cloud platform related features like result upload , dashboard etc.

Index

Constants

View Source
const (
	ApiKeyHeaderName = "X-Api-Key"
)

Variables

View Source
var (
	DashBoardURL     = "https://cloud.projectdiscovery.io"
	DefaultApiServer = "https://api.projectdiscovery.io"
)
View Source
var (
	PDCPDir      = filepath.Join(folderutil.HomeDirOrDefault(""), ".pdcp")
	PDCPCredFile = filepath.Join(PDCPDir, "credentials.yaml")
	ErrNoCreds   = fmt.Errorf("no credentials found in %s", PDCPDir)
)

Functions

func CheckNValidateCredentials

func CheckNValidateCredentials(toolName string)

CheckNValidateCredentials checks if credentials exist on filesystem if not waits for user to enter credentials and validates them and saves them to filesystem when validate is true any existing credentials are validated Note: this is meant to be used in cli only (interactive mode)

Types

type PDCPCredHandler

type PDCPCredHandler struct{}

PDCPCredHandler is interface for adding / retrieving pdcp credentials from file system

func (*PDCPCredHandler) GetCreds

func (p *PDCPCredHandler) GetCreds() (*PDCPCredentials, error)

GetCreds retrieves the credentials from the file system or environment variables

func (*PDCPCredHandler) SaveCreds

func (p *PDCPCredHandler) SaveCreds(resp *PDCPCredentials) error

SaveCreds saves the credentials to the file system

func (*PDCPCredHandler) ValidateAPIKey

func (p *PDCPCredHandler) ValidateAPIKey(key string, host string, toolName string) (*PDCPCredentials, error)

ValidateAPIKey validates the api key and retrieves associated user metadata like username from given api server/host

type PDCPCredentials

type PDCPCredentials struct {
	Username string `yaml:"username"`
	APIKey   string `yaml:"api-key"`
	Server   string `yaml:"server"`
}

type PDCPUserProfileResponse

type PDCPUserProfileResponse struct {
	UserName string `json:"name"`
}

type UploadWriter

type UploadWriter struct {
	*output.StandardWriter
	// contains filtered or unexported fields
}

UploadWriter is a writer that uploads its output to pdcp server to enable web dashboard and more

func NewUploadWriter

func NewUploadWriter(creds *PDCPCredentials) (*UploadWriter, error)

NewUploadWriter creates a new upload writer

func (*UploadWriter) Close

func (u *UploadWriter) Close()

Close closes the upload writer

func (*UploadWriter) Upload

func (u *UploadWriter) Upload()

Upload uploads the results to pdcp server

Jump to

Keyboard shortcuts

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