mirror of
https://github.com/bettercap/bettercap
synced 2025-07-31 12:10:10 -07:00
new: parsing BLE flags and company identifiers from advertisements
This commit is contained in:
parent
7f68d0d82c
commit
f72dac0c95
253 changed files with 37143 additions and 487 deletions
66
vendor/github.com/nbutton23/zxcvbn-go/matching/repeatMatch.go
generated
vendored
Normal file
66
vendor/github.com/nbutton23/zxcvbn-go/matching/repeatMatch.go
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
package matching
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/nbutton23/zxcvbn-go/entropy"
|
||||
"github.com/nbutton23/zxcvbn-go/match"
|
||||
)
|
||||
|
||||
const REPEAT_MATCHER_NAME = "REPEAT"
|
||||
|
||||
func FilterRepeatMatcher(m match.Matcher) bool {
|
||||
return m.ID == REPEAT_MATCHER_NAME
|
||||
}
|
||||
|
||||
func repeatMatch(password string) []match.Match {
|
||||
var matches []match.Match
|
||||
|
||||
//Loop through password. if current == prev currentStreak++ else if currentStreak > 2 {buildMatch; currentStreak = 1} prev = current
|
||||
var current, prev string
|
||||
currentStreak := 1
|
||||
var i int
|
||||
var char rune
|
||||
for i, char = range password {
|
||||
current = string(char)
|
||||
if i == 0 {
|
||||
prev = current
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.ToLower(current) == strings.ToLower(prev) {
|
||||
currentStreak++
|
||||
|
||||
} else if currentStreak > 2 {
|
||||
iPos := i - currentStreak
|
||||
jPos := i - 1
|
||||
matchRepeat := match.Match{
|
||||
Pattern: "repeat",
|
||||
I: iPos,
|
||||
J: jPos,
|
||||
Token: password[iPos : jPos+1],
|
||||
DictionaryName: prev}
|
||||
matchRepeat.Entropy = entropy.RepeatEntropy(matchRepeat)
|
||||
matches = append(matches, matchRepeat)
|
||||
currentStreak = 1
|
||||
} else {
|
||||
currentStreak = 1
|
||||
}
|
||||
|
||||
prev = current
|
||||
}
|
||||
|
||||
if currentStreak > 2 {
|
||||
iPos := i - currentStreak + 1
|
||||
jPos := i
|
||||
matchRepeat := match.Match{
|
||||
Pattern: "repeat",
|
||||
I: iPos,
|
||||
J: jPos,
|
||||
Token: password[iPos : jPos+1],
|
||||
DictionaryName: prev}
|
||||
matchRepeat.Entropy = entropy.RepeatEntropy(matchRepeat)
|
||||
matches = append(matches, matchRepeat)
|
||||
}
|
||||
return matches
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue