• Stars
    star
    7,569
  • Rank 4,768 (Top 0.1 %)
  • Language
    C++
  • License
    MIT License
  • Created over 5 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎤⌨️ Acoustic keyboard eavesdropping

kbd-audio

Actions Status

This is a collection of command-line and GUI tools for capturing and analyzing audio data.

Keytap

The most interesting tool is called keytap - it can guess pressed keyboard keys only by analyzing the audio captured from the computer's microphone.

Check this blog post for more details:

Keytap: description and some random thoughts

Video: short demo of Keytap in action

Try it online:

Keytap2

The keytap2 tool is another interesting tool for recovering text from audio. It does not require training data - instead it uses statistical information about the frequencies of the letters and n-grams in the English language.

A more detailed description of the tool is available here: Keytap2 discussion

Video: short demo of Keytap2 in action

CTF: can you guess the text being typed?

Try it online:

Keytap3

This version introduces significant algorithm improvements and better n-gram statistics compared to keytap2. The attack is now fully automated and does not require any manual intervation during the text recovery process.

Video: short demo of using Keytap3

Video: another example of using Keytap3

GUI for Keytap3

Check if your keyboard is vulnerable to Keytap:

What people say about Keytap

"This works incredibly well.
I hope you realize what you've created (and made available to every person in the world)."
-- ffpip

"I just tried it and it works incredibly well. It kind of makes me want to stop using a mechanical keyboard." -- Karawebnetwork

"This attack and Van Eck phreaking are why Edward Snowden, while typing passwords and other sensitive information, would pull a blanket over himself and his laptop." -- aarchi

"This is what mechanical keyboard users deserve" -- super guy

"fuck.." -- Lluis Franco

Build instructions

Dependencies:

  • SDL2 - used to capture audio and to open GUI windows libsdl

    [Ubuntu]
    $ sudo apt install libsdl2-dev
    
    [Mac OS with brew]
    $ brew install sdl2
    
    [MSYS2]
    $ pacman -S git cmake make mingw-w64-x86_64-dlfcn mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2
    
  • FFTW3 (optional) - some of the helper tools perform Fourier transformations fftw

Linux, FreeBSD, Mac OS, Windows (MSYS2 + MinGW)

git clone https://github.com/ggerganov/kbd-audio
cd kbd-audio
git submodule update --init
mkdir build && cd build
cmake ..
make

Tools

Short summary of the available tools. If the status of the tool is not stable, expect problems and non-optimal results.

Name Type Status
record text stable
record-full text stable
play text stable
play-full text stable
view-gui gui stable
view-full-gui gui stable
key-detector text stable
keytap text stable
keytap-gui gui stable
keytap2-gui gui stable
keytap3 text stable
keytap3-gui gui stable
- extra -
guess-qp text experiment
guess-qp2 text experiment
keytap3-multi text experiment
scale text experiment
subreak text experiment
key-average-gui gui experiment
keytap2 text experiment

Tool details

  • record-full

    Record audio to a raw binary file on disk

    ./record-full output.kbd [-cN]
    

  • play-full

    Playback a recording captured via the record-full tool

    ./play-full input.kbd [-pN]
    

  • record

    Record audio only while typing. Useful for collecting training data for keytap

    ./record output.kbd [-cN] [-CN]
    

  • play

    Playback a recording created via the record tool

    ./play input.kbd [-pN]
    

  • keytap

    Detect pressed keys via microphone audio capture in real-time. Uses training data captured via the record tool.

    ./keytap input0.kbd [input1.kbd] [input2.kbd] ... [-cN] [-CN] [-pF] [-tF]
    

  • keytap-gui

    Detect pressed keys via microphone audio capture in real-time. Uses training data captured via the record tool. GUI version.

    ./keytap-gui input0.kbd [input1.kbd] [input2.kbd] ... [-cN] [-CN]
    

    Online demo: https://keytap.ggerganov.com


  • keytap2-gui record.kbd n-gram-dir [-pN] [-cN] [-CN]

    Detect pressed keys via microphone audio capture. Uses statistical information (n-gram frequencies) about the language. No training data is required. The 'record.kbd' input file has to be generated via the record-full tool and contains the audio data that will be analyzed. The 'n-gram-dir' folder file has to contain n-gram probability files for the corresponding language.

    ./keytap2-gui record.kbd ../data
    

    Online demo: https://keytap2.ggerganov.com


  • keytap3

    Fully automated recovery of unknown text from audio recordings.

    ./keytap3 input.kbd ../data [-cN] [-CN] [-pF] [-tF] [-FN] [-fN]
    

    Online demo: https://keytap3.ggerganov.com


  • keytap3-gui

    GUI version of the keytap3 tool.

    ./keytap3-gui input.kbd ../data [-cN] [-CN] [-pF] [-tF] [-FN] [-fN]
    

    Online demo: https://keytap3-gui.ggerganov.com


  • view-full-gui

    Visualize waveforms recorded with the record-full tool. Can also playback the audio data.

    ./view-full-gui input.kbd [-pN]
    

    view-full-gui


  • view-gui

    Visualize training data recorded with the record tool. Can also playback the audio data.

    ./view-gui input.kbd [-pN]
    

    view-full-gui


Feedback

Any feedback about the performance of the tools is highly appreciated. Please drop a comment here.

More Repositories

1

llama.cpp

LLM inference in C/C++
C++
55,349
star
2

whisper.cpp

Port of OpenAI's Whisper model in C/C++
C
25,242
star
3

ggml

Tensor library for machine learning
C
9,288
star
4

imtui

ImTui: Immediate Mode Text-based User Interface C++ Library
C++
2,421
star
5

wave-share

Serverless, peer-to-peer, local file sharing through sound
C++
1,955
star
6

ggwave

Tiny data-over-sound library
C++
1,496
star
7

imgui-ws

Dear ImGui over WebSockets
C++
373
star
8

dot-to-ascii

Graphviz to ASCII converter using Graph::Easy
HTML
371
star
9

hnterm

📃 Hacker News in the terminal
C++
144
star
10

ggmorse

Morse code decoding library
C++
136
star
11

whisper.spm

whisper.cpp package for the Swift Package Manager
C
120
star
12

tweet2doom

Tweet to play Doom
Shell
83
star
13

wave-gui

Yet another data-over-sound tool
C++
70
star
14

wtf-tui

Text-based UI tool for configuring the WTF terminal dashboard
C++
66
star
15

incppect

Inspect C++ memory in the browser
C++
63
star
16

ggweb

Template for C++ GUI apps that can run in the browser
C
54
star
17

ggterm

Terminal configuration for C++ development with Vim
Vim Script
34
star
18

diff-challenge

Is this even possible?
Shell
27
star
19

wordle-bg

🇧🇬 Wordle clone in Bulgarian
C++
27
star
20

hnreplies

Scrape Hacker News replies
C++
22
star
21

intervals

Downsampling array of intervals
C++
21
star
22

wave-em

Data over sound in the browser
C++
20
star
23

typing-battles

A multiplayer typing game (server: C++/WebSockets, client: JS)
C++
18
star
24

morse-meme

Meme generator in Bash
Shell
16
star
25

tweet2doom-data

@tweet2doom data and tools
JavaScript
16
star
26

ggwave-java

Minimal Java app for Android using ggwave
Java
14
star
27

ggwave-arduino

Mirror of ggwave used in the Arduino Library Manager
C++
14
star
28

imgui-em

Emscripten port of Dear ImGui (not maintained)
C++
14
star
29

ggwave-objc

Minimal Objective-C app for iOS using ggwave
Objective-C
10
star
30

ggwords

Generate language n-gram statistics
C++
10
star
31

ggerganov.github.io

JavaScript
10
star
32

imtui-template

Template repo for simple ImTui apps
C++
9
star
33

ggwave-spm

ggwave package for the Swift Package Manager
C++
8
star
34

asteroid-generator

The demo generates and renders asteroids floating in space. The shape and the texture of the generated asteroids are procedurally generated. The space background is procedurally generated as well.
C++
7
star
35

ggint

Poor man's big integer arithmetic operations
C++
6
star
36

ggsock

Non-blocking sockets wrapper
C++
5
star
37

hnguessr

Guess the Hacker News titles
C++
5
star
38

ggimg

Poor man's 2d and 3d image operations
C++
4
star
39

load-em

Load a local file in C++ Emscripten program
HTML
4
star
40

the-story

Collaborative storytelling experiment
HTML
4
star
41

tweet2btc

BTC price predictions via Twitter Polls
Shell
3
star
42

site-wave-share

A dedicated page for the wave-share tool:
JavaScript
3
star
43

ocl-lights

Pixel perfect 2D shadows on the GPU
C++
3
star
44

font-rasterizer

Simple TTF rasterizer
C
3
star
45

toto-check

See how many times you could have won the lottery
HTML
3
star
46

puzzle-solver

C++
2
star
47

OSSRH-94491

Jira
1
star
48

homebrew-ggerganov

My Homebrew tap for projects that are not notable enough
Ruby
1
star