daily pastebin goal
78%
SHARE
TWEET

Weiterleitungskette (vereinfachte, robustere Version)

goebelmasse Nov 28th, 2017 (edited) 82 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.5 2017/11/28 20:45:15 elias Exp elias $
  6. #
  7. # Give a list of HTTP redirections for a given URI.
  8. # Requires lynx.
  9. #
  10. ########################################################################
  11.  
  12. # useragent internet exploiter 10 for best results from spammy sites ;)
  13. UA='Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)'
  14.  
  15. tmpfile=/tmp/loccas-$!
  16.  
  17. if [ -z "$1" ]
  18. then
  19.     echo "Usage: `basename $0` <URI>" 1>&2
  20.     exit 1
  21. fi
  22.  
  23. trap "rm -f $tmpfile" 1 2 15
  24. echo $1 >$tmpfile
  25.  
  26. while [ -s $tmpfile ]
  27. do
  28.     uri=`cat $tmpfile`
  29.     lynx -useragent="$UA" -mime_header "$uri" 2>/dev/null |
  30.     sed '/^\s*$/q' |
  31.     grep -i '^Location:' |
  32.     sed -e 's/^[^:]*:\s*//' -e 's/\s$//' |
  33.     tee $tmpfile
  34. done | nl -
  35.  
  36. rm -f $tmpfile
RAW Paste Data
Top