Repository navigation
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 |
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? |
Wrap the results in a structAbsolutely ok also with this one. |
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 |
|
@edoardottt Do you happen to have a specific URL that you used for testing that could be used as a benchmark? |
Refactor
|
|
Also CreateColly |
|
@cyb3rjerry I've just updated the devel branch, I've removed the |




Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This discussion will be used to share ideas / roadmap for cariddi v2.
cc @cyb3rjerry
All reactions