recon

package
v2.7.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "recon [--config config.yaml]",
	Args:  cobra.MinimumNArgs(0),
	Short: "Run recon enumeration",
	Long: `Run recon enumeration

Example Commands:
	gorecon recon --config config.yaml
	gorecon recon --config config.yaml --primary-domain-is-subdomain
	gorecon recon --config config.yaml --run-dnsrecon --run-amass --run-pymeta --run-domain-squatting --run-cloud-enum --run-yalis
	gorecon recon --config config.yaml --all
`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		if all, _ := cmd.Flags().GetBool("all"); all {
			flags := cmd.PersistentFlags()
			flags.VisitAll(func(f *pflag.Flag) {
				if strings.HasPrefix(f.Name, "run-") {
					_ = flags.Set(f.Name, "true")
				}
			})
			localio.Infof("Running All Optional GoRecon Modules!")
		}
	},
	PreRunE: func(cmd *cobra.Command, args []string) error {
		if configFileSet, err := cmd.Flags().GetBool("configfileset"); !configFileSet && err == nil {
			_ = cmd.MarkPersistentFlagRequired("company")
			_ = cmd.MarkPersistentFlagRequired("domain")
			_ = cmd.MarkPersistentFlagRequired("creator")
			_ = cmd.MarkPersistentFlagRequired("workspace")
			_ = cmd.MarkPersistentFlagRequired("output")
			_ = cmd.MarkPersistentFlagRequired("modules")
		}
		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {
		var err error
		opts := Options{}
		if err = opts.LoadFromCommand(cmd); err != nil {
			gologger.Fatal().Msgf("Could not LoadFromCommand %s\n", err)
		}

		switch {
		case opts.reconOptions.Workspace == "":
			localio.LogFatalf("WORKSPACE config.yaml value cannot be empty!")
		case opts.reconOptions.Output == "":
			localio.LogFatalf("OUTPUT config.yaml value cannot be empty!")
		case opts.reconOptions.Creator == "":
			localio.LogFatalf("CREATOR config.yaml value cannot be empty!")
		case reflect.TypeOf(opts.reconOptions.Modules).Kind() == reflect.String:
			if opts.reconOptions.Modules == "" {
				localio.LogFatalf("MODULES config.yaml value cannot be empty!")
			}
		case reflect.TypeOf(opts.reconOptions.Modules).Kind() == reflect.Slice:
			if len(opts.reconOptions.Modules.([]string)) == 0 {
				localio.LogFatalf("MODULES config.yaml value cannot be empty!")
			}
		case opts.reconOptions.Company == "":
			localio.LogFatalf("COMPANY config.yaml value cannot be empty!")
		case reflect.TypeOf(opts.reconOptions.Domain).Kind() == reflect.String:
			if opts.reconOptions.Domain.(string) == "" {
				localio.LogFatalf("DOMAIN value cannot be empty!")
			}
		case reflect.TypeOf(opts.reconOptions.Domain).Kind() == reflect.Slice:
			if len(opts.reconOptions.Domain.([]string)) == 0 {
				localio.LogFatalf("DOMAIN config.yaml value cannot be empty!")
			}
		}

		if localio.ContainsWhitespace(opts.reconOptions.Workspace) {
			localio.LogFatalf("Workspace cannot contain any whitespace: %s", opts.reconOptions.Workspace)
		}

		if err = os.MkdirAll(opts.reconOptions.Output, 0750); err != nil {
			gologger.Fatal().Msgf("Error creating directory:  %s\n", err)
		}

		hostScope, err := recon.NewScope(&opts.reconOptions)
		if err != nil {
			gologger.Fatal().Msgf("Could not create NewScope %s\n", err)
		}

		if err = hostScope.RunAllRecon(&opts.reconOptions); err != nil {
			gologger.Fatal().Msgf("Could not RunAllRecon %s\n", err)
		}
	},
}

Command ...

Functions

This section is empty.

Types

type Options

type Options struct {
	// contains filtered or unexported fields
}

func (*Options) LoadFromCommand

func (opts *Options) LoadFromCommand(cmd *cobra.Command) error

LoadFromCommand ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL