Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add auth cred file flag #1912

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ OPTIMIZATIONS:

CLOUD:
-auth configure projectdiscovery cloud (pdcp) api key (default true)
-ac, -auth-config string configure projectdiscovery cloud (pdcp) api key credential file
-pd, -dashboard upload / view output in projectdiscovery cloud (pdcp) UI dashboard
-aid, -asset-id string upload new assets to existing asset id (optional)
-aname, -asset-name string assets group name to set (optional)
Expand Down
8 changes: 8 additions & 0 deletions runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"math"
"os"
"path/filepath"
"regexp"
"strings"
"time"
Expand Down Expand Up @@ -212,6 +213,7 @@ type Options struct {
CSVOutput bool
CSVOutputEncoding string
PdcpAuth string
PdcpAuthCredFile string
Silent bool
Version bool
Verbose bool
Expand Down Expand Up @@ -512,6 +514,7 @@ func ParseOptions() *Options {

flagSet.CreateGroup("cloud", "Cloud",
flagSet.DynamicVar(&options.PdcpAuth, "auth", "true", "configure projectdiscovery cloud (pdcp) api key"),
flagSet.StringVarP(&options.PdcpAuthCredFile, "auth-config", "ac", "", "configure projectdiscovery cloud (pdcp) api key credential file"),
flagSet.BoolVarP(&options.AssetUpload, "dashboard", "pd", false, "upload / view output in projectdiscovery cloud (pdcp) UI dashboard"),
flagSet.StringVarP(&options.TeamID, "team-id", "tid", TeamIDEnv, "upload asset results to given team id (optional)"),
flagSet.StringVarP(&options.AssetID, "asset-id", "aid", "", "upload new assets to existing asset id (optional)"),
Expand Down Expand Up @@ -540,6 +543,11 @@ func ParseOptions() *Options {
}
}

if options.PdcpAuthCredFile != "" {
pdcpauth.PDCPCredFile = options.PdcpAuthCredFile
pdcpauth.PDCPDir = filepath.Dir(pdcpauth.PDCPCredFile)
}

// api key hierarchy: cli flag > env var > .pdcp/credential file
if options.PdcpAuth == "true" {
AuthWithPDCP()
Expand Down
Loading