Advertisement
GodinaNicolae

DLE Spam

Dec 14th, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           DataLife Spam
  3. // @description    Comment spam in DLE
  4. // @author         Godina Nicolae
  5. // @include        http://*
  6. // @require        http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
  7. // @version        1.0
  8. // ==/UserScript==
  9.  
  10. function SetCookie(e, t, n) {
  11.     var r = new Date;
  12.     var i = new Date;
  13.     if (n == null || n == 0) n = 1;
  14.     i.setTime(r.getTime() + 36e5 * 1 * n);
  15.     document.cookie = e + "=" + escape(t) + ";expires=" + i.toGMTString()
  16. }
  17. function getCookie(e) {
  18.     var t, n, r, i = document.cookie.split(";");
  19.     for (t = 0; t < i.length; t++) {
  20.         n = i[t].substr(0, i[t].indexOf("="));
  21.         r = i[t].substr(i[t].indexOf("=") + 1);
  22.         n = n.replace(/^\s+|\s+$/g, "");
  23.         if (n == e) {
  24.             return unescape(r)
  25.         }
  26.     }
  27. }
  28. function randomString() {
  29.     var e = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
  30.     var t = 8;
  31.     var n = "";
  32.     for (var r = 0; r < t; r++) {
  33.         var i = Math.floor(Math.random() * e.length);
  34.         n += e.substring(i, i + 1)
  35.     }
  36.     return n
  37. }
  38. function Complete(e) {
  39.     $("#name").val("U" + e);
  40.     $('input[name="password1"]').val("P" + e);
  41.     $('input[name="password2"]').val("P" + e);
  42.     $('input[name="email"]').val(e + "@gmail.com")
  43. }
  44. function EsteLogat() {
  45.     var e = $('a[href="http://' + window.location.host + '/index.php?action=logout"]').html();
  46.     console.log(e);
  47.     return !(typeof e == "undefined" || e === null)
  48. }
  49. function Register() {
  50.     if (window.location.search != "?do=register") {
  51.         window.location.href = "/index.php?do=register"
  52.     } else switch (getCookie("SPM")) {
  53.         case "1":
  54.             $.post("/index.php?do=register", {
  55.                 "do": "register",
  56.                 dle_rules_accept: "yes"
  57.             }, function (e) {
  58.                 SetCookie("SPM", "2", 1);
  59.                 window.location.reload()
  60.             });
  61.             break;
  62.         case "2":
  63.             Complete(randomString());
  64.             SetCookie("SPM", "3", 1);
  65.             alert("Completeaza CAPCHA si apasa SUBMIT/ENTER");
  66.             break;
  67.         case "3":
  68.             SetCookie("SPM", "4", 1);
  69.             window.location.reload();
  70.             break;
  71.         default:
  72.             console.log("Final Step!");
  73.             break
  74.     }
  75. }
  76. function CautaUrl() {
  77.     var e;
  78.     $('#dle-content a[href*="' + window.location.host + '"]').each(function (t) {
  79.         var n = $(this).attr("href").match(/[\/](\d+)[-]/);
  80.         var r = $(this).attr("href").match(/[newsid=](\d+)/);
  81.         if (n) {
  82.             e = n[1];
  83.             return false
  84.         }
  85.         if (r) {
  86.             e = r[1];
  87.             return false
  88.         }
  89.     });
  90.     return e
  91. }
  92. function StartSP() {
  93.     if (start == "true") {
  94.         SetCookie("SPMS", "false", 1)
  95.     } else {
  96.         SetCookie("SPMS", "true", 1);
  97.         var e = prompt("Introduceti mesajul pentru spam", "");
  98.         if (e != null && e.length > 15) {
  99.             SetCookie("SPMESSAGE", e, 1)
  100.         } else {
  101.             alert("Lungimea minima 15 caractere!");
  102.             StartSP()
  103.         }
  104.     }
  105.     SetCookie("SPM", "1", 1);
  106.     window.location.reload()
  107. }
  108. function Run() {
  109.     start = getCookie("SPMS");
  110.     if (start == "true") {
  111.         $("#SPS").text("Startat!");
  112.         $("#SPS").css("color", "green");
  113.         $("#SPO").text("STOP")
  114.     } else {
  115.         $("#SPS").text("Oprit!");
  116.         $("#SPS").css("color", "red");
  117.         $("#SPO").text("START if is DLE")
  118.     }
  119.     if (start == "true") if (EsteLogat()) {
  120.         if (window.location.search.match(/[newsid=](\d+)/)) {
  121.             Post()
  122.         } else {
  123.             var e = CautaUrl();
  124.             SetCookie("SPMURL", e, 1);
  125.             window.location.href = "/index.php?newsid=" + e
  126.         }
  127.     } else {
  128.         Register()
  129.     }
  130. }
  131. function ToNextPage() {
  132.     var e = parseInt(getCookie("SPMURL")) - 1;
  133.     if (e > 0) {
  134.         SetCookie("SPMURL", e, 1);
  135.         window.location.href = "/index.php?newsid=" + e
  136.     } else {
  137.         alert("Final!");
  138.         start = false;
  139.         SetCookie("SPMS", "false", 1)
  140.     }
  141. }
  142. function Post() {
  143.     $("#comments").text(getCookie("SPMESSAGE"));
  144.     $('button[name="submit"]').click();
  145.     setTimeout(function () {
  146.         ToNextPage()
  147.     }, 3e4)
  148. }
  149. jQuery(document).ready(function (e) {
  150.     e("body").prepend('<div id="SP"><style></style><center><b>DLE SPAM v1.0</b></br><span id="SPS"> </span><br/><button id="SPO"></button></center></div>');
  151.     e("#SP style").text("#SP { position:fixed; z-index:9999; bottom:10px; right:10px; background:white; border:1px #888 solid; padding:5px; width:130px;height:60px;}");
  152.     e("#SPO").click(function () {
  153.         StartSP()
  154.     });
  155.     var t;
  156.     Run()
  157. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement