Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delay jitter #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/bruteforce.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sync"
"sync/atomic"
"time"
"math/rand/v2"

"github.com/ropnop/kerbrute/util"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -72,7 +73,7 @@ Scan:
logger.Log.Debug("[!] Skipping: %q - %v", comboline, err.Error())
continue
}
time.Sleep(time.Duration(delay) * time.Millisecond)
time.Sleep(time.Duration(delay + rand.IntN(jitter)) * time.Millisecond)
combosChan <- [2]string{username, password}
}
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/bruteuser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sync"
"sync/atomic"
"time"
"math/rand/v2"

"github.com/ropnop/kerbrute/util"

Expand Down Expand Up @@ -72,7 +73,7 @@ Scan:
break Scan
default:
password = scanner.Text()
time.Sleep(time.Duration(delay) * time.Millisecond)
time.Sleep(time.Duration(delay + rand.IntN(jitter)) * time.Millisecond)
passwordsChan <- password
}
}
Expand Down
1 change: 1 addition & 0 deletions cmd/kerbrute.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func init() {
rootCmd.PersistentFlags().BoolVar(&safe, "safe", false, "Safe mode. Will abort if any user comes back as locked out. Default: FALSE")
rootCmd.PersistentFlags().IntVarP(&threads, "threads", "t", 10, "Threads to use")
rootCmd.PersistentFlags().IntVarP(&delay, "delay", "", 0, "Delay in millisecond between each attempt. Will always use single thread if set")
rootCmd.PersistentFlags().IntVarP(&jitter, "jitter", "", 1, "Delay jitter in millisecond between each attempt. Ignored if delay is not set")
rootCmd.PersistentFlags().BoolVar(&downgrade, "downgrade", false, "Force downgraded encryption type (arcfour-hmac-md5)")
rootCmd.PersistentFlags().StringVar(&hashFileName, "hash-file", "", "File to save AS-REP hashes to (if any captured), otherwise just logged")
if delay != 0 {
Expand Down
3 changes: 2 additions & 1 deletion cmd/passwordspray.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sync"
"sync/atomic"
"time"
"math/rand/v2"

"github.com/ropnop/kerbrute/util"

Expand Down Expand Up @@ -88,7 +89,7 @@ Scan:
logger.Log.Debugf("[!] %q - %v", usernameline, err.Error())
continue
}
time.Sleep(time.Duration(delay) * time.Millisecond)
time.Sleep(time.Duration(delay + rand.IntN(jitter)) * time.Millisecond)
usersChan <- username
}
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var (
verbose bool
safe bool
delay int
jitter int
threads int
stopOnSuccess bool
userAsPass = false
Expand Down Expand Up @@ -54,6 +55,6 @@ func setupSession(cmd *cobra.Command, args []string) {
logger.Log.Infof("\t%s\n", v)
}
if delay != 0 {
logger.Log.Infof("Delay set. Using single thread and delaying %dms between attempts\n", delay)
logger.Log.Infof("Delay set. Using single thread and delaying %dms (%dms jitter) between attempts\n", delay, jitter)
}
}
3 changes: 2 additions & 1 deletion cmd/userenum.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sync"
"sync/atomic"
"time"
"math/rand/v2"

"github.com/ropnop/kerbrute/util"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -66,7 +67,7 @@ Scan:
logger.Log.Debugf("[!] %q - %v", usernameline, err.Error())
continue
}
time.Sleep(time.Duration(delay) * time.Millisecond)
time.Sleep(time.Duration(delay + rand.IntN(jitter)) * time.Millisecond)
usersChan <- username
}
}
Expand Down