Add Proxy mode #13

This commit is contained in:
edoardottt
2021-09-22 17:34:12 +02:00
parent a9f559a268
commit bd0e747183
6 changed files with 25 additions and 6 deletions
+5 -2
View File
@@ -129,6 +129,8 @@ Usage of cariddi:
Write the output into a TXT file.
-plain
Print only the results.
-proxy string
Set a Proxy to be used (http and socks5 supported).
-rua
Use a random browser user agent on every request.
-s Hunt for secrets.
@@ -163,6 +165,7 @@ Examples 💡
- `cat urls | cariddi -t 5` (Set the timeout for the requests)
- `cat urls | cariddi -intensive` (Crawl searching for any resource under 2nd level domain (`*.target.com`))
- `cat urls | cariddi -rua` (Use a random browser user agent on every request)
- `cat urls | cariddi -proxy http://127.0.0.1:8080` (Set a Proxy to be used (http and socks5 supported))
- For Windows:
- use `powershell.exe -Command "cat urls | .\cariddi.exe"` inside the Command prompt
@@ -185,11 +188,11 @@ A special thanks to:
- [ ] Tests (😂)
- [ ] Tor support
- [ ] Proxy support
- [ ] Cookie support
- [x] Proxy support
- [x] Ignore specific types of urls
- [x] Plain output (print only results)
+11 -2
View File
@@ -40,8 +40,8 @@ import (
//Crawler it's the actual crawler core
func Crawler(target string, txt string, html string, delayTime int, concurrency int, ignore string,
ignoreTxt string, cache bool, timeout int, intensive bool, rua bool, secrets bool, secretsFile []string,
plain bool, endpoints bool, endpointsFile []string,
ignoreTxt string, cache bool, timeout int, intensive bool, rua bool, proxy string, secrets bool,
secretsFile []string, plain bool, endpoints bool, endpointsFile []string,
fileType int) ([]string, []scanner.SecretMatched, []scanner.EndpointMatched, []scanner.FileTypeMatched) {
// This is to avoid to insert into the crawler target regular
@@ -124,6 +124,15 @@ func Crawler(target string, txt string, html string, delayTime int, concurrency
extensions.RandomUserAgent(c)
}
// Use a Proxy if needed
if proxy != "" {
err := c.SetProxy(proxy)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
// On every a element which has href attribute call callback
c.OnHTML("a[href]", func(e *colly.HTMLElement) {
link := e.Attr("href")
+3
View File
@@ -43,6 +43,7 @@ type Input struct {
Timeout int
Intensive bool
Rua bool
Proxy string
Secrets bool
SecretsFile string
Endpoints bool
@@ -68,6 +69,7 @@ func ScanFlag() Input {
timeoutPtr := flag.Int("t", 10, "Set timeout for the requests.")
intensivePtr := flag.Bool("intensive", false, "Crawl searching for resources matching 2nd level domain.")
ruaPtr := flag.Bool("rua", false, "Use a random browser user agent on every request.")
proxyPtr := flag.String("proxy", "", "Set a Proxy to be used (http and socks5 supported).")
secretsPtr := flag.Bool("s", false, "Hunt for secrets.")
secretsFilePtr := flag.String("sf", "", "Use an external file (txt, one per line) to use custom regexes for secrets hunting.")
@@ -94,6 +96,7 @@ func ScanFlag() Input {
*timeoutPtr,
*intensivePtr,
*ruaPtr,
*proxyPtr,
*secretsPtr,
*secretsFilePtr,
*endpointsPtr,
+1 -1
View File
@@ -92,7 +92,7 @@ func main() {
results, secrets, endpoints, extensions := crawler.Crawler(inp, ResultTxt, ResultHtml, flags.Delay,
flags.Concurrency, flags.Ignore, flags.IgnoreTxt, flags.Cache, flags.Timeout, flags.Intensive,
flags.Rua, flags.Secrets, secretsFileSlice, flags.Plain, flags.Endpoints, endpointsFileSlice,
flags.Rua, flags.Proxy, flags.Secrets, secretsFileSlice, flags.Plain, flags.Endpoints, endpointsFileSlice,
flags.Extensions)
finalResults = append(finalResults, results...)
+3 -1
View File
@@ -65,5 +65,7 @@ func PrintExamples() {
cat urls | cariddi -intensive (Crawl searching for resources matching 2nd level domain)
cat urls | cariddi -rua (Use a random browser user agent on every request)`)
cat urls | cariddi -rua (Use a random browser user agent on every request)
cat urls | cariddi -proxy http://127.0.0.1:8080 (Set a Proxy to be used (http and socks5 supported))`)
}
+2
View File
@@ -55,6 +55,8 @@ func PrintHelp() {
Write the output into a TXT file.
-plain
Print only the results.
-proxy string
Set a Proxy to be used (http and socks5 supported).
-rua
Use a random browser user agent on every request.
-s Hunt for secrets.