Pentest Mouse Macros. The What and Why of it
So currently I have done most of the Offsec PEN-200 Challenge Labs and after much procrastination have the OSCP booked October. While going through my methodology I have been thinking about how I can make my hacking as simple as possible.
This prompted many changes. From a very extensive obsidian.md vault for my notes, Using zsh-autosuggestions, and recording everything I do. I realised however that this was not enough which led me to thinking out of the box, and think*“Okay so you’ve been a hacker for a while now. How can I take some tricks from other types of ‘cheating’ and hacking to give myself an edge?”*. By cheating, I should add I’m not going to cheat in the exam but instead look for performance boosts. No one said dooping was illegal in CTF 😂
Enter gamehacking.academy’s post on macro hacking. Macro hacking is performing a number of key techniques or inputs on the press of a button or trigger event.
What this sparked was the thoughtwhat if I got a gaming mouse, and bound a number of commands to speed up my hacking of machines and improve my performance?. This was the prompt, and from there I went forth to upgrade my pentesting. Powerglove style!

Fig.1 - For you young people, this is what a powerglove is!
Mouse Selection and Objectives
I was looking through a local New Zealand IT megastore (PB Tech), and searched through the list of peripherals. I understand computer mouse/mice/meese can have a number of buttons. For me, I wanted one with lots of accessible buttons that was easy to understand and register. After a bit of careful research, the newly releasedRazer Naga v2 HyperSpeed Wireless MMO Gaming Mouse(herein known as theNaga) seemed nothing short of perfect!
Through my mouse research. I discoverd that there is a subset of gaming mice called the MMO Gaming Mouse which usually has a numbered keypad on the side. This type of mouse is also used for complex task based games like real-time strategies, however the the general concept is that these mice thrive where you might have 6 different spells in an MMO like World of Warcraft, and shooting them out would be as easy as clicking a button on the side.
I got my Naga for quite cheap due to a deal. And with this came 12 buttons on the side, two next to the left click button, a scroll wheel that could either free-spin or tactile cycle, and had an impressive 30,000 DPI. There is actually 19 programmable buttons but I only wanted to focus on the 1 - 12 keypad.
I had a couple of goals on this research that were:
- To have my most common short-cuts in Linux being process suspension (Ctrl+Z), SIGINT/Copy (Ctrl+C), Terminal Copy (Ctrl+Shift+C), PASTE (Ctrl+V ) and Terminal Paste (Ctrl+Shift+V).
- Set up Ligolo-ng proxy server on a tun0 interface
- Run and execute
lson the current terminal - Start a greenshot capture
- Start a python HTTP Server
- Type out a default scripts and version scan nmap If you are mathing, you’d realise I’m not using the whole keypad yet. Additionally, none of this is very ambitious. I did want to get into achieving these first as a definition of done. Maybe I’ll write another piece later with better macros. For now, I had my Naga at home from the store during lunch and I was ready to get macro-ing

Fig.2 - My brand new mouse
Initial Macros in Windows
So as a quik little ramp up to making macros work via Kali Linux and achieve my definition of done, I first looked at how I would make a macro from my Windows. I’ll try to make something random which is binding one key to Copy, and another to Paste.
What we need to do this is plug the mouse into our test machine and download one Razer Synapse and utilise the GUI on that to make the dream work.

Fig.3 - Razer Synapse installed
So I ended up finding the GUI for Synpase which I found highly intuitive. I was able to bind copy/paste to side buttons1and2. Razer is not necessarily a champion of opensource software though so I shouldn’t get my macro hopes high to have the same experience in the Linux world, especially as Synapse is only available on Windows.

Fig.4 - Razer Synapse Macros Set Up
Setting up my first Macro in Linux
So I spent an exorbident amount of configuring input-remapper (very good app btw) and slaving away at that only to realise that as I am running a virtual machine, if I fully share USB and Bluetooth devices with the VM, I end up getting the Macros I need.

Fig.5 - Input Ramapper on Kali
Since we were all gucci now, I considered this a job well done. Another win in VM > Bare metal Linux users. A couple things to note are that if you press a key down within your macro, you should release that key wihin the same macros. Additionally I found out the hard way adjusting the USB Driver to 3.1 for the VM will break it. Finally, I found that you have to stick to your macros, as they will take a will to convert to muscle memory. Oh one last piece of advice is that you can export your macros to an XML which I highly recommend backing up to your GitHub Account (i.e., I’m keeping mine in a private repo, but also don’t embeded sudo creds and then leak that out in your macro export publicly that’s dumb). Overall as you can see here I can effectively run stuff pretty quickly, cut, paste, and run commands. I have achieved all the macros from my definition of done, and I can’t wait to continue improving hacking effeciencies.

Fig.6 - commands, keystrokes, and a combination available on a button press.