Last active
April 16, 2017 03:53
-
-
Save picatz/94b0fd08a29a4526bcf7855fe77c8be3 to your computer and use it in GitHub Desktop.
Violent Ruby: Basic Unix Password Cracker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
def test_pass(crypt_pass) | |
salt = crypt_pass[0, 2] | |
File.foreach('dictionary.txt').map(&:strip).each do |word| | |
return puts '[+] Found Password: ' + word if word.crypt(salt) == crypt_pass | |
end | |
puts '[-] Password Not Found' | |
end | |
File.foreach('passwords.txt').map(&:strip).each do |line| | |
next unless line.include?(':') | |
user = line.split(':')[0] | |
crypt_pass = line.split(':')[1].strip | |
puts '[*] Cracking Password For: ' + user | |
test_pass(crypt_pass) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment