|
4 | 4 | "fmt" |
5 | 5 | "math" |
6 | 6 | "os" |
| 7 | + "path/filepath" |
7 | 8 | "regexp" |
8 | 9 | "strings" |
9 | 10 | "time" |
@@ -214,6 +215,7 @@ type Options struct { |
214 | 215 | CSVOutput bool |
215 | 216 | CSVOutputEncoding string |
216 | 217 | PdcpAuth string |
| 218 | + PdcpAuthCredFile string |
217 | 219 | Silent bool |
218 | 220 | Version bool |
219 | 221 | Verbose bool |
@@ -519,6 +521,7 @@ func ParseOptions() *Options { |
519 | 521 |
|
520 | 522 | flagSet.CreateGroup("cloud", "Cloud", |
521 | 523 | 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"), |
522 | 525 | flagSet.BoolVarP(&options.AssetUpload, "dashboard", "pd", false, "upload / view output in projectdiscovery cloud (pdcp) UI dashboard"), |
523 | 526 | flagSet.StringVarP(&options.TeamID, "team-id", "tid", TeamIDEnv, "upload asset results to given team id (optional)"), |
524 | 527 | flagSet.StringVarP(&options.AssetID, "asset-id", "aid", "", "upload new assets to existing asset id (optional)"), |
@@ -547,6 +550,11 @@ func ParseOptions() *Options { |
547 | 550 | } |
548 | 551 | } |
549 | 552 |
|
| 553 | + if options.PdcpAuthCredFile != "" { |
| 554 | + pdcpauth.PDCPCredFile = options.PdcpAuthCredFile |
| 555 | + pdcpauth.PDCPDir = filepath.Dir(pdcpauth.PDCPCredFile) |
| 556 | + } |
| 557 | + |
550 | 558 | // api key hierarchy: cli flag > env var > .pdcp/credential file |
551 | 559 | if options.PdcpAuth == "true" { |
552 | 560 | AuthWithPDCP() |
|
0 commit comments