How to implement keyboard adjacent key insertion
#1
I am working on cracking a password where I know the user often uses keys that are adjacent on the keyboard (semi-random passwords).
I looked at how could implement this in hashcat using rules, and it looks like the building blocks are there to implement it, but I am missing the right combination of rules, perhaps because its not documented.

For example, using rules we can replace a character with another character, but not with two characters.
Otherwise I could replace 's' with 'sa','sw','se'. So replacements appear not to be an option.
I can also extract a character or range of characters to memory 'XNM' , and even insert it at any location ' XNMI'. However, what I cannot do, or at least I cannot find documentation on it, is to extract character(s) to memory and apply a shift or replacement to effectively change it to an adjacent key on the keyboard.
Based on the presence of these rules, I assume logic or modification on memorized strings should be possible or is in the planning. I can write my own code to make such replacements but I fear it would be slow down the process since I am targeting a fast hash (1 million passwords/second).

A last option I see is to use a keyboard walking tool to generate adjacent keys and convert them into an "insert two adjacent character rule". However, I would prefer a smarter function to be present in hashcat where a character saved to memory is used as input. Since it looks like hashcat has the possibility to do so, I would ask if anyone has done something similar or if this is something I should create a "Feature Request" for.
Reply
#2
The whole extracting to memory thing doesn't exist anymore unfortunately. You're best off having a stack of replaces:
sgf  (replace g with f)
sgh (replace g with h)
sgb (replace g with b)
etc. Then, if you want, use that rule multiple times in Hashcat with "-r rules -r rules" in your command to facilitate having more than one typo
Reply
#3
Thanks, not my preferred choice, but it will do the trick for now.
Reply
#4
Actually it will only work for substitute kind of typo's, not for inserting next to it an adjacent character. Real pity that the save to memory option is not better utilized, its a potential powerhouse for rules.
Reply