repo: uritools
action: commit
revision: 
path_from: 
revision_from: f7511a5076e83dd30a784b707443cc537820a841:
path_to: 
revision_to: 
git.thebackupbox.net
uritools
git clone git://git.thebackupbox.net/uritools
commit f7511a5076e83dd30a784b707443cc537820a841
Author: epoch 
Date:   Sat Jul 29 06:28:22 2023 +0000

    add smtp back and add a missing useragent to a curl

diff --git a/urititle b/urititle
index 36668ea099982d7f9cdeaceb2dd8556074a4c651..
index ..6554c2ac948f321c22a59495163dfe4b3179dc0b 100755
--- a/urititle
+++ b/urititle
@@ -50,7 +50,7 @@ http*)
     if [ "${content_type}" = "text/html" -o "${content_type}" = "application/xhtml+xml" -o "${content_type}" = "" ];then
 #     echo "trying to find  in HTML" >&2
 #    title="$(printf "GET %s HTTP/1.1\r\nHost: %s\r\nUser-Agent: %s\r\n\r\n" "$path" "$domain" "$UA" | ncat -4 $SSL "$domain" "$port" | head -c 10000 | tr -d '\n' | tr '<' '\n' | grep -A 10 '^title>' | grep -B 10 '^\/title>' | cut '-d>' -f2)"
-      title="$(curl -gsi "$uri" | head -c 1000000 | tr -d '\n' | tr '<' '\n' | grep -iA 10 '^title' | grep -iB 10 '^\/title>' | cut '-d>' -f2 | tr '\t' ' ' | sed 's/^ *//g' | sed 's/ *$//g' | grep .)"
+      title="$(curl -A "$UA" -gsi "$uri" | head -c 1000000 | tr -d '\n' | tr '<' '\n' | grep -iA 10 '^title' | grep -iB 10 '^\/title>' | cut '-d>' -f2 | tr '\t' ' ' | sed 's/^ *//g' | sed 's/ *$//g' | grep .)"
       if [ "${content_type}" = "" ];then
         printf "WTF: header: %s\n" "${a_header}"
         printf "WARNING: NO CONTENT-TYPE RETURNED FROM SERVER. Assuming text/html. title: %s\n" "$title" | html_entities_decode
@@ -156,6 +156,12 @@ ssh)
   fi
   printf "title: %s\n" "$(printf "" | nc "$domain" "$port" | head -n1)"
   ;;
+smtp)
+  if [ ! "$port" ];then
+    port=25
+  fi
+  printf "title: %s\n" "$(timeout 5 nc "$domain" "$port" | head -n1)"
+  ;;
 file)
   file="$(uriunescape "$path")"
   if [ -e "$file" ];then
</pre>
<p>-----END OF PAGE-----</p>

</main>
</body>

</html>