Skip to content

Commit

Permalink
fix #249, fix #247
Browse files Browse the repository at this point in the history
  • Loading branch information
firefart committed Jan 4, 2021
1 parent d483ef6 commit cfcf619
Show file tree
Hide file tree
Showing 3 changed files with 14 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 @@ -52,6 +52,11 @@ func parseVhostOptions() (*libgobuster.Options, *gobustervhost.OptionsVhost, err
plugin.Headers = httpOpts.Headers
plugin.Method = httpOpts.Method

plugin.AppendDomain, err = cmdDNS.Flags().GetBool("append-domain")
if err != nil {
return nil, nil, fmt.Errorf("invalid value for append-domain: %w", err)
}

return globalopts, &plugin, nil
}

Expand All @@ -64,6 +69,7 @@ func init() {
if err := addCommonHTTPOptions(cmdVhost); err != nil {
log.Fatalf("%v", err)
}
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.PersistentPreRun = func(cmd *cobra.Command, args []string) {
configureGlobalOptions()
Expand Down
8 changes: 7 additions & 1 deletion gobustervhost/gobustervhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ func (v *GobusterVhost) PreRun() error {

// Run is the process implementation of gobusterdir
func (v *GobusterVhost) Run(word string, resChannel chan<- libgobuster.Result) error {
subdomain := fmt.Sprintf("%s.%s", word, v.domain)
var subdomain string
if v.options.AppendDomain {
subdomain = fmt.Sprintf("%s.%s", word, v.domain)
} else {
// wordlist needs to include full domains
subdomain = word
}
status, size, header, body, err := v.http.Request(v.options.URL, libgobuster.RequestOptions{Host: subdomain, ReturnBody: true})
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions gobustervhost/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ import (
// OptionsVhost is the struct to hold all options for this plugin
type OptionsVhost struct {
libgobuster.HTTPOptions
AppendDomain bool
}

0 comments on commit cfcf619

Please sign in to comment.