Skip to content

Commit

Permalink
Fixed config load bug (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
hahwul committed Nov 26, 2023
1 parent ea7379f commit a691e70
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 69 deletions.
7 changes: 4 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ func initConfig() {
options.Grep = string(byteValue)

}

if config != "" {
// Open our jsonFile
jsonFile, err := os.Open(config)
Expand All @@ -228,7 +227,9 @@ func initConfig() {
defer jsonFile.Close()

byteValue, _ := io.ReadAll(jsonFile)
json.Unmarshal([]byte(byteValue), options)
err = json.Unmarshal([]byte(byteValue), &options)
if err != nil {
printing.DalLog("SYSTEM", "Error while parsing config file", options)
}
}

}
102 changes: 51 additions & 51 deletions pkg/model/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,68 +12,68 @@ import (

// Options is struct of options
type Options struct {
UniqParam []string `json:"param"`
Cookie string `json:"cookie"`
Header []string `json:"header"`
ConfigFile string `json:"config"`
BlindURL string `json:"blind"`
CustomPayloadFile string `json:"custom-payload-file"`
CustomAlertValue string `json:"custom-alert-value"`
CustomAlertType string `json:"custom-alert-type"`
Data string `json:"data"`
UserAgent string `json:"user-agent"`
OutputFile string `json:"output"`
Format string `json:"format"`
FoundAction string `json:"found-action"`
FoundActionShell string `json:"found-action-shell"`
ProxyAddress string `json:"proxy"`
Grep string `json:"grep"`
IgnoreReturn string `json:"ignore-return"`
IgnoreParams []string `json:"ignore-params"`
Trigger string `json:"trigger"`
Timeout int `json:"timeout"`
Concurrence int `json:"worker"`
Delay int `json:"delay"`
UniqParam []string `json:"param,omitempty"`
Cookie string `json:"cookie,omitempty"`
Header []string `json:"header,omitempty"`
ConfigFile string `json:"config,omitempty"`
BlindURL string `json:"blind,omitempty"`
CustomPayloadFile string `json:"custom-payload-file,omitempty"`
CustomAlertValue string `json:"custom-alert-value,omitempty"`
CustomAlertType string `json:"custom-alert-type,omitempty"`
Data string `json:"data,omitempty"`
UserAgent string `json:"user-agent,omitempty"`
OutputFile string `json:"output,omitempty"`
Format string `json:"format,omitempty"`
FoundAction string `json:"found-action,omitempty"`
FoundActionShell string `json:"found-action-shell,omitempty"`
ProxyAddress string `json:"proxy,omitempty"`
Grep string `json:"grep,omitempty"`
IgnoreReturn string `json:"ignore-return,omitempty"`
IgnoreParams []string `json:"ignore-params,omitempty"`
Trigger string `json:"trigger,omitempty"`
Timeout int `json:"timeout,omitempty"`
Concurrence int `json:"worker,omitempty"`
Delay int `json:"delay,omitempty"`
AllURLS int
NowURL int
Sequence int `json:"sequence"`
OnlyDiscovery bool `json:"only-discovery"`
OnlyCustomPayload bool `json:"only-custom-payload"`
Silence bool `json:"silence"`
IsAPI bool
IsLibrary bool
Mass bool `json:"mass"`
MulticastMode bool
Sequence int `json:"sequence,omitempty"`
OnlyDiscovery bool `json:"only-discovery,omitempty"`
OnlyCustomPayload bool `json:"only-custom-payload,omitempty"`
Silence bool `json:"silence,omitempty"`
IsAPI bool `json:"is-api,omitempty"`
IsLibrary bool `json:"is-library,omitempty"`
Mass bool `json:"mass,omitempty"`
MulticastMode bool `json:"multicast-mode,omitempty"`
Scan map[string]Scan
FollowRedirect bool `json:"follow-redirects"`
Mining bool `json:"mining-dict"`
FindingDOM bool `json:"mining-dom"`
MiningWordlist string `json:"mining-dict-word"`
NoColor bool `json:"no-color"`
Method string `json:"method"`
TriggerMethod string `json:"trigger-method"`
NoSpinner bool `json:"no-spinner"`
NoBAV bool `json:"no-bav"`
ServerHost string
ServerPort int
NoGrep bool `json:"skip-grepping"`
Debug bool `json:"debug"`
CookieFromRaw string
FollowRedirect bool `json:"follow-redirects,omitempty"`
Mining bool `json:"mining-dict,omitempty"`
FindingDOM bool `json:"mining-dom,omitempty"`
MiningWordlist string `json:"mining-dict-word,omitempty"`
NoColor bool `json:"no-color,omitempty"`
Method string `json:"method,omitempty"`
TriggerMethod string `json:"trigger-method,omitempty"`
NoSpinner bool `json:"no-spinner,omitempty"`
NoBAV bool `json:"no-bav,omitempty"`
ServerHost string `json:"server-host,omitempty"`
ServerPort int `json:"server-port,omitempty"`
NoGrep bool `json:"skip-grepping,omitempty"`
Debug bool `json:"debug,omitempty"`
CookieFromRaw string `json:"cookie-from-raw,omitempty"`
ScanResult Result
SpinnerObject *s.Spinner
AuroraObject a.Aurora
StartTime t.Time
HarWriter *har.Writer
PathReflection map[int]string
RemotePayloads string
RemoteWordlists string
UseHeadless bool `json:"use-headless"`
UseDeepDXSS bool `json:"use-deepdxss"`
OnlyPoC string `json:"only-poc"`
OutputAll bool `json:"output-all"`
RemotePayloads string `json:"remote-payloads,omitempty"`
RemoteWordlists string `json:"remote-wordlists,omitempty"`
UseHeadless bool `json:"use-headless,omitempty"`
UseDeepDXSS bool `json:"use-deepdxss,omitempty"`
OnlyPoC string `json:"only-poc,omitempty"`
OutputAll bool `json:"output-all,omitempty"`
WAF bool
WAFEvasion bool
PoCType string `json:"poc-type"`
PoCType string `json:"poc-type,omitempty"`
Mutex *sync.Mutex
ReportFormat string
ReportBool bool
Expand Down
30 changes: 15 additions & 15 deletions samples/sample_config.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"Header":"",
"Cookie":"",
"UniqParam":"",
"BlindURL":"",
"CustomPayloadFile":"",
"Data":"",
"UserAgent":"",
"OutputFile":"",
"Format":"",
"FoundAction":"",
"Proxy":"",
"Timeout": 30,
"Concurrence": 100,
"Delay": 30,
"OnlyDiscovery": false
"header":[""],
"cookie":"",
"param":[""],
"blind":"",
"custom-payload-file":"",
"data":"",
"user-agent":"",
"output":"",
"format":"",
"found-action":"",
"proxy":"",
"timeout": 30,
"worker": 100,
"delay": 30,
"only-discovery": false
}

0 comments on commit a691e70

Please sign in to comment.