daily pastebin goal
19%
SHARE
TWEET

Weiterleitungskette einer URL ausgeben (verbesserte Version)

goebelmasse Jan 25th, 2017 292 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. ########################################################################
  3. #
  4. # location-cascade
  5. # $Id: location-cascade,v 1.2 2017/01/25 12:52:39 elias Exp $
  6. #
  7. # Give a list of HTTP redirections for a given URI.
  8. # Requires lynx.
  9. #
  10. ########################################################################
  11.  
  12. # User-agent
  13. # internet exploiter 10 for best results from spammy sites ;)
  14. UA='Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)'
  15.  
  16. httpcode=0
  17. uri=$1
  18. lasturi="$uri"
  19. while test "$httpcode" -lt 400 -o ! -z "$uri"
  20. do
  21.     set `lynx -useragent="$UA" -mime_header "$uri" 2>&1 |
  22.         sed -e '/^\s*$/q' |
  23.         awk '/^HTTP/ { code = $2 }
  24.                 /^Location/ { uri = $2; gsub("\\r", "", uri) }
  25.                 END { print code, uri }'`
  26.     lasturi="$uri"
  27.     httpcode="$1"
  28.     uri="$2"
  29.     echo "$httpcode\t$lasturi"
  30.     test "$httpcode" -eq 200 && break
  31.     if test "$httpcode" -eq 302
  32.     then
  33.     echo "Found\t$uri"
  34.     break
  35.     fi
  36. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top