Skip to content

Commit 8537fce

Browse files
committed
Extension Filter Added.
1 parent 5ed4f84 commit 8537fce

1 file changed

Lines changed: 33 additions & 4 deletions

File tree

main.go

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const (
3737
colorGreen = "\033[32m"
3838
colorYellow = "\033[33m"
3939
colorBlue = "\033[34m"
40-
VERSION = "1.0.2"
40+
VERSION = "1.0.3"
4141
)
4242

4343
func (i *arrayFlags) Set(value string) error {
@@ -91,6 +91,7 @@ func main() {
9191
}
9292

9393
_, _ = os.Create(outputFile)
94+
allUrls = clearUrls(allUrls)
9495
allUrls = unique(allUrls)
9596

9697
channel := make(chan string, len(allUrls))
@@ -101,9 +102,11 @@ func main() {
101102

102103
for i := 0; i < thread; i++ {
103104
wg.Add(1)
104-
go showResult(channel)
105+
go saveResult(channel)
105106
}
106107
wg.Wait()
108+
gologger.Info().Msg(fmt.Sprintf("Parameter wordlist %ssuccessfully%s generated and saved to %s%s%s.",
109+
colorGreen, colorReset, colorBlue, outputFile, colorReset))
107110
}
108111

109112
func readInput(input string) []string {
@@ -364,13 +367,15 @@ func unique(strSlice []string) []string {
364367
for _, entry := range strSlice {
365368
if _, value := keys[entry]; !value {
366369
keys[entry] = true
367-
list = append(list, entry)
370+
if entry != "" {
371+
list = append(list, entry)
372+
}
368373
}
369374
}
370375
return list
371376
}
372377

373-
func showResult(channel chan string) {
378+
func saveResult(channel chan string) {
374379
defer wg.Done()
375380
for v := range channel {
376381
for _, i := range unique(findParameter(v)) {
@@ -416,6 +421,30 @@ func checkUpdate() {
416421

417422
}
418423

424+
func clearUrls(links []string) []string {
425+
badExtensions := []string{
426+
".css", ".jpg", ".jpeg", ".png", ".svg", ".img", ".gif", ".exe", ".mp4", ".flv", ".pdf", ".doc", ".ogv", ".webm", ".wmv",
427+
".webp", ".mov", ".mp3", ".m4a", ".m4p", ".ppt", ".pptx", ".scss", ".tif", ".tiff", ".ttf", ".otf", ".woff", ".woff2", ".bmp",
428+
".ico", ".eot", ".htc", ".swf", ".rtf", ".image", ".rf"}
429+
var result []string
430+
431+
for _, link := range links {
432+
isGoodUrl := true
433+
u, _ := url.Parse(link)
434+
435+
for _, ext := range badExtensions {
436+
if strings.HasSuffix(strings.ToLower(u.Path), ext) {
437+
isGoodUrl = false
438+
}
439+
}
440+
441+
if isGoodUrl {
442+
result = append(result, link)
443+
}
444+
}
445+
return result
446+
}
447+
419448
func checkError(e error) {
420449
if e != nil {
421450
fmt.Println(e.Error())

0 commit comments

Comments
 (0)