Cariddi v2 #94
Replies: 9 comments 13 replies
-
👋 So here would be my initial proposed changes Wrap the New() params into a single object.The benefits of this would be better readability, better control over the mutability of the object considering multiple instances of it can be spawned and would be a little more idiomatic from a Go perspective. func New(scanCtx *ScanCtx){
...
} Where the ScanCtx struct could look like: type ScanCtx struct {
Debug bool
ErrorsFlags bool
EndpointsFlag bool
EndpointsFile bool
InfoFlag bool
Insecure bool
Plain bool
SecretsFlag bool
FileType int
DelayTime int
Threads int
Html string
Ignore string
Target string
Txt string
SecretsFile []string
Headers map[string]string
} Wrap the results in a struct that has a sync.Mutex to prevent data racesSimilarily to my previous point, we could also return a single object that has a Mutex attribute to make sure we don't cause data races when writing them. The object could look something like type Results struct {
Mutex sync.Mutex
Results []string
Secrets []scanner.SecretsMatched
Endpoints []scanner.EndpointMatched
Extensions []scanner.FileTypeMatched
Errors []scanner.ErrorMatched
Infos []scanner.InfoMatched
} We could then easily write to the object by doing something like: results.Mutex.Lock()
results.Results = append(results.Results, something...)
results.Mutex.Unlock() A good example of how to use Mutexes to prevent race conditions can be seen here |
Beta Was this translation helpful? Give feedback.
-
Wrap the New() params into a single object.Absolutely ok for this one. Regarding the struct, it should contain all the parameters passed to the New function now, something like this: type Scan struct {
Target string
Txt string
Html string
Delay int
Concurrency int
Ignore string
IgnoreTxt string
Cache bool
Timeout int
Intensive bool
Rua bool
Proxy string
Insecure bool
SecretsFlag bool
SecretsFile []string
Plain bool
EndpointsFlag bool
EndpointsFile []string
FileType int
Headers map[string]string
ErrorsFlag bool
InfoFlag bool
Debug bool
UserAgent string
} Moreover, I think that also CreateColly function Line 322 in 4d59028 can take that struct as input. What do you think? |
Beta Was this translation helpful? Give feedback.
-
Wrap the results in a structAbsolutely ok also with this one. |
Beta Was this translation helpful? Give feedback.
-
Prevent data racesIt's up to you to decide which method to use, I'm okay both with mutex or channels. P.S. With millions of URLs crawled, remove duplicates could be a huge bottleneck, we should think carefully on which method to use |
Beta Was this translation helpful? Give feedback.
-
@edoardottt Do you happen to have a specific URL that you used for testing that could be used as a benchmark? |
Beta Was this translation helpful? Give feedback.
-
Improve RegexI think we might eventually want to add a little more specificity to the Regex rules as they currently tend to return false positives |
Beta Was this translation helpful? Give feedback.
-
Refactor
|
Beta Was this translation helpful? Give feedback.
-
Also CreateColly |
Beta Was this translation helpful? Give feedback.
-
@cyb3rjerry I've just updated the devel branch, I've removed the |
Beta Was this translation helpful? Give feedback.
-
This discussion will be used to share ideas / roadmap for cariddi v2.
cc @cyb3rjerry
Beta Was this translation helpful? Give feedback.
All reactions