cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const CN_HELP = `` /* 957-byte string literal not displayed */
View Source
const EN_HELP = `` /* 1055-byte string literal not displayed */
View Source

Variables

View Source
var (
	Help, CN  bool
	Verbose   bool
	MaxTime   int
	Worker    int
	Timeout   int
	Interval  int
	Progress  bool
	Targets   []string
	Users     []string
	Passwords []string
)
View Source
var Crack = &cli.Command{
	Name:        "crack",
	Usage:       "Crack password",
	Description: "Crack password",
	Action: func(ctx *cli.Context) error {
		parseArgs(ctx)
		if CN {
			fmt.Print(CN_HELP)
			return nil
		}
		var (
			runCtx    context.Context
			runCancel context.CancelFunc
		)
		if MaxTime == 0 {
			runCtx, runCancel = context.WithCancel(context.Background())
		} else {
			runCtx, runCancel = context.WithTimeout(context.Background(), time.Duration(MaxTime)*time.Second)
		}
		defer runCancel()
		if Verbose {
			slog.SetLevel(slog.DEBUG)
		} else {
			slog.SetLevel(slog.INFO)
		}
		return run.Crack(runCtx, &types.Task{
			Verbose:   Verbose,
			MaxTime:   MaxTime,
			Timeout:   Timeout,
			Interval:  Interval,
			Progress:  Progress,
			Thread:    Worker,
			Targets:   Targets,
			Users:     Users,
			Passwords: Passwords,
		})
	},
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    "cn",
			Aliases: []string{"c"},
			Usage:   "显示中文帮助信息",
		},
		&cli.BoolFlag{
			Name:    "list-service",
			Aliases: []string{"l"},
			Usage:   "list supported service",
		},
		&cli.BoolFlag{
			Name:    "verbose",
			Aliases: []string{"V"},
			Usage:   "verbose mode",
		},
		&cli.IntFlag{
			Name:    "max-runtime",
			Aliases: []string{"m"},
			Value:   0,
			Usage:   "max runtime in seconds, default no limit",
		},
		&cli.IntFlag{
			Name:    "timeout",
			Aliases: []string{"to"},
			Value:   5,
			Usage:   "timeout seconds in each single crack",
		},
		&cli.IntFlag{
			Name:    "interval",
			Aliases: []string{"i"},
			Value:   50,
			Usage:   "crack interval in milliseconds",
		},
		&cli.BoolFlag{
			Name:  "progress",
			Usage: "show progress every 5 seconds",
		},
		&cli.IntFlag{
			Name:    "worker",
			Aliases: []string{"w"},
			Value:   1 << 10,
			Usage:   "number of workers",
		},
		&cli.StringFlag{
			Name:    "target",
			Aliases: []string{"t"},
			Usage:   "target input, e.g: 127.0.0.1,ssh://1.1.1.1:22,192.168.0.1/24:[22|80|8000-9000]",
		},
		&cli.StringFlag{
			Name:    "target-file",
			Aliases: []string{"T"},
			Usage:   "target file",
		},
		&cli.StringFlag{
			Name:    "user",
			Aliases: []string{"u"},
			Usage:   "username(s), e.g: root,admin,guest",
		},
		&cli.StringFlag{
			Name:    "user-dic",
			Aliases: []string{"U"},
			Usage:   "username dictionary file",
		},

		&cli.StringFlag{
			Name:    "pass",
			Aliases: []string{"p"},
			Usage:   "password(s), e.g: 123456,password,admin123",
		},
		&cli.StringFlag{
			Name:    "pass-dic",
			Aliases: []string{"P"},
			Usage:   "password dictionary file",
		},
	},
}

Functions

func ReadDict

func ReadDict(dict string) (dictData []string, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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