Skip to content

Instantly share code, notes, and snippets.

View picatz's full-sized avatar
Graph Theory

Kent Gruber picatz

Graph Theory
View GitHub Profile
@picatz
picatz / violent_ruby_unix_password_cracker_crack_unix_passwords_method.rb
Created April 16, 2017 02:57
Violent Ruby: Unix Password Cracker Crack Unix Passwords Method
# 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.
@picatz
picatz / violent_ruby_unix_password_cracker_format_results.rb
Created April 16, 2017 03:02
Violent Ruby: Unix Password Cracker Format Results
private
# @api private
# Format the results for the password crack'n.
#
# @param user [String]
# @param encrypted_pass [String]
# @param plaintext_pass [String]
#
# @return [Hash]
@picatz
picatz / violent_ruby_unix_password_cracker_class_from_source.rb
Last active April 16, 2017 03:08
Violent Ruby: Unix Password Cracker Class ( no comments )
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]
@picatz
picatz / violent_ruby_unix_password_cracker_cli.rb
Last active April 16, 2017 03:22
Violent Ruby: Unix Password Cracker - Command-line Interface
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'
@picatz
picatz / dictionary.txt
Created April 16, 2017 17:03
dictionary.txt
password
dogs
cats
chickens
egg
text
tester
@picatz
picatz / passwords.txt
Created April 16, 2017 17:04
passwords.txt
victim: HX9LLTdc/jiDE: 503:100:Iama Victim:/home/victim:/bin/sh
root: DFNFxgW7C05fo: 504:100: Markus Hess:/root:/bin/bash
@picatz
picatz / streaming_unix_password_cracking_api.rb
Created April 16, 2017 17:46
Violent Ruby: Streaming REST API Unix Password Cracker
require 'json'
require 'sinatra'
require 'violent_ruby'
post '/crack_passwords' do
content_type :json
config = {
file: params['file'][:tempfile],
dictionary: params['dictionary'][:tempfile]
}
@picatz
picatz / streaming_unix_password_cracking_api_requires.rb
Created April 16, 2017 17:57
Violent Ruby: Streaming REST API Unix Password Cracker Requires
require 'sinatra'
require 'json'
require 'violent_ruby'
# code will go here
@picatz
picatz / streaming_unix_password_cracking_api_basic_post.rb
Created April 16, 2017 18:05
Violent Ruby: Streaming REST API Unix Password Cracker Basic Post
# previous code
post '/crack_passwords' do
content_type :json
# more code
end
@picatz
picatz / streaming_unix_password_cracking_api_basic_post_params_temp_files.rb
Created April 16, 2017 18:10
Violent Ruby: Streaming REST API Unix Password Cracker Uploaded Temporary Files
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