MCPcopy
hub / github.com/OJ/gobuster / New

Function New

gobustergcs/gobustersgcs.go:31–70  ·  view source on GitHub ↗

New creates a new initialized GobusterGCS

(globalopts *libgobuster.Options, opts *OptionsGCS, logger *libgobuster.Logger)

Source from the content-addressed store, hash-verified

29
30// New creates a new initialized GobusterGCS
31func New(globalopts *libgobuster.Options, opts *OptionsGCS, logger *libgobuster.Logger) (*GobusterGCS, error) {
32 if globalopts == nil {
33 return nil, errors.New("please provide valid global options")
34 }
35
36 if opts == nil {
37 return nil, errors.New("please provide valid plugin options")
38 }
39
40 g := GobusterGCS{
41 options: opts,
42 globalopts: globalopts,
43 }
44
45 basicOptions := libgobuster.BasicHTTPOptions{
46 Proxy: opts.Proxy,
47 Timeout: opts.Timeout,
48 UserAgent: opts.UserAgent,
49 NoTLSValidation: opts.NoTLSValidation,
50 RetryOnTimeout: opts.RetryOnTimeout,
51 RetryAttempts: opts.RetryAttempts,
52 TLSCertificate: opts.TLSCertificate,
53 }
54
55 httpOpts := libgobuster.HTTPOptions{
56 BasicHTTPOptions: basicOptions,
57 // needed so we can list bucket contents
58 FollowRedirect: true,
59 }
60
61 h, err := libgobuster.NewHTTPClient(&httpOpts, logger)
62 if err != nil {
63 return nil, err
64 }
65 g.http = h
66 // https://cloud.google.com/storage/docs/naming-buckets
67 g.bucketRegex = regexp.MustCompile(`^[a-z0-9][a-z0-9\-_.]{1,61}[a-z0-9](\.[a-z0-9][a-z0-9\-_.]{1,61}[a-z0-9])*$`)
68
69 return &g, nil
70}
71
72// Name should return the name of the plugin
73func (s *GobusterGCS) Name() string {

Callers 1

runFunction · 0.92

Calls 1

NewHTTPClientFunction · 0.92

Tested by

no test coverage detected