codice:
include <stdio.h>
#include <string.h>
#include <stdexcept>
#include <tchar.h>
#define _WIN32_WINNT 0x0500
#include <graphics.h>
#include <windows.h>
#include <time.h>
using namespace std;
int xclick=0,yclick=0;
void sinistro ( ) // Per usarla devi usare : "sinistro();"
{
INPUT Input={0};
// left down
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Input,sizeof(INPUT));
// left up
::ZeroMemory(&Input,sizeof(INPUT));
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
::SendInput(1,&Input,sizeof(INPUT));
}
void CaricamentoPagina()
{
int rosso,blu;
do
{
Sleep(1500);
HDC ff = GetDC(HWND_DESKTOP); //Controllo se si è aperta la pagina
COLORREF color = GetPixel(ff, 150, 62);
rosso = GetRValue(color);
blu = GetBValue(color);
}
while((rosso>140)&&(blu<10));
}
void BarraCaricamento()
{
int rosso,aspe;
do
{
Sleep(500);
HDC ff = GetDC(HWND_DESKTOP); //Controllo se si è aperta la pagina
COLORREF color = GetPixel(ff, 225, 159);
rosso = GetRValue(color);
}
while(rosso>245);
}
void BarraCaricamento2()
{
int rosso;
HDC ff = GetDC(HWND_DESKTOP); //Controllo se si è aperta la pagina
COLORREF color = GetPixel(ff, 225, 159);
rosso = GetRValue(color);
while(rosso>245)
{
Sleep(500);
HDC ff = GetDC(HWND_DESKTOP); //Controllo se si è aperta la pagina
COLORREF color = GetPixel(ff, 225, 159);
rosso = GetRValue(color);
}
}
void firefox ()
{
int blu;
char percorso[100] = "C:\\Programmi\\Mozilla Firefox\\firefox.exe"; // Apre Firefox
relogin:
HINSTANCE hRet = ShellExecute(HWND_DESKTOP,"open",percorso,NULL,NULL,SW_SHOWMAXIMIZED);
do
{
Sleep (3000);
HDC ff = GetDC(HWND_DESKTOP); //Controllo se si è aperto firefox
COLORREF color = GetPixel(ff, 640, 18);
blu = GetBValue(color);
}
while (blu>70);
}
void login ()
{
SetCursorPos(1129,95);
sinistro();
Sleep(1000);
CaricamentoPagina();
SetCursorPos(1054,482);
sinistro();
Sleep(2000);
CaricamentoPagina();
int aspe;
srand((unsigned)time(NULL));
aspe=rand()%2000;
Sleep(aspe);
SetCursorPos(854,704);
sinistro();
Sleep(500);
CaricamentoPagina();
SetCursorPos(1212,9);
sinistro();
Sleep(1000);
BarraCaricamento();
}
int ControlloMail() //status: 0->Running 1->Counting 2->Completed 3->Failed
{
int rosso,blu,verde,x,y,status;
status=0;
for (x=745;x<753;x++)
{
HDC ff = GetDC(HWND_DESKTOP); //Controllo se si è aperta la pagina
COLORREF color = GetPixel(ff, x, 161);
rosso = GetRValue(color);
blu = GetBValue(color);
verde=GetGValue(color);
if (((rosso>170)&&(blu<100))&&(verde<100))
status=3;
if ((rosso<100)&&(verde>150))
status=2;
}
for (y=783;y<798;y++)
{
HDC ff = GetDC(HWND_DESKTOP); //Controllo se si è aperta la pagina
COLORREF color = GetPixel(ff, y, 161);
rosso = GetRValue(color);
blu = GetBValue(color);
verde=GetGValue(color);
if (((rosso>170)&&(blu<100))&&(verde<100))
status=1;
}
return (status);
}
void CercaMail()
{
int x,y,xt,yt,rosso,blu,c=0;
for (x=0;((x<7)&&(c==0));x++) //109
{
for (y=0;((y<9)&&(c==0));y++) //201
{
HDC ff = GetDC(HWND_DESKTOP);
xt=107+213*x;
yt=182+17+66*y;
COLORREF color = GetPixel(ff,xt,yt);
rosso = GetRValue(color);
blu = GetBValue(color);
if ((rosso>150)&&(blu<50))
c=1;
}}
xclick=xt;
yclick=yt;
}
void BarraRossa()
{
int aspe;
srand((unsigned)time(NULL));
aspe=rand()%30;
Sleep(aspe*100);
SetCursorPos(809,235);
sinistro();
CaricamentoPagina();
BarraCaricamento();
}
void BarraVerde()
{
int aspe;
srand((unsigned)time(NULL));
aspe=rand()%5000;
Sleep(aspe);
SetCursorPos(583,235);
sinistro();
CaricamentoPagina();
BarraCaricamento();
}
int Errore()
{
int rosso,errore;
HDC ff = GetDC(HWND_DESKTOP);
COLORREF color = GetPixel(ff, 75, 151);
rosso = GetRValue(color);
if (rosso==26)
errore=1;
return (errore);
}
void ChiudiMail()
{
int aspe;
srand((unsigned)time(NULL));
aspe=rand()%5000 +5000;
Sleep(aspe);
SetCursorPos(1234,163);
sinistro();
Sleep(750);
}
int main()
{
int asp,status,pacchi=0,errore;
SetConsoleTitle ("ADFlasher");
//HWND hnd = GetConsoleWindow();
//SetWindowPos(hnd,HWND_TOPMOST,515,900,765,124,SWP_SHOWWINDOW);
firefox();
relogin:
login();
srand((unsigned)time(NULL));
for (;pacchi<101;)
{
Sleep(600);
errore=Errore();
if (errore==1)
goto relogin;
status=ControlloMail();
switch (status)
{
case 3:
BarraRossa();
break;
case 2:
pacchi=pacchi+1;
BarraVerde();
break;
case 1:
CercaMail();
asp=rand()%1600 +400;
Sleep(asp);
SetCursorPos(xclick,yclick);
sinistro();
asp=rand()%300 +100;
Sleep(asp);
sinistro();
ChiudiMail();
break;
default :
break;
}
}
system("PAUSE");
return EXIT_SUCCESS;
}