Skip to content

Commit

Permalink
max try times from command line
Browse files Browse the repository at this point in the history
  • Loading branch information
hugefiver committed Dec 20, 2021
1 parent ee4d5e8 commit 489ec28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ type ArgsStruct struct {

// Anti honeypot scan
AntiScan bool

// Max try times
MaxTry uint
}

// GetArg : get args
Expand Down Expand Up @@ -69,6 +72,8 @@ func GetArg() (ArgsStruct, func()) {
f.BoolVar(&NoAntiScan, "A", false, "disable anti honeypot scan")
f.BoolVar(&AntiScan, "a", false, "enable anti honeypot scan (default)")

f.UintVar(&args.MaxTry, "try", 0, "max try times")

f.Parse(os.Args[1:])
//_args = &args

Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ func main() {
}
}

maxTry := 3
if args.MaxTry > 0 {
maxTry = int(args.MaxTry)
}
serverConfig := ssh.ServerConfig{
Config: ssh.Config{},
NoClientAuth: false,
MaxAuthTries: 3,
MaxAuthTries: maxTry,
PasswordCallback: rejectAll,
PublicKeyCallback: nil,
AuthLogCallback: nil,
Expand Down

0 comments on commit 489ec28

Please sign in to comment.