keylogger: A Cross-Platform Keylogger

If you’re familiar with the kbhell application, you might realize that kbhell is about 90% of the way to being a keylogger. Why not finish the job and write a proper, cross platform keylogger that captures a victim’s every keystroke (for science reasons, of course)? The Requirements So there’s the obvious requirement of capturing user keystrokes. When you think about the fact that keyboards have different layouts, there are different language sets, etc., the task becomes challenging. ...

November 13, 2023 · 7 min

A Beginner's Memory Allocator

While reading through the awesome “Operating Systems: Three Easy Pieces” book, I came across the topic of memory allocators. While always having an inkling of how functions like malloc() and free() work under the hood, I never considered writing a custom allocator. To help demystify the topic, I decided to write a basic allocator on Linux. The Interface What does the API look like? The API is identical to that of malloc()/free() with only two major deviations: ...

September 12, 2023 · 14 min

Keyboard Hell

Do you enjoy the sound of a mechanical keyboard? What if it was possible to achieve the sound of the keys clacking without having an actual mechanical keyboard? That was the idea that spawned this keyboard hell (kbhell) project. That and trolling friends by playing a soundbite every time they press a key! Getting Started When a user performs any keystroke, a audio file gets played. One of the main kbhell requirements is that it runs on both Windows and Linux. That leaves you with two problems to solve: ...

September 2, 2023 · 7 min

Morse Translator

While on a LeetCode grind, I came across a fun problem involving Morse code: Unique Morse Code Words. You might wonder what the encodings sound like. With a little programming magic you can find out by creating a command line utility for converting text to Morse code audio. The Basics The journey starts at the Morse code wiki page. The wiki had a chart that sums up the protocol: ...

August 1, 2023 · 7 min

Binary Rain

Most programmers young and old have seen the cyberpunk sci-fi film The Matrix. One of the most outstanding parts of the movie is the closing scene where Neo sees the Matrix when battling the Agents: The visual effect with the code running along all the surfaces is iconic. Seems other people thought so too to the point that the effect has a name: Matrix Digital Rain. Wouldn’t it be neat to create a terminal screensaver that mimicked the effect seen in the movie? ...

July 23, 2023 · 6 min

A CLI Base Converter

When debugging an embedded system, it’s common to work with raw data requiring conversion between decimal, hexadecimal, binary, and sometimes octal number systems. The Python REPL and printf shell utility do the job but are tedious to use for the simple task of base conversion. It would be nice to drop the overhead of format specifiers and fear of numerical limits. To ease the pain, I decided to write a command line utility that made conversion between positive binary, decimal, octal, and hexadecimal numbers of arbitrary size. ...

July 8, 2023 · 6 min

Huffman Coding

Implementing a Huffman Tree is a fun afternoon project for anyone interested in learning about data compression. A Huffman Tree is a type of binary tree that sees use in the compression of an arbitrary data file. Developing a command line utility to compress/decompress a file using Huffman coding is a good CS101 challenge. Breaking It Down Into Steps This project starts where many do: Wikipedia. The Huffman Coding wiki article gives a nice breakdown with examples of the data structure and associated algorithms. In particular, the “Basic Technique” section covers the algorithms for compression and decompression. You need three key data structures to implement the big Compress() and Decompress() routines: ...

July 4, 2023 · 12 min

Digital Image Steganography

There’s a neat Computerphile video discussing the topic of steganography. In the video, Mike Pound talks about a technique for steganography on digital images: least significant bit substitution (LSBS). The effectiveness of LSBS in concealing a secret image is surprising. This article puts least significant bit substitution to use in a command line tool for embedding one image within another. A Little Background on Digital Images You don’t need fancy image manipulation techniques to make this steganography tool work. That said, you do need to know a little bit about how the machine represents a digital image. ...

June 25, 2023 · 7 min

Snake in the Terminal

Are you a text user interface enjoyer? Have you always wondered how difficult is it to write an ncurses UI? What better way to find out than to write a program of your own that explores ncurses’ API. Of course, you have to keep it interesting. Why not implement a scaled down version of a retro arcade game: snake. The Rules of Snake Step one of this project is to look up what the rules for a game of snake are. Specifically, what does the play “arena” look like, how do you win, and how do you lose? ...

June 17, 2023 · 14 min

GPIO Driven Synchronization

Have you ever heard of the Kuramoto Model? The Kuramoto Model Wikipedia page has an impressive video showing out of phase metronomes synchronizing: Could two or more computers synchronize in a similar fashion? What would be the common “fabric” between the machines? In the clip with the metronomes, the base board is crucial in bringing the metronomes into phase. Perhaps you could use GPIO signals to achieve a similar link between two computers. ...

May 29, 2023 · 12 min