mirror of
https://github.com/edoardottt/cariddi.git
synced 2026-09-22 17:44:58 +02:00
42 lines
653 B
Go
42 lines
653 B
Go
package input
|
|
|
|
import (
|
|
"bufio"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
//ScanInput return the array of elements
|
|
//taken as input on stdin.
|
|
func ScanTargets() []string {
|
|
|
|
var result []string
|
|
|
|
// accept domains on stdin
|
|
sc := bufio.NewScanner(os.Stdin)
|
|
for sc.Scan() {
|
|
domain := strings.ToLower(sc.Text())
|
|
result = append(result, domain)
|
|
}
|
|
return result
|
|
}
|
|
|
|
//RemovePort
|
|
func RemovePort(input string) string {
|
|
res := strings.Index(input, ":")
|
|
if res >= 0 {
|
|
return input[:res-1]
|
|
}
|
|
return input
|
|
}
|
|
|
|
//RemoveHeaders
|
|
func RemoveHeaders(input string) string {
|
|
res := strings.Index(input, "://")
|
|
if res >= 0 {
|
|
return input[res+3:]
|
|
} else {
|
|
return input
|
|
}
|
|
}
|