Hacker-Afridi

Spam Clicking

Sep 6th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.86 KB | None | 0 0
  1. /*
  2. The MIT License (MIT)
  3.  
  4. Copyright (c) 2013 Techrocket9
  5.  
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12.  
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15.  
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. THE SOFTWARE.
  23. */
  24.  
  25.  
  26. // Spams clicks at the cursor after a short delay
  27.  
  28. using System;
  29. using System.Collections.Generic;
  30. using System.Linq;
  31. using System.Text;
  32. using System.Threading.Tasks;
  33. using System.Runtime.InteropServices;
  34. using System.Threading;
  35.  
  36. namespace ClickSpam
  37.  
  38. {
  39.     class Program
  40.     {
  41.         static void Main(string[] args)
  42.         {
  43.             int count = 6000; // Number of clicks to click
  44.             Console.WriteLine("Beginning " + count + " clicks in 2.5 seconds");
  45.             Thread.Sleep(2500);
  46.             int MOUSEEVENTF_LEFTDOWN = 0x02;
  47.             int MOUSEEVENTF_LEFTUP = 0x04;
  48.             int MOUSEEVENTF_RIGHTDOWN = 0x08;
  49.             int MOUSEEVENTF_RIGHTUP = 0x10;
  50.  
  51.            
  52.             int x = 0;
  53.             int y = 0;
  54.             while (true)
  55.             {
  56.                 mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
  57.                 mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
  58.                 --count;
  59.                 Thread.Sleep(8); // Tune up or down as tolerated
  60.                 if (count < 0)
  61.                 {
  62.                     break;
  63.                 }
  64.  
  65.             }
  66.         }
  67.  
  68.  
  69.     // Most of the junk below this line probably isn't necessary. Pretty sure that DllImport and the immediately
  70.     // following line are all that matter.
  71.  
  72.         private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
  73.         private const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;
  74.         [DllImport("user32.dll")]
  75.         public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
  76.  
  77.    
  78.         public const int MOUSEEVENTF_RIGHTDOWN = 0x08;
  79.         public const int MOUSEEVENTF_RIGHTUP = 0x10;
  80.  
  81.         public void MouseClick()
  82.         {
  83.             int x = 100;
  84.             int y = 100;
  85.  
  86.         }
  87.  
  88.  
  89.  
  90.  
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment