Created
September 28, 2020 04:49
-
-
Save yehgdotnet/afccccdd27da4a874a0fd4ae6bd71530 to your computer and use it in GitHub Desktop.
Go read url from file (change target to your desired domain)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"regexp" | |
"io/ioutil" | |
"log" | |
"os" | |
) | |
func main() { | |
argsWithoutProg := os.Args[1] | |
content, err := ioutil.ReadFile(argsWithoutProg) | |
if err != nil { | |
log.Fatal(err) | |
} | |
str1 := string(content) | |
re := regexp.MustCompile(`(https:\/\/www\.target\/?)([a-zA-Z0-9\-\.]){1,200}`) | |
//fmt.Printf("Pattern: %v\n", re.String()) // print pattern | |
//fmt.Println(re.MatchString(str1)) // true | |
submatchall := re.FindAllString(str1, -1) | |
for _, element := range submatchall { | |
fmt.Println(element) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment