From 980b4e1801af1a1fb9609f1632718496f21f7203 Mon Sep 17 00:00:00 2001 From: nyxgeek Date: Wed, 16 Oct 2024 00:59:59 -0500 Subject: [PATCH] Added probe to identify copyright year - Added copyright probe - Useful for finding old software - Will display Copyright year if it can find it - Otherwise will display any years found 1990-2024 --- README.md | 2 + common/httpx/copyright.go | 87 +++++++++++++++++++++++++++++++++++++++ runner/options.go | 4 ++ runner/runner.go | 17 ++++++++ runner/types.go | 1 + 5 files changed, 111 insertions(+) create mode 100644 common/httpx/copyright.go diff --git a/README.md b/README.md index db46be5b0..c92e1b8b6 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ | Body Hash | true | Header Hash | true | | Redirect chain | false | URL Scheme | true | | JARM Hash | false | ASN | false | +| Copyright Year | false | # Installation Instructions @@ -106,6 +107,7 @@ PROBES: -lc, -line-count display response body line count -wc, -word-count display response body word count -title display page title + -copyright display copyright years or years if present -bp, -body-preview display first N characters of response body (default 100) -server, -web-server display server name -td, -tech-detect display technology in use based on wappalyzer dataset diff --git a/common/httpx/copyright.go b/common/httpx/copyright.go new file mode 100644 index 000000000..f647c3f79 --- /dev/null +++ b/common/httpx/copyright.go @@ -0,0 +1,87 @@ +package httpx + +import ( + "regexp" + "sort" + "strings" +) + +var crreYear = regexp.MustCompile(`(?:copyright|Copyright|COPYRIGHT|\(C\)|\(c\)|©|©|©)?\s*(?:[a-zA-Z0-9 ,-]+\s*)?[\s,]*(199[0-9]|20[0-1][0-9]|202[0-4])[\s,<-]+(?:copyright|Copyright|COPYRIGHT|\(C\)|\(c\)|©|©|©|199[0-9]|20[0-1][0-9]|202[0-4])?`) + + +func cleanText(text string) string { + text = strings.ReplaceAll(text, "", "") + text = strings.ReplaceAll(text, "", "") + text = strings.ReplaceAll(text, "\u00a0", " ") + text = strings.ReplaceAll(text, "©", "©") + text = strings.ReplaceAll(text, "–", "-") + text = strings.ReplaceAll(text, "-->", "") + text = strings.ReplaceAll(text, "