Hunter Black Hat SEO
Server:LiteSpeed
System:Linux quebec.us.hostns.io 5.14.0-687.42.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 27 11:55:12 EDT 2026 x86_64
User:gazetufm (1431)
PHP:8.1.35
Disabled:NONE
Upload Files
File: //opt/ptr-test
#!/bin/bash
# Return primary PTR hostname for an IP (no trailing dot), or empty if none.
ip="${1:?}"
ptr=

if command -v dig >/dev/null 2>&1; then
  ptr=$(dig +short -x "$ip" 2>/dev/null | grep -Ev '^;|^[[:space:]]*$' | head -1 | sed 's/\.$//')
fi

if [ -z "$ptr" ] && command -v host >/dev/null 2>&1; then
  ptr=$(host -t PTR "$ip" 2>/dev/null | awk '/pointer/ { gsub(/\.$/, "", $NF); print $NF; exit }')
fi

printf '%s' "$ptr"