Skip to content

Commit 622ad1a

Browse files
committed
addban
1 parent 5696658 commit 622ad1a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ctf/router/telnet.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"fmt"
1111
)
1212

13-
ban := time.Now()
14-
attempts := 0
13+
var ban = time.Now()
14+
var attempts = 0
1515

1616
func dnsHandler(stdin io.ReadCloser, stdout io.WriteCloser, stderr io.WriteCloser, args ...string) error {
1717
fmt.Fprintf(stderr, "For the simulator, use docker-compose --dns=1.1.1.1 up instead.\r\n")
@@ -24,9 +24,11 @@ func unlockHandler(stdin io.ReadCloser, stdout io.WriteCloser, stderr io.WriteCl
2424
}
2525
if attempts >= 3 {
2626
// Lock the user for 5 minutes after 3 attempts
27-
ban = time.Now().Add(time.ParseDuration("5m"))
27+
five, _ := time.ParseDuration("5m")
28+
ban = time.Now().Add(five)
2829
return nil
2930
}
31+
attempts += 1
3032
return exec.Command("./unlock.sh", args...).Run()
3133
}
3234

0 commit comments

Comments
 (0)