Last active
April 16, 2017 03:22
-
-
Save picatz/f67509ccb271849184d54cbc3db4182e to your computer and use it in GitHub Desktop.
Violent Ruby: Unix Password Cracker - Command-line Interface
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
require 'violent_ruby' # For the unix password cracker. | |
require 'trollop' # For clean option parsing. | |
require 'colorize' # For beautiful colors. | |
require 'logoris' # Log to the right standard stream. | |
# logoris logging instance | |
logger = Logoris.new | |
application_name = 'Unix Password Cracker' | |
# Default to a help menu if no argument is given. | |
ARGV[0] = '-h' if ARGV.empty? | |
# Option parsing. | |
opts = Trollop::options do | |
banner "#{application_name}".red | |
version "#{application_name} CLI 1.0.0 (c) 2017 Kent 'picat' Gruber" | |
opt :file, "An /etc/passwd file", type: :string | |
opt :dictionary, "A list of plaintext passwords", type: :string | |
opt :Verbose, "Verbose output option", type: :bool, default: false | |
end | |
ViolentRuby::UnixPasswordCracker.new(file: opts[:file], dictionary: opts[:dictionary]).crack_passwords do |result| | |
if result[:cracked] | |
logger.out("CRACKED".green + " -- " + "#{result[:username].bold}:'#{result[:plaintext_password].green}'") | |
else | |
logger.error("FAILED".red + " -- " + "#{result[:username].bold}:#{result[:encrypted_password].red}") if opts[:Verbose] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment