#include <iostream>
#include <stdlib.h>
#include <windows.h> // o ile dobrze pamiętam to na windowsie wymagana jest do Sleep
#include "curl/curl.h"
using namespace std;
static int writer(char *data, int s, int n, string *buffer)
{
buffer->append(data, s * n);
return s * n;
}
int main(int argc, char *argv[])
{
if(argc != 5)
{
cout << "Uzycie:" << argv[0] << " user haslo IP czas_w_sekundach\n";
exit(0);
}
CURL *a = curl_easy_init();
string user(argv[1]), haslo(argv[2]), ip(argv[3]), tbuffer;
string query = "username=" + user + "&password=" + haslo + "&IP=" + ip;
int czas = atoi(argv[4]);
if(!a)
{
cout << "curl error\n";
exit(0);
}
curl_easy_setopt(a, CURLOPT_URL, "http://login.nomadix.com:1111/usg/process");
curl_easy_setopt(a, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(a, CURLOPT_REFERER, "http://haker.com.pl/");
curl_easy_setopt(a, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3");
curl_easy_setopt(a, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(a, CURLOPT_WRITEDATA, &tbuffer);
curl_easy_setopt(a, CURLOPT_POSTFIELDS, query.c_str());
while(1)
{
curl_easy_perform(a);
tbuffer = "";
Sleep(czas * 1000);
}
}