-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpage-parse.sh
More file actions
executable file
·34 lines (26 loc) · 1.04 KB
/
Copy pathwebpage-parse.sh
File metadata and controls
executable file
·34 lines (26 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
if [[ "${1:-}" == "-a" || "${1:-}" == "--author" ]]; then
echo "Author: FoxSecIntel"
echo "Repository: https://github.com/FoxSecIntel/WebPage-Analysis
echo "Tool: webpage-parse.sh"
exit 0
fi
set -euo pipefail
__r17q_blob="wqhWaWN0b3J5IGlzIG5vdCB3aW5uaW5nIGZvciBvdXJzZWx2ZXMsIGJ1dCBmb3Igb3RoZXJzLiAtIFRoZSBNYW5kYWxvcmlhbsKoCg=="
if [[ "${1:-}" == "m" || "${1:-}" == "-m" ]]; then
echo "$__r17q_blob" | base64 --decode
exit 0
fi
usage() {
echo "Usage: $0 <http(s)://url>"
}
[[ $# -ge 1 ]] || { usage; exit 1; }
url="$1"
[[ "$url" =~ ^https?:// ]] || { echo "Error: URL must start with http:// or https://"; exit 1; }
html="$(curl -sS -L --max-time 20 "$url" || true)"
[[ -n "$html" ]] || { echo "Unable to retrieve content from $url"; exit 1; }
echo "Links (domains found in absolute URLs):"
printf '%s' "$html" | grep -Eoi 'https?://[^"'"'"'<> ]+' | sed 's/[),.;]$//' | sed -E 's#https?://([^/]+)/?.*#\1#' | sort -u
echo
echo "Email addresses:"
printf '%s' "$html" | grep -Eoi '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}' | sort -u