Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.83 KB | None | 0 0
  1. #!/bin/bash
  2. proxy_list=proxylst.txt
  3. user_agent_string_list=useragentlst.txt
  4. logfile=mpwget.log
  5. checking_website=http://checker.samair.ru/
  6. function randomline()
  7. {
  8.  NB_LINES=$(expr $(wc -l $1 | sed -e 's/ *//' | cut -f1 -d " "))
  9.  NB_RAND=0
  10.  
  11.  while [ "$NB_RAND" -eq 0 ]
  12.   do
  13.   NB_RAND=$(expr $RANDOM \% $NB_LINES)
  14.   done
  15.  RANDOM_RESULT=$(sed -n "${NB_RAND}p;${NB_RAND}q" $1)
  16. }
  17. function random_uagent()
  18. {
  19.  # picking up a randon user-agent
  20.  randomline useragentlst.txt
  21.  uastring="$RANDOM_RESULT"
  22.  NB_RAND_UA="$NB_RAND"
  23.  NB_LINES_UA="$NB_LINES"
  24.  unset RANDOM_RESULT NB_RAND NB_LINES
  25. }
  26. function partial_get()
  27. {
  28.  while read proxyline
  29.  do
  30.   export http_proxy=$proxyline
  31.   export ftp_proxy=$proxyline
  32.   random_uagent
  33.   wget -v -Q$quota -a $logfile -U "$uastring" $other_param --no-cookies --proxy $getwebsite
  34.  done <$proxy_list
  35. }
  36. function checking_vars()
  37. {
  38.  while read proxyline
  39.  do
  40.   random_uagent
  41.   echo Selected proxy:
  42.   echo $proxyline
  43.   echo
  44.   echo User-Agent $NB_RAND_UA of $NB_LINES_UA Selected:
  45.   echo "$uastring"
  46.  done <$proxy_list
  47. }
  48. if [ $# -ne 1 ]
  49. then
  50.  echo "Syntax: $0 http(s)://YourLink"
  51.  echo "$0 - will wget YourLink behind a proxy from $proxy_list for $quota and then append with the next proxy."
  52.  echo "For each proxy, random User-Agent and random HTTP headers is taken."
  53.  echo "Syntax: $0 check"
  54.  echo "Will wget from the default proxy checker from the var checking_website which is set to: $checking_website"
  55.  echo "Syntax: $0 printonly"
  56.  echo "Will only print every vars on the screen to verify that it does the job."
  57.  exit 1
  58. elif [ ${1%:*} = 'http' ]
  59. then
  60.   getwebsite="$1"
  61.   other_param= '-c'
  62.   partial_get
  63. elif [ $1 = 'check' ]
  64. then
  65.   getwebsite="$checking_website"
  66.   partial_get
  67. elif [ $1 = 'printonly' ]
  68. then
  69.   checking_vars
  70. else
  71.   echo "Moooooooooo !"
  72. fi
  73. unset http_proxy ftp_proxy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement