mirror of
https://github.com/edoardottt/cariddi.git
synced 2026-09-10 03:37:46 +02:00
linting
This commit is contained in:
@@ -118,5 +118,6 @@ func Contains(slice []string, str string) bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -151,12 +151,14 @@ func New(scan *Scan) *Results {
|
||||
filetype := &scanner.FileType{}
|
||||
|
||||
// Skip if no scanning is enabled
|
||||
if !(scan.EndpointsFlag || scan.SecretsFlag || (1 <= scan.FileType && scan.FileType <= 7) || scan.ErrorsFlag || scan.InfoFlag) {
|
||||
if !(scan.EndpointsFlag || scan.SecretsFlag || (1 <= scan.FileType && scan.FileType <= 7) ||
|
||||
scan.ErrorsFlag || scan.InfoFlag) {
|
||||
return
|
||||
}
|
||||
|
||||
// HERE SCAN FOR SECRETS
|
||||
if scan.SecretsFlag && lengthOk && !sliceUtils.Contains(scan.IgnoreExtensions, urlUtils.GetURLExtension(r.Request.URL)) {
|
||||
if scan.SecretsFlag && lengthOk &&
|
||||
!sliceUtils.Contains(scan.IgnoreExtensions, urlUtils.GetURLExtension(r.Request.URL)) {
|
||||
secretsSlice := huntSecrets(r.Request.URL.String(), bodyStr, &scan.SecretsSlice)
|
||||
results.Secrets = append(results.Secrets, secretsSlice...)
|
||||
secrets = append(secrets, secretsSlice...)
|
||||
|
||||
+4
-2
@@ -97,7 +97,8 @@ type Input struct {
|
||||
StoreResp bool
|
||||
// MaxDepth specifies the maximum level the crawler will follow from the initial target URL
|
||||
MaxDepth int
|
||||
// IgnoreExtensions specifies which extensions must be ignored while scanning (Default: png,jpg,jpeg,gif,webp,woff,woff2,tiff,tif)
|
||||
// IgnoreExtensions specifies which extensions must be ignored while scanning
|
||||
// (Default: png,jpg,jpeg,gif,webp,woff,woff2,tiff,tif)
|
||||
IgnoreExtensions StringSlice
|
||||
}
|
||||
|
||||
@@ -150,13 +151,14 @@ func ScanFlag() Input {
|
||||
maxDepth := flag.Int("md", 0, "Maximum depth level the crawler will follow from the initial target URL.")
|
||||
|
||||
var ignoreExtensions StringSlice
|
||||
|
||||
flag.Var(&ignoreExtensions, "ie", "Comma-separated list of extensions to ignore while scanning")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
// Default Extensions to filter
|
||||
if ignoreExtensions == nil {
|
||||
ignoreExtensions.Set(DefaultIgnoreExtensions)
|
||||
_ = ignoreExtensions.Set(DefaultIgnoreExtensions)
|
||||
}
|
||||
|
||||
result := Input{
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
sliceUtils "github.com/edoardottt/cariddi/internal/slice"
|
||||
)
|
||||
|
||||
// StringSlice is a custom flag type for []string
|
||||
// StringSlice is a custom flag type for []string.
|
||||
type StringSlice []string
|
||||
|
||||
func (s *StringSlice) String() string {
|
||||
|
||||
+3
-3
@@ -130,8 +130,6 @@ func WriteSummaryCard(filename string, results, secrets, endpoints, extensions,
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
defer file.Close()
|
||||
|
||||
content := fmt.Sprintf(`<div class="summary-card">
|
||||
<h2>Scan Summary</h2>
|
||||
<p>Scan timestamp: %s</p>
|
||||
@@ -148,7 +146,9 @@ func WriteSummaryCard(filename string, results, secrets, endpoints, extensions,
|
||||
|
||||
_, err = file.WriteString(content)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
file.Close()
|
||||
log.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
file.Close()
|
||||
|
||||
@@ -91,9 +91,12 @@ func TxtOutput(flags input.Input, finalResults []string, finalSecret []scanner.S
|
||||
for _, elem := range finalEndpoints {
|
||||
for _, parameter := range elem.Parameters {
|
||||
var sb strings.Builder
|
||||
|
||||
sb.WriteString(parameter.Parameter)
|
||||
|
||||
if len(parameter.Attacks) > 0 {
|
||||
sb.WriteString(" -")
|
||||
|
||||
for _, attack := range parameter.Attacks {
|
||||
sb.WriteString(" ")
|
||||
sb.WriteString(attack)
|
||||
|
||||
Reference in New Issue
Block a user