ronin-rb / ronin-support

A support library for Ronin. Like activesupport, but for hacking!
https://ronin-rb.dev
GNU Lesser General Public License v3.0
25 stars 9 forks source link

Add a `Crypto.bruteforce` method #495

Open postmodern opened 3 months ago

postmodern commented 3 months ago

Add a Crypto.bruteforce method which takes a wordlist and passes each password to the given block, which then tries to decrypt the String. The method should then test whether the decrypted String has entropy below 7.0 or contains a plaintext String.

Crypto.bruteforce(cipher_text, wordlist: 'AAAA'..'ZZZZ') do |password|
  cipher_text.aes256_decrypt(password: password)
end

Crypto.bruteforce(cipher_text, wordlist: Chars.ascii, matches: /^CNS/) do |key|
  cipher_text.xor(key)
end