Skip to content

Commit

Permalink
add new domain switch to vhost mode
Browse files Browse the repository at this point in the history
  • Loading branch information
firefart committed May 27, 2021
1 parent 0b1cdc3 commit 03e7a45
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cli/cmd/vhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ func parseVhostOptions() (*libgobuster.Options, *gobustervhost.OptionsVhost, err
return nil, nil, fmt.Errorf("invalid value for excludelength: %w", err)
}

plugin.Domain, err = cmdVhost.Flags().GetString("domain")
if err != nil {
return nil, nil, fmt.Errorf("invalid value for domain: %w", err)
}

return globalopts, &plugin, nil
}

Expand All @@ -78,6 +83,7 @@ func init() {
}
cmdVhost.Flags().BoolP("append-domain", "", false, "Append main domain from URL to words from wordlist. Otherwise the fully qualified domains need to be specified in the wordlist.")
cmdVhost.Flags().IntSlice("exclude-length", []int{}, "exclude the following content length (completely ignores the status). Supply multiple times to exclude multiple sizes.")
cmdVhost.Flags().String("domain", "", "the domain to append")

cmdVhost.PersistentPreRun = func(cmd *cobra.Command, args []string) {
configureGlobalOptions()
Expand Down
6 changes: 5 additions & 1 deletion gobustervhost/gobustervhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ func (v *GobusterVhost) PreRun(ctx context.Context) error {
if err != nil {
return fmt.Errorf("invalid url %s: %w", v.options.URL, err)
}
v.domain = urlParsed.Host
if v.options.Domain != "" {
v.domain = v.options.Domain
} else {
v.domain = urlParsed.Host
}

// request default vhost for baseline1
_, _, _, tmp, err := v.http.Request(ctx, v.options.URL, libgobuster.RequestOptions{ReturnBody: true})
Expand Down
1 change: 1 addition & 0 deletions gobustervhost/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ type OptionsVhost struct {
libgobuster.HTTPOptions
AppendDomain bool
ExcludeLength []int
Domain string
}

0 comments on commit 03e7a45

Please sign in to comment.