How to make advanced ruleset to crack passwords
#1
Question 
Hi! I want to make hashcat only test passwords that contain at least 1 digit, 1 uppercase letter and 1 lowercase letter and these can be in any position. The password must be at least 8 characters long. I do not want to use a wordlist for this job as the file size would be too big so I would like the passwords to be generated on the go. I have looked at the documentation but was unable to find anything regarding my issue. 

So is there anyway to achieve this?
Thanks.
Reply
#2
well this is a common misunderstanding when it comes to rules, rules are not "made" to generate passwords, but to modify them, maybe take a look at masks and maskfiles



maybe an approach would be to use a basic "generator mask" like
(8 times lower chars)
?l?l?l?l?l?l?l?l

and combine this with an also self generated ruleset which will do the things you mentioned, add/replace position 0 to 7 with digit 0-9, swap letter to upper and so on, you can use maskprocessor or hahscat --sdout to help you generating these "basic" rules and then using hashcat utils like combinator, combinator 3 to combine these rules with each other

see output of 
Code:
mp64.exe -1 "luds" ???1???1???1???1???1???1???1???1 > maskfile

to get a feeling how to use maskprocessor to generate masks or rules (see wiki), this will generate a maskfile with 8 positions and all combination (65536) of lower, upper, digits and special chars, each line is a mask on its own, you could "clean this list and removing entries like ?s?s?s?s?s?s?s?s (last line) because this password would consist of 8 time special chars and therefore "doesnt fit" but you have to do this by hand

line 2400 - 2405 example
Code:
?l?l?d?u?u?u?s?s
?l?l?d?u?u?d?l?l
?l?l?d?u?u?d?l?u
?l?l?d?u?u?d?l?d
?l?l?d?u?u?d?l?s
?l?l?d?u?u?d?u?l


Code:
mp64.exe --combinations ?l?l?d?u?u?d?l?u

30891577600

the main problem is, the logic you mentionend, or better the checking whether the generated password "fits" would slow down the whole process of generating pw candidates and therefore slowing down the whole cracking process so for your special needs you have to put some afford beforehand and generate the ruleset or masks by hand (at least cleaning)
Reply
#3
thank you i made a quick python script to parse out the file that
mp64.exe -1 "luds" ???1???1???1???1???1???1???1???1 > maskfile
generated and it seems to work fine now, thank you.
Reply
#4
@Snoopy,

One small correction about your above post. You put quote marks around the word "made". But it would seem more appropriate to put them around the words you are contrasting which are the words "generate" and "modify". No big deal but that's my opinion. I could be wrong.

Your post is still really helpful because I understand what rulesets are for now. Not to "generate" passwords for brute-force but to "allow/disallow" them to be used with a source file of passwords that has already been created. I'm guessing either way can be chosen depending on the user preference here.
Reply
#5
(01-19-2022, 11:36 AM)firefullplank Wrote: thank you i made a quick python script to parse out the file that
mp64.exe -1 "luds" ???1???1???1???1???1???1???1???1 > maskfile
generated and it seems to work fine now, thank you.


Could you share your script, please?
Reply