New creates a new initialized GobusterFuzz
(globalopts *libgobuster.Options, opts *OptionsFuzz, logger *libgobuster.Logger)
| 38 | |
| 39 | // New creates a new initialized GobusterFuzz |
| 40 | func New(globalopts *libgobuster.Options, opts *OptionsFuzz, logger *libgobuster.Logger) (*GobusterFuzz, error) { |
| 41 | if globalopts == nil { |
| 42 | return nil, errors.New("please provide valid global options") |
| 43 | } |
| 44 | |
| 45 | if opts == nil { |
| 46 | return nil, errors.New("please provide valid plugin options") |
| 47 | } |
| 48 | |
| 49 | g := GobusterFuzz{ |
| 50 | options: opts, |
| 51 | globalopts: globalopts, |
| 52 | } |
| 53 | |
| 54 | basicOptions := libgobuster.BasicHTTPOptions{ |
| 55 | Proxy: opts.Proxy, |
| 56 | Timeout: opts.Timeout, |
| 57 | UserAgent: opts.UserAgent, |
| 58 | NoTLSValidation: opts.NoTLSValidation, |
| 59 | RetryOnTimeout: opts.RetryOnTimeout, |
| 60 | RetryAttempts: opts.RetryAttempts, |
| 61 | TLSCertificate: opts.TLSCertificate, |
| 62 | } |
| 63 | |
| 64 | httpOpts := libgobuster.HTTPOptions{ |
| 65 | BasicHTTPOptions: basicOptions, |
| 66 | FollowRedirect: opts.FollowRedirect, |
| 67 | Username: opts.Username, |
| 68 | Password: opts.Password, |
| 69 | Headers: opts.Headers, |
| 70 | NoCanonicalizeHeaders: opts.NoCanonicalizeHeaders, |
| 71 | Cookies: opts.Cookies, |
| 72 | Method: opts.Method, |
| 73 | } |
| 74 | |
| 75 | h, err := libgobuster.NewHTTPClient(&httpOpts, logger) |
| 76 | if err != nil { |
| 77 | return nil, err |
| 78 | } |
| 79 | g.http = h |
| 80 | return &g, nil |
| 81 | } |
| 82 | |
| 83 | // Name should return the name of the plugin |
| 84 | func (d *GobusterFuzz) Name() string { |