Created
April 16, 2017 17:46
-
-
Save picatz/c034ca7164fe3b4808613381d3579a3c to your computer and use it in GitHub Desktop.
Violent Ruby: Streaming REST API 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
require 'json' | |
require 'sinatra' | |
require 'violent_ruby' | |
post '/crack_passwords' do | |
content_type :json | |
config = { | |
file: params['file'][:tempfile], | |
dictionary: params['dictionary'][:tempfile] | |
} | |
stream do |out| | |
ViolentRuby::UnixPasswordCracker.new(config).crack do |result| | |
out << result.to_json + "\n" | |
end | |
out << { completed: true }.to_json + "\n" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment