forked from jaeles-project/gospider
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
715 additions
and
666 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
package core | ||
|
||
import ( | ||
"regexp" | ||
"strings" | ||
"regexp" | ||
"strings" | ||
) | ||
|
||
var linkFinderRegex = regexp.MustCompile(`(?:"|')(((?:[a-zA-Z]{1,10}://|//)[^"'/]{1,}\.[a-zA-Z]{2,}[^"']{0,})|((?:/|\.\./|\./)[^"'><,;| *()(%%$^/\\\[\]][^"'><,;|()]{1,})|([a-zA-Z0-9_\-/]{1,}/[a-zA-Z0-9_\-/]{1,}\.(?:[a-zA-Z]{1,4}|action)(?:[\?|#][^"|']{0,}|))|([a-zA-Z0-9_\-/]{1,}/[a-zA-Z0-9_\-/]{3,}(?:[\?|#][^"|']{0,}|))|([a-zA-Z0-9_\-]{1,}\.(?:php|asp|aspx|jsp|json|action|html|js|txt|xml)(?:[\?|#][^"|']{0,}|)))(?:"|')`) | ||
|
||
func LinkFinder(source string) ([]string, error) { | ||
var links []string | ||
// source = strings.ToLower(source) | ||
if len(source) > 1000000 { | ||
source = strings.ReplaceAll(source, ";", ";\r\n") | ||
source = strings.ReplaceAll(source, ",", ",\r\n") | ||
} | ||
source = DecodeChars(source) | ||
var links []string | ||
// source = strings.ToLower(source) | ||
if len(source) > 1000000 { | ||
source = strings.ReplaceAll(source, ";", ";\r\n") | ||
source = strings.ReplaceAll(source, ",", ",\r\n") | ||
} | ||
source = DecodeChars(source) | ||
|
||
match := linkFinderRegex.FindAllStringSubmatch(source, -1) | ||
for _, m := range match { | ||
matchGroup1 := FilterNewLines(m[1]) | ||
if matchGroup1 == "" { | ||
continue | ||
} | ||
links = append(links, matchGroup1) | ||
} | ||
links = Unique(links) | ||
return links, nil | ||
match := linkFinderRegex.FindAllStringSubmatch(source, -1) | ||
for _, m := range match { | ||
matchGroup1 := FilterNewLines(m[1]) | ||
if matchGroup1 == "" { | ||
continue | ||
} | ||
links = append(links, matchGroup1) | ||
} | ||
links = Unique(links) | ||
return links, nil | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
package core | ||
|
||
import ( | ||
"os" | ||
"os" | ||
|
||
"github.com/sirupsen/logrus" | ||
prefixed "github.com/x-cray/logrus-prefixed-formatter" | ||
"github.com/sirupsen/logrus" | ||
prefixed "github.com/x-cray/logrus-prefixed-formatter" | ||
) | ||
|
||
var Logger *logrus.Logger | ||
|
||
func init() { | ||
logger := logrus.New() | ||
logger = &logrus.Logger{ | ||
Out: os.Stderr, | ||
Level: logrus.InfoLevel, | ||
Formatter: &prefixed.TextFormatter{ | ||
ForceColors: true, | ||
ForceFormatting: true, | ||
}, | ||
} | ||
Logger = logger | ||
logger := logrus.New() | ||
logger = &logrus.Logger{ | ||
Out: os.Stderr, | ||
Level: logrus.InfoLevel, | ||
Formatter: &prefixed.TextFormatter{ | ||
ForceColors: true, | ||
ForceFormatting: true, | ||
}, | ||
} | ||
Logger = logger | ||
} |
Oops, something went wrong.