This forum is in archive mode. You will not be able to post new content.

Author Topic: [C] Autoclicker  (Read 5812 times)

0 Members and 2 Guests are viewing this topic.

Offline ca0s

  • VIP
  • Sir
  • *
  • Posts: 432
  • Cookies: 53
    • View Profile
    • ka0labs #
[C] Autoclicker
« on: December 15, 2010, 08:46:36 PM »
It is a simple tool I made a boring afternoon, playing some FB game...
Open it, enter number of clicks, then delay between each click, and press intro. You have 5 seconds to switch window and put your cursor in place.

Code: [Select]
#include <stdio.h>
#include <windows.h>

int getnum(int *result)
{                       
      char buff [ 13 ];
      return fgets(buff, sizeof buff, stdin) && sscanf(buff, "%d", result) == 1;
}

int main()
{
    printf("<<<<-- Ca0s Autoclicker -->>>>\n");
   
    printf("\n[-] Number of clicks: ");
    int clicks;
    do getnum(&clicks);
    while(!clicks);
   
    printf("\n[-] Delay between each click (0 allowed): ");
    int sleep;
    getnum(&sleep);
   
    printf("\n[+] Press INTRO to begin...");
    int charr;
    charr=fgetc(stdin);
    printf("\n[+] Clicks: %d ; Delay: %d", clicks, sleep);
    printf("\n[+] You have 5 seconds to change window and put cursor in place!\n");
    // Initial sleep...
    Sleep(5000);
    int i;
    for(i=0; i<clicks; i++)
    {
                           mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 1, 1, 1, 1);       // Left click
                           // mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 1, 1, 1, 1);  Right click
                           if(sleep)
                                    Sleep(sleep);
    }
    printf("[+] Finished.\n\n");
    charr=fgetc(stdin);
    return 0;
}

Offline Satan911

  • VIP
  • Knight
  • *
  • Posts: 289
  • Cookies: 25
  • Retired god/admin
    • View Profile
Re: [C] Autoclicker
« Reply #1 on: December 15, 2010, 08:52:25 PM »
Not sure I get the getnum() function. Not really familiar with C (But I know C++) and can't you just use scanf (or something like that.. cin for C+) to get the number of clics and delay?
Satan911
Evilzone Network Administrator

Offline ca0s

  • VIP
  • Sir
  • *
  • Posts: 432
  • Cookies: 53
    • View Profile
    • ka0labs #
Re: [C] Autoclicker
« Reply #2 on: December 15, 2010, 09:04:46 PM »
Yes, you can use scanf. But scanf is an unsafe function that usually leads to buffer overflows.
Also, it was better to make a function, becouse I needed to check if there was input or not. So if it returns NULL, it is called again. That could have been made in the do-while, but I wanted to do it this way.

Offline Satan911

  • VIP
  • Knight
  • *
  • Posts: 289
  • Cookies: 25
  • Retired god/admin
    • View Profile
Re: [C] Autoclicker
« Reply #3 on: December 15, 2010, 10:29:15 PM »
Alright I see. There are many little differences like this between C and C++ that make me not so comfortable with C.. thanks for your answer.
Satan911
Evilzone Network Administrator

Offline Toxicgenie

  • NULL
  • Posts: 1
  • Cookies: 0
    • View Profile
Re: [C] Autoclicker
« Reply #4 on: February 20, 2011, 07:27:11 AM »
im getting the error of :

 fatal error: windows.h: No such file or directory
compilation terminated.

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [C] Autoclicker
« Reply #5 on: February 20, 2011, 02:25:52 PM »
im getting the error of :

 fatal error: windows.h: No such file or directory
compilation terminated.


What IDE or compiler are you using?
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline virenderm01

  • /dev/null
  • *
  • Posts: 9
  • Cookies: 0
    • View Profile
Re: [C] Autoclicker
« Reply #6 on: March 26, 2011, 07:50:53 PM »
check your header files dude and if your using turbo c compiler then check whether the directory address is correct where your tc is located ;) ;)

Offline I_Learning_I

  • Knight
  • **
  • Posts: 267
  • Cookies: 26
  • Nor black or white, not even grey. What hat am I?
    • View Profile
    • Hacking F0r Fr33
Re: [C] Autoclicker
« Reply #7 on: March 29, 2011, 04:09:26 PM »
Nice script, quick and simple, although I must ask, what if I move the mouse a little? :S
You could got a getmouselocation() or whatever that is, would be only a few more lines, but would make it better :)
Anyhow +1 ;)

windows.h might not exist on *nix :O
Thanks for reading,
I_Learning_I

Offline ca0s

  • VIP
  • Sir
  • *
  • Posts: 432
  • Cookies: 53
    • View Profile
    • ka0labs #
Re: [C] Autoclicker
« Reply #8 on: March 29, 2011, 08:06:37 PM »
Nice script, quick and simple, although I must ask, what if I move the mouse a little? :S
You could got a getmouselocation() or whatever that is, would be only a few more lines, but would make it better :)
Anyhow +1 ;)

windows.h might not exist on *nix :O

Thanks!
Yes, if you move the mouse it will keep clicking wherever you move it.
And no, in *unix you won't have windows.h so no mouse_event() function.

Offline I_Learning_I

  • Knight
  • **
  • Posts: 267
  • Cookies: 26
  • Nor black or white, not even grey. What hat am I?
    • View Profile
    • Hacking F0r Fr33
Re: [C] Autoclicker
« Reply #9 on: March 30, 2011, 01:41:26 AM »
Thanks!
Yes, if you move the mouse it will keep clicking wherever you move it.
And no, in *unix you won't have windows.h so no mouse_event() function.

Yea I know, was to Toxicgenie, I don't know where is he compiling, but perhaps hes in a linux distro and that's why.
Oh just another small hint I remembered, you could use GetAsynKeyState() and wait for a key to be pressed before it actually starts to work, like Press F9 to start.

Code: [Select]
if(GetAsyncKeyState(VK_F9)){
       click();
}

And satan what he could do was something like:
Code: [Select]
cin.getline(Var,maxofchars);
atoi(Var);
« Last Edit: March 30, 2011, 01:43:31 AM by I_Learning_I »
Thanks for reading,
I_Learning_I

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.