KMLog is an interactive cli application for interfacing with tools which collect typing dynamics
I am very much aware that KMLogger can be used for nefarious purposes. This project is used solely for controlled data collection purposes. Do not use this for illegal purposes, period. Please read the LICENSE for licensing information
Rationale
Code Breakdown
MySQL Installation
MySQL Setup
User Information Storage in YAML
Usage
References
License
Contributing
Media
The goal of this project is to create a sleek and lightweight interface to collect specific typing dynamics data from real people
This folder holds python files for the project's core functionality:
- csv_writer.py: A wrapper class that allows for writing data to a csv file
- log.py: This is a wrapper class of the loguru module for more colorful and expressive logging
- util.py: This file holds some utility functions to make the tui prettier and more functional.
- backends: This folder hold files that wrap specific subsystems, one of which, the project uses (or could use) for operations (querying, storage, etc...)
- sql_driver.py: This file holds a wrapper class to make some sql operations nicer
- yaml_driver.py: This file holds a wrapper class to make yaml operations nicer
- user_ops: This folder holds files that wrap specific user-related functions and operations
- generic_ops.py: A set of generic functions to get user information and properly format it
- sql_ops.py: A specialized set of MySQL specific functions and operations to properly add and retrieve user information from a MySQL database
- yml_ops.py: A specialized set of YAML specific functions and operations to properly add and retrieve user information from a YAML file
This folder holds the keylogger and mouse tracker to collect typing dynamics data.
This folder holds the log and csv files generated by the keylogger and the mouse tracker
The use of the .env file was a strategic decision to allow for future users of this code base to be able to adapt it to their needs with as little code modifications as possible. The use of the .env file also improves the secrecy and security associated with connecting to the mysql database as none of the connection information is written into the code, but rather read in from created environment variables. The .env file contains the following variables:
- KM_USER: The username to connect to the database
- PASSWORD: The password to connect to the database
- DB_HOST: The host used to connect to the database
- DB_NAME: The name of the database which will be operated on
- TABLE: The name of the database table which will be operated on
See sample.env for an example .env configuration
NOTE: If you decide to change the names of the environment variables make sure that they do not conflict with an Operating System specific predefined variables. For example USER in MacOS and USERNAME in Windows -
For macs install homebrew and run:
brew install mysql
The MySQL documentation recommends using the MySQL Installer for Windows
To ensure that mysql is installed correctly run:
mysql --version
The MySQL installer should take care of everything To start the mysql interactive cli run:
mysql -u [YOUR_USERNAME] -p
Start MySQL server by running:
brew services start mysql
Secure installation of MySQL Server:
mysql_secure_installation
Like for Windows, to start the MySQL cli run:
mysql -u [YOUR_USERNAME] -p
The YAML backed system is a simpler local storage alternative to the MySQL database The YAML system uses the users inputted user-id to search through the "users" folder to see if a YAML file already exists with a matching file name. If it does we know the user already exists in the "database" and we can just pull their information from the file. If the file does not exist, we can create one and add it to the "database" The YAML file stores data in the following format:
user_id: Integer
first_name: String
last_name: String
age: Integer
gender: String
handedness: String
education: String
platform: String
See 123.yaml for more details
- Clone this repository.
git clone https://github.com/AlvinKuruvilla/kmlog.git
- Install dependencies
pip3 -r requirements.txt
- Run the main file
python3 tui.py
- Clone this repository.
git clone https://github.com/AlvinKuruvilla/kmlog.git
- Install dependencies
pip3 -r requirements.txt
- Create the kmlog.spec file and build the executable
./build.sh
This puts the executable in the dist/ folder
- Run kmlog
./kmlog
To fix any problems with input recording, give your terminal or the executable Input Monitoring access
On Apple devices, navigate to System Preferences > Go to Privacy and Security > Go to the Input Monitoring tab > Select your terminal application or kmlog executable (if they are not already there) and then toggle one of them on.
-
Download the binary from the release page.
-
Change the permissions of the binary file so it is executable
- This could be done with a command like:
chmod 777 kmlog
-
If your shell kills the executable when trying to run it, this is because Apple does not allow programs to run which are from unidentifiable developers. To fix this, navigate to System Preferences > Go to Privacy and Security > Go to the General tab > Click Run Anyway
See Contributing
The logo was designed from Hatchful by Shopify