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
# Crack unix passwords. | |
# | |
# @example Basic Usage | |
# ViolentRuby::UnixPasswordCracker.new(file: "passwords.txt", dictionary: "dictionary.txt").crack_passwords do |result| | |
# next unless result[:cracked] | |
# puts "Cracked #{result[:username]}'s password: #{result[:plaintext_password]}" | |
# end | |
# | |
# @param args [Hash] The options when crack'n some passwords. | |
# @option args [String] :file The path to an /etc/passwd file. |
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
private | |
# @api private | |
# Format the results for the password crack'n. | |
# | |
# @param user [String] | |
# @param encrypted_pass [String] | |
# @param plaintext_pass [String] | |
# | |
# @return [Hash] |
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
module ViolentRuby | |
class UnixPasswordCracker | |
attr_accessor :file | |
attr_accessor :dictionary | |
alias etc file | |
def initialize(args = {}) | |
@file = args[:file] if args[:file] | |
@dictionary = args[:dictionary] if args[:dictionary] |
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' |
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
password | |
dogs | |
cats | |
chickens | |
egg | |
text | |
tester |
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
victim: HX9LLTdc/jiDE: 503:100:Iama Victim:/home/victim:/bin/sh | |
root: DFNFxgW7C05fo: 504:100: Markus Hess:/root:/bin/bash |
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 'json' | |
require 'sinatra' | |
require 'violent_ruby' | |
post '/crack_passwords' do | |
content_type :json | |
config = { | |
file: params['file'][:tempfile], | |
dictionary: params['dictionary'][:tempfile] | |
} |
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 'sinatra' | |
require 'json' | |
require 'violent_ruby' | |
# code will go here |
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
# previous code | |
post '/crack_passwords' do | |
content_type :json | |
# more code | |
end |
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
post '/crack_passwords' do | |
content_type :json | |
user_uploaded_file = params['file'][:tempfile] # not really doing anything with it | |
user_uploaded_dict = params['dictionary'][:tempfile] # not really doing anything with it | |
end |