Skip to content

Commit a5f8198

Browse files
add auth cred file flag (#1912)
* add auth cred file flag * update readme * rename
1 parent db72bb2 commit a5f8198

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ OPTIMIZATIONS:
248248

249249
CLOUD:
250250
-auth configure projectdiscovery cloud (pdcp) api key (default true)
251+
-ac, -auth-config string configure projectdiscovery cloud (pdcp) api key credential file
251252
-pd, -dashboard upload / view output in projectdiscovery cloud (pdcp) UI dashboard
252253
-aid, -asset-id string upload new assets to existing asset id (optional)
253254
-aname, -asset-name string assets group name to set (optional)

runner/options.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"math"
66
"os"
7+
"path/filepath"
78
"regexp"
89
"strings"
910
"time"
@@ -214,6 +215,7 @@ type Options struct {
214215
CSVOutput bool
215216
CSVOutputEncoding string
216217
PdcpAuth string
218+
PdcpAuthCredFile string
217219
Silent bool
218220
Version bool
219221
Verbose bool
@@ -519,6 +521,7 @@ func ParseOptions() *Options {
519521

520522
flagSet.CreateGroup("cloud", "Cloud",
521523
flagSet.DynamicVar(&options.PdcpAuth, "auth", "true", "configure projectdiscovery cloud (pdcp) api key"),
524+
flagSet.StringVarP(&options.PdcpAuthCredFile, "auth-config", "ac", "", "configure projectdiscovery cloud (pdcp) api key credential file"),
522525
flagSet.BoolVarP(&options.AssetUpload, "dashboard", "pd", false, "upload / view output in projectdiscovery cloud (pdcp) UI dashboard"),
523526
flagSet.StringVarP(&options.TeamID, "team-id", "tid", TeamIDEnv, "upload asset results to given team id (optional)"),
524527
flagSet.StringVarP(&options.AssetID, "asset-id", "aid", "", "upload new assets to existing asset id (optional)"),
@@ -547,6 +550,11 @@ func ParseOptions() *Options {
547550
}
548551
}
549552

553+
if options.PdcpAuthCredFile != "" {
554+
pdcpauth.PDCPCredFile = options.PdcpAuthCredFile
555+
pdcpauth.PDCPDir = filepath.Dir(pdcpauth.PDCPCredFile)
556+
}
557+
550558
// api key hierarchy: cli flag > env var > .pdcp/credential file
551559
if options.PdcpAuth == "true" {
552560
AuthWithPDCP()

0 commit comments

Comments
 (0)