mirror of
https://github.com/edoardottt/cariddi.git
synced 2026-09-10 11:47:45 +02:00
update
This commit is contained in:
+1
-1
@@ -346,7 +346,7 @@ func huntSecrets(secretsFile []string, target string, body string) []scanner.Sec
|
||||
func SecretsMatch(url string, body string, secretsFile []string) []scanner.SecretMatched {
|
||||
var secrets []scanner.SecretMatched
|
||||
if len(secretsFile) == 0 {
|
||||
for _, secret := range scanner.GetRegexes() {
|
||||
for _, secret := range scanner.GetSecretRegexes() {
|
||||
if matched, err := regexp.Match(secret.Regex, []byte(body)); err == nil && matched {
|
||||
re := regexp.MustCompile(secret.Regex)
|
||||
match := re.FindStringSubmatch(body)
|
||||
|
||||
@@ -29,3 +29,22 @@ type ErrorMatched struct {
|
||||
Error Error
|
||||
Url string
|
||||
}
|
||||
|
||||
//GetErrorRegexes returns all the error regexes
|
||||
func GetErrorRegexes() []Error {
|
||||
var regexes = []Error{
|
||||
{
|
||||
"PHP error",
|
||||
`(php warning|php error|include_path|undefined index|undefined variable|\\?php|expects parameter [0-9]*)`,
|
||||
},
|
||||
{
|
||||
"General error",
|
||||
`(((fatal|critical|severe|high|medium) error)|uncaught exception)`,
|
||||
},
|
||||
{
|
||||
"Debug information",
|
||||
`(Debug trace|stack trace\\:)`,
|
||||
},
|
||||
}
|
||||
return regexes
|
||||
}
|
||||
|
||||
+2
-15
@@ -39,8 +39,8 @@ type SecretMatched struct {
|
||||
Match string
|
||||
}
|
||||
|
||||
//GetRegexes returns all the regexes
|
||||
func GetRegexes() []Secret {
|
||||
//GetSecretRegexes returns all the secret regexes
|
||||
func GetSecretRegexes() []Secret {
|
||||
var regexes = []Secret{
|
||||
{
|
||||
"AWS Access Key",
|
||||
@@ -327,16 +327,3 @@ func GetRegexes() []Secret {
|
||||
}
|
||||
return regexes
|
||||
}
|
||||
|
||||
//RemoveDuplicateSecrets removes duplicates from secrets found
|
||||
func RemoveDuplicateSecrets(input []SecretMatched) []SecretMatched {
|
||||
keys := make(map[string]bool)
|
||||
list := []SecretMatched{}
|
||||
for _, entry := range input {
|
||||
if _, value := keys[entry.Url]; !value {
|
||||
keys[entry.Url] = true
|
||||
list = append(list, entry)
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user