sxiii

Automatic Site Surf & Click Script

Sep 11th, 2011
807
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.56 KB | None | 0 0
  1. #!/bin/bash
  2. trap ctrl_c INT
  3. date=$(date +%d.%m.%g)
  4. datetime=$(date)
  5.  
  6. # This is SUPER AUTO SURF SCRIPT v. 7. You can edit configuration from on this line
  7. # This script visits sites you want by simulating real-user surf, clicks on the banners/link/places
  8. # you want. Each visit is unique since performed through new Tor identity (each time - new IP).
  9. # For details, look inside the README file.
  10.  
  11. # SURFING
  12. # Surf link to visit, seconds delay between opening links and links quantity.
  13.  
  14. SURFLINK="new.lady61.ru" # Link to surf
  15. SECSFROM="60" # Random seconds delay time, from
  16. SECSTO="120"  # Random seconds delay time, to
  17. LINKSFROM="1" # Random links quantity, from
  18. LINKSTO="5" # Random links quantity, to
  19.  
  20. # TORCONFIG
  21. # NOTE: PROXYTYPE can be either --socks5 (Socks5 proxy) or --proxy (for HTTP proxy)
  22. # This config is for CURL (read man curl for details)
  23. # IN case of socks5 (working without polipo or any other caching proxy) you probably want port 9050 (standart tor port)
  24. # IN case of HTTP proxy (working with caching proxy to fast-up pages loading) you probably want port 8123 (standart polipo port)
  25. # Always don't forget to check for polipo and / or tor running and properly configured!
  26.  
  27. PROXYTYPE="--proxy" # Proxy type
  28. TORIP="127.0.0.1" # Tor IP
  29. TORPORT="8123" # Tor port
  30.  
  31. # GET IP NON-CACHING PROXY CONFIG
  32. # I've created separated config for getting your IP with CURL proxy because of caching proxy was sometimes returning thesame IP.
  33. # Don't tunnel process of getting new IP through caching proxy or script will not get new IP.
  34. # Note: this config is only for getting the IP, but webpages loaded with curl WILL USE previous config and WILL BE cached.
  35.  
  36. GETIPPROXYTYPE="--socks" # We use socks to connect directly to Tor without polipo caching
  37. GETIP="127.0.0.1" # In some cases this address might be different, so I leave this also
  38. GETIPPORT="9050" # Tor standard port is 9050
  39.  
  40. # CREATED FILES
  41. # Defining names of files needed for this script to work.
  42.  
  43. USERAGENTFILE="./useragents.list" # File handling the user agent list
  44. LINKSFILE="./links.tmp" # Internal (temporary) links list
  45. COOKIEFILE="./cookies.jar" # Cookies to simulate industrial browsers
  46.  
  47. # LOGGING
  48. # Here you can define SMTP server to send results
  49. # Also here you can define admin(s) email address (divide multiple addresses by comma (,))
  50.  
  51. USELOG="1" # Set this to 0 or comment it out to disable logging
  52. SENDLOG="1" # Set this to 0 or comment it out to disable sending log to email
  53. MINIMUM="5" # Set minimum number of different IP visits to send log (useful for debugging)
  54. SMTP="213.27.31.134" # SMTP server domain name or IP address
  55. EMAILFROM="[email protected]" # Source email address (mail from)
  56. EMAILTO="[email protected],[email protected]" # Destanation email address (can be divided by comma (,))
  57. LOGFILE="./logs/$date.log" # Internal log file with a datestamp
  58. IPLIST="./ips/$date.ip.list" # Internal IP list with a datestamp
  59.  
  60. # FIREFOX, CURL OR BOTH?
  61. # You can enable or disable firefox startup. Disable firefox startup if you want only to improve your site visitor's count.
  62. # Otherwise, you can enable both firefox and curl. It will be possible for you to press on your website's advertisements
  63. # or do any job on your website (maybe simulate additional visits or whatever) while script is working. But don't forget to
  64. # configure firefox to use tor or polipo proxy accordingly! Set FIREFOX=1 to load them both.
  65. FIREFOX="1" # Run firefox or not?
  66. AUTOCLICK="1" # If firefox will run, do the autoclick?
  67. AUTOCLICKFROM="100" # MINIMAL NUMBER OF AUTOCLICKS
  68. AUTOCLICKTO="150" # MAXIMAL NUMBER OF AUTOCLICKS
  69.  
  70. # MOUSECLICK COORDINATES & QUANTITY
  71. # How to get mouse coordinates?
  72. # Use command (without quotes) "sleep 5; xdotool getmouselocation"
  73. # Run this command in terminal, fast switch to browser and put your mouse over link. Wait few seconds (you have to do it faster than 5 secs).
  74. # Get back to the terminal, you will have the X and Y coordinates of the link or banner you want. Write them down here.
  75. # Note: if your site needs scroll, count how much times and set the SCROLL= variable.
  76. # Note2: while script is runned and automatic actions enabled it is not recommended to move your mouse or click action will fail.
  77.  
  78. SCROLL="23" # How much times to scroll
  79. CLICKQUANTITY="5" # How much times to click (IMPORTANT! Array had to have similar quantity of X and Y coordinates!)
  80. MOUSEX=( 164 608 597 1035 1054 ) # Array of X coordinates for each click
  81. MOUSEY=( 641 199 265 525 692 ) # Array of Y coordinates for each click
  82. MOUSEBTN=2 # Which mouse button to click? 1 = left click (open link in the same tab), 2 = middle click (open link in new tab), 3 = right click (open context menu), etc.
  83.  
  84. # Which program use for HTML parsing - html2text or lynx?
  85. # html2text might sometimes be buggy
  86. # Use HTMLPARSER="html2text" or HTMLPARSER="lynx --dump -stdin"
  87. HTMLPARSER="lynx --dump -stdin"
  88.  
  89. # DO NOT EDIT UNDER THIS LINE
  90. currentpage=$SURFLINK
  91. count=0
  92.  
  93. number1=0
  94. while [ "$number1" -le "$AUTOCLICKFROM" ]
  95. do
  96.   number1=$RANDOM
  97.   let "number1 %= $AUTOCLICKTO"
  98. done
  99. autoclickrate=$number1
  100.  
  101. mkdir -p ips && mkdir -p logs
  102.  
  103. [ ! -f "$IPLIST" ] && ( echo "This IP list was created on $datetime." > $IPLIST )
  104. [ ! -f "$LOGFILE" -a "$USELOG" = "1" ] && ( echo "This log file was created on $datetime." > $LOGFILE )
  105.  
  106. echo "This script loads website from different IPs using Tor."
  107. echo "Ensure that you have every staff configured & working or you will get errors. Read README file."
  108. [ "$USELOG" = "1" ]  && ( echo "Script started @ $datetime" >> $LOGFILE )
  109.  
  110. function hello {
  111.  
  112. ip=$(curl --silent $GETIPPROXYTYPE $GETIP:$GETIPPORT http://whatismyip.org)
  113. [ "$ip" = "" ] && ( ip=$(curl --silent $GETIPPROXYTYPE $GETIP:$GETIPPORT http://www.sputnick-area.net/ip) )
  114. [ "$ip" = "" ] && ( ip=$(curl --silent $GETIPPROXYTYPE $GETIP:$GETIPPORT http://ifconfig.me) )
  115. [ "$ip" = "" ] && ( ip=$(curl --silent $GETIPPROXYTYPE $GETIP:$GETIPPORT http://ip.appspot.com) )
  116.  
  117. if grep -Fxq "$ip" $IPLIST
  118. then
  119.    echo "This IP ($ip) was already used. Switching to another..."
  120.    sleep 5
  121.    changeip
  122.    hello
  123. else
  124.    time=$(date +%H:%M:%S)
  125.    count=$(($count+1))
  126.    echo "Found new IP $ip. Using it..."
  127.    [ "$USELOG" = "1" ]  && ( echo "$time - used $ip. Total: $count" >> $LOGFILE )
  128.    [ "$USELOG" = "1" ]  && ( curl --silent $GETIPPROXYTYPE $GETIP:$GETIPPORT -s "http://www.geoiptool.com/?IP=$1" | $HTMLPARSER | egrep --color 'City:|IP Address:|Country:' >> $LOGFILE )
  129.    randomagent
  130.    echo "Choosing $rndagent as user agent for surf."
  131.    [ "$USELOG" = "1" ]  && ( echo "Used agent: $rndagent" >> $LOGFILE )
  132.    getlinks
  133.    echo "Surf using $ip finished, adding it to database... Totally surfed from $count IPs."
  134.    echo $ip >> $IPLIST
  135.    sleep 5
  136.    changeip
  137.    hello
  138. fi  
  139.  
  140. }
  141.  
  142. function sleeping {
  143. number=0
  144. while [ "$number" -le "$SECSFROM" ]
  145. do
  146.   number=$RANDOM
  147.   let "number %= $SECSTO"
  148. done
  149. echo "Sleeping for random $number seconds"
  150. sleep $number
  151. }
  152.  
  153.  
  154. function changeip {
  155. /usr/bin/expect -f torci.sh > /dev/null
  156. echo "IP successfully changed."
  157. }
  158.  
  159. function randomagent {
  160.  
  161. lines=$(wc -l < $USERAGENTFILE)
  162. (( R = 2**15-1, T = 10**8-1, C = T/R ))
  163. randseed=$(printf "%8.8u\n" $(( RANDOM*C + ( RANDOM%C ) )))
  164. rndagent=$(cat $USERAGENTFILE | awk -v COUNT=$lines -v SEED=$randseed 'BEGIN { srand(SEED); i=int(rand()*COUNT) } FNR==i { print $0 }' )
  165.  
  166. }
  167.  
  168. function randomlink {
  169.  
  170. lines=$(wc -l < $LINKSFILE)
  171. (( R = 2**15-1, T = 10**8-1, C = T/R ))
  172. randseed=$(printf "%8.8u\n" $(( RANDOM*C + ( RANDOM%C ) )))
  173. prelink=$(cat $LINKSFILE | awk -v COUNT=$lines -v SEED=$randseed 'BEGIN { srand(SEED); i=int(rand()*COUNT) } FNR==i { print $0 }' )
  174. currentpage="http://$SURFLINK$prelink"
  175.  
  176. }
  177.  
  178. function ctrl_c() {
  179. [ "$USELOG" = "1" ]  && ( echo "Script finished @ $datetime" >> $LOGFILE )
  180. echo "Wait a sec, cleaning up..."
  181. [ -f "$COOKIEFILE" ] && ( rm -rf $COOKIEFILE )
  182. [ -f "$LINKSFILE" ] && ( rm -rf $LINKSFILE )
  183. echo "Thank you for using! We totally surfed from $count IPs. Hope you like this script."
  184.  
  185. if [ "$SENDLOG" -eq "1" -a "$count" -ge "$MINIMUM" ]; then
  186. echo "You choosed to send log to admin. We have totally $count IPs surfed. Now let me send results to the admin email..."
  187. sendemail -f $EMAILFROM -t $EMAILTO -u "Script finished @ $datetime - $count" -s $SMTP -m "Script finished @ $datetime - $count. Thank you for using :)" -a $LOGFILE
  188. echo "Email sended."
  189. fi
  190.  
  191. echo "Script finished. Bye!"
  192. exit
  193. killall $0
  194. }
  195.  
  196. function getlinks {
  197. number2=0
  198. while [ "$number2" -le "$LINKSFROM" ]
  199. do
  200.   number2=$RANDOM
  201.   let "number2 %= $LINKSTO"
  202. done
  203.  
  204. for (( i=1; i<=$number2; i++ ))
  205. do
  206. echo "Visiting page: $currentpage"
  207. [ "$USELOG" = "1" ]  && ( echo "Visiting page: $currentpage" >> $LOGFILE )
  208. [ "$FIREFOX" = "1" ] && ( firefox $currentpage & )
  209. curl -# -c $COOKIEFILE  --user-agent $rndagent $PROXYTYPE $TORIP:$TORPORT $currentpage | awk -F $SURFLINK {'print $2'} | awk -F\" {'print $1'} | awk -F\' {'print $1'} | sed '/^$/d' | grep -Ev '\.|\?|feed|<|>|news3_zolotie_stranitsi|wp-|;' | sort -u > $LINKSFILE
  210.  
  211. if [ "$FIREFOX" = "1" -a "$AUTOCLICK" = "1" -a "$AUTOCLICK" -le "$autoclickrate" ]; then
  212.  
  213. sleep 10
  214.  
  215. for (( z=1; z<=$SCROLL; z++ ))
  216. do
  217. xte  'mouseclick 5'
  218. done
  219.  
  220. sleep 1
  221.  
  222. for (( z=0; z<$CLICKQUANTITY; z++ ))
  223. do
  224. xte "mousemove ${MOUSEX[$z]} ${MOUSEY[$z]}" "mouseclick $MOUSEBTN"
  225. sleep 1
  226. done
  227. fi
  228.  
  229. echo "Page loaded, picking random link there... ($i/$number2)"
  230. randomlink
  231. sleeping
  232. done
  233.  
  234. echo "Site surf from this IP is completed."
  235. currentpage=$SURFLINK
  236.  
  237. [ "$FIREFOX" = "1" ] && ( xte 'keydown Control_L' 'key Q' 'keyup Control_L' )
  238.  
  239. [ -f $COOKIEFILE ] && ( rm -rf $COOKIEFILE )
  240. [ -f $LINKSFILE ] && ( rm -rf $LINKSFILE )
  241.  
  242. }
  243.  
  244. hello
Advertisement
Add Comment
Please, Sign In to add comment