Advertisement
goebelmasse

Zufällige Google-Suchen ausführen

Sep 26th, 2015
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.76 KB | None | 0 0
  1. #!/bin/sh
  2. ########################################################################
  3. #
  4. # randsurf
  5. # (c) 2013 Elias Schwerdtfeger, http://www.tamagothi.de/
  6. #
  7. # Sending randomized search requests to popular search engine to make
  8. # NSA tracking more senseless.
  9. #
  10. # This software is licensed under the terms of the pirate's license.
  11. # Share and enjoy, but don't sue me! ;)
  12. #
  13. # http://www.tamagothi.de/impressum/lizenz/
  14. #
  15. # $Id: randsurf,v 1.1 2015/02/05 22:01:50 elias Exp $
  16. #
  17. ########################################################################
  18.  
  19. PATH=/bin:/usr/bin
  20.  
  21. ########################################################################
  22. #
  23. # Configuration
  24. # Change settings here
  25. #
  26. ########################################################################
  27. #
  28. # Wordlist to use
  29. # ---------------
  30. #
  31. # A german wordlist
  32. #
  33. wordlist=/usr/share/dict/ngerman  
  34. #
  35. # Most people prefer English... ;)
  36. #
  37. # wordlist=/usr/share/dict/words
  38. #
  39. #
  40. # Randomizer settings
  41. # -------------------
  42. #
  43. # If you invoke the script via crontab, you probably want some
  44. # irregularity. A request every five minutes is easy to detect as
  45. # mechanical request, so better wait a random amount of time. And
  46. # don't do it on every invocation, do it only sometimes. That
  47. # looks much less automatically performed and helps to make filtering
  48. # your real searches out of the noise more challenging for the
  49. # "United Stasi of America". ;)
  50. #
  51. # Percentage of execution
  52. #
  53. search_percent=50
  54. #
  55. # Maximal random delay in seconds before a search request is performed
  56. #
  57. search_delay=299
  58. #
  59. # Search engine URI
  60. # I use the german google here
  61. #
  62. search_uri='http://www.google.de/search?q='
  63. #
  64. # Faked user agent
  65. # Just an example. Use the user agent string of your preferred browser here
  66. user_agent='Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20100101 Firefox/16.0'
  67.  
  68. ########################################################################
  69. #
  70. # Program
  71. # Change the following lines only if you know what you are doing...
  72. #
  73. ########################################################################
  74.  
  75. # Cannot use $RANDOM if someone doesn't use bash
  76. set `awk "END {
  77.    srand()
  78.    print int(rand() * 100), int(rand() * $search_delay)
  79.    }" </dev/null`
  80. randnum=$1;
  81. delaytime=$2;
  82.  
  83. # Shall we execute a search?
  84. test $randnum -lt $search_percent || exit
  85.  
  86. # Delay
  87. sleep $delaytime
  88.  
  89. # Pick one random word from the wordlist.
  90. # Once again cannot use $RANDOM for non-bashers. ;)
  91. word_count=`wc -l $wordlist | sed 's/ .*$//'`
  92. word_index_select=`awk "END {
  93.    srand()
  94.    printf(\"%d\", int(rand() * $word_count+1))
  95.    }" </dev/null`
  96. word_select=`sed -n ${word_index_select}p $wordlist`
  97.  
  98. # And now perform a search using curl
  99. curl -s -A "$user_agent" "${search_uri}$word_select" >/dev/null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement