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
const LOGO = `` /* 256-byte string literal not displayed */
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", }, }, }
View Source
var Listen = &cli.Command{ Name: "listen", Usage: "Listen to all the traffic", Description: "Listen to all the traffic", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "list-interface", Usage: "List all the interfaces available on this system", Aliases: []string{"l"}, }, &cli.StringSliceFlag{ Name: "interface", Usage: "interfaces to listen", Aliases: []string{"i"}, }, &cli.StringFlag{ Name: "filter", Usage: "BPF filter string, e.g. 'tcp port 80'", Aliases: []string{"f"}, }, &cli.StringFlag{ Name: "save-to", Usage: "File to save the captured packets to (json format)", Aliases: []string{"s"}, }, &cli.StringFlag{ Name: "write-to", Usage: "File to write the captured packets to (pcap format)", Aliases: []string{"w"}, }, &cli.BoolFlag{ Name: "verbose", Usage: "Enable verbose output", Aliases: []string{"v"}, }, &cli.BoolFlag{ Name: "httpprint", Usage: "Print HTTP requests and responses", Aliases: []string{"ph"}, }, }, Action: func(c *cli.Context) error { listInterface = c.Bool("list-interface") if listInterface { devs, err := pcap.FindAllDevs() if err != nil { return fmt.Errorf("could not list interfaces: %v", err) } table := tablewriter.NewWriter(os.Stdout) table.Header([]string{"Name", "IP(s)", "Description"}) for _, dev := range devs { desc := dev.Description if desc == "" { desc = "-" } ips := "-" if len(dev.Addresses) > 0 { ipList := make([]string, 0, len(dev.Addresses)) for _, addr := range dev.Addresses { ipList = append(ipList, addr.IP.String()) } ips = strings.Join(ipList, ", ") } table.Append([]string{dev.Name, ips, desc}) } table.Render() return nil } bpfFilter = c.String("filter") saveTo = c.String("save-to") writeTo = c.String("write-to") interfaces = c.StringSlice("interface") verbose = c.Bool("verbose") printHTTP = c.Bool("httpprint") if len(interfaces) == 0 { devs, err := pcap.FindAllDevs() if err != nil { return fmt.Errorf("could not list interfaces: %v", err) } for _, dev := range devs { if dev.Flags&uint32(net.FlagUp) == 0 { continue } interfaces = append(interfaces, dev.Name) } } fmt.Printf("Listening on interfaces: %v\n", interfaces) stop := make(chan os.Signal, 1) signal.Notify(stop, os.Interrupt) for _, iface := range interfaces { go run.ListenOnInterface(iface, bpfFilter, saveTo, writeTo, verbose, printHTTP) } <-stop slog.Println(slog.INFO, "Stopped listening.") return nil }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.