Forked from picatz/streaming_unix_password_cracking_api.rb
Created
April 26, 2017 06:22
-
-
Save shekkbuilder/878982b6ccd535dfd80b09dd01eab746 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