Skip to content

Commit

Permalink
[+]新增redis指纹
Browse files Browse the repository at this point in the history
  • Loading branch information
lcvvvv committed Jan 10, 2022
1 parent 2812a33 commit e14752f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/hydra/hydra.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ func InitDefaultAuthMap() {

func InitCustomAuthMap(user, pass []string) {
CustomAuthMap = NewAuthList()
CustomAuthMap.Password = user
CustomAuthMap.Username = pass
CustomAuthMap.Username = user
CustomAuthMap.Password = pass
}

func Ok(protocol string) bool {
Expand Down Expand Up @@ -177,5 +177,5 @@ func (c *Cracker) OutWatchDog() {
}

func (c *Cracker) Length() int {
return len(c.authList.Password) + len(c.authList.Username) + len(c.authList.Special)
return c.authList.Length()
}
21 changes: 17 additions & 4 deletions lib/hydra/type-authlist.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package hydra

import "kscan/lib/misc"
import (
"kscan/lib/misc"
)

type AuthList struct {
Username []string
Expand All @@ -15,7 +17,7 @@ func NewAuthList() *AuthList {
}

func (a *AuthList) IsEmpty() bool {
if len(a.Username) > 0 && len(a.Password) > 0 {
if len(a.Username) > 0 || len(a.Password) > 0 {
return false
}
return true
Expand All @@ -30,9 +32,20 @@ func (a *AuthList) Merge(list *AuthList) {
}

func (a *AuthList) Replace(list *AuthList) {
a.Username = list.Username
a.Password = list.Password
if len(list.Username) > 0 {
a.Username = list.Username
}
if len(list.Password) > 0 {
a.Password = list.Password
}
a.Special = list.Special
a.Username = misc.RemoveDuplicateElement(a.Username)
a.Password = misc.RemoveDuplicateElement(a.Password)
}

func (a *AuthList) Length() int {
if len(a.Username) == 0 {
return len(a.Password) + len(a.Special)
}
return (len(a.Password) * len(a.Username)) + len(a.Special)
}

0 comments on commit e14752f

Please sign in to comment.