Reorganization to hopefully prevent git conflicts.
This commit is contained in:
		| @@ -12,10 +12,25 @@ fi | ||||
| for l in $3 ; do | ||||
| text="${l#:}" | ||||
| if [[ "${text}" =~ http://|https://|www\..* ]]; then | ||||
| pageTitle="$(curl -L -s --connect-timeout 5 "$text" | sed -n -e 'H;${x;s!.*<head[^>]*>\(.*\)</head>.*!\1!;T;s!.*<title>\(.*\)</title>.*!\1!p}' | w3m -dump -T text/html | tr '[:space:]' ' ')" | ||||
| pageTitle="$(echo "$pageTitle" | tr -cd '[:print:]')" | ||||
| if [[ ${#pageTitle} -gt 1 ]]; then | ||||
| msg "$2" "$pageTitle" | ||||
| fi | ||||
|     # Security: Only allow http:// and https:// protocols | ||||
|     if [[ ! "$text" =~ ^https?:// ]]; then | ||||
|         # Convert www. to http://www. | ||||
|         if [[ "$text" =~ ^www\. ]]; then | ||||
|             text="http://$text" | ||||
|         else | ||||
|             # Skip unknown protocols | ||||
|             continue | ||||
|         fi | ||||
|     fi | ||||
|  | ||||
|     # Remove potentially dangerous shell metacharacters from URL | ||||
|     text="${text//[;&|]/}" | ||||
|  | ||||
|     # Fetch page title with timeout and security limits | ||||
|     pageTitle="$(curl -L -s --connect-timeout 5 --max-time 10 "$text" | sed -n -e 'H;${x;s!.*<head[^>]*>\(.*\)</head>.*!\1!;T;s!.*<title>\(.*\)</title>.*!\1!p}' | w3m -dump -T text/html | tr '[:space:]' ' ')" | ||||
|     pageTitle="$(echo "$pageTitle" | tr -cd '[:print:]')" | ||||
|     if [[ ${#pageTitle} -gt 1 ]]; then | ||||
|         msg "$2" "$pageTitle" | ||||
|     fi | ||||
| fi | ||||
| done | ||||
|   | ||||
		Reference in New Issue
	
	Block a user