This repository has been archived by the owner on Aug 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
/
hashview.rb
58 lines (48 loc) · 1.64 KB
/
hashview.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# encoding: utf-8
require 'sinatra'
require 'sinatra/flash'
require 'haml'
require 'resque'
require 'resque/server'
require 'logger'
require 'rack/protection'
require_relative 'models/master'
require_relative 'helpers/init'
require_relative 'routes/init'
require_relative 'jobs/init'
# Enable sessions
enable :sessions
use Rack::Protection::EscapedParams
# Presume production if not told otherwise
if ENV['RACK_ENV'].nil?
set :environment, :production
ENV['RACK_ENV'] = 'production'
end
if isOldVersion?
# puts 'You need to perform some upgrade steps. Check instructions <a href=\"https://github.com/hashview/hashview/wiki/Upgrading-Hashview\">here</a>"
puts "\n\nYour installation is out of date, please run the following upgrade task.\n"
puts "RACK_ENV=#{ENV['RACK_ENV']} rake db:upgrade\n\n\n"
exit
end
# make sure the binary path is set in the configuration file
options = JSON.parse(File.read('config/agent_config.json'))
if options['hc_binary_path'].empty? || options['hc_binary_path'].nil?
puts '!!!!!!!!!! ERROR !!!!!!!!!!!!!!'
puts '[!] You must defined the full path to your hashcat binary. Do this in your config/agent_config.json file'
puts '!!!!!!!!!! ERROR !!!!!!!!!!!!!!'
exit 0
end
# Check for valid session before proccessing
before do
unless %w[login register logout v1].include?(request.path_info.split('/')[1])
@settings = Settings.first
redirect '/login' unless validSession?
end
end
# Set our key limit size
Rack::Utils.key_space_limit = 68719476736
# Quick check to see if there are any new wordlists
Resque.enqueue(WordlistImporter)
Resque.enqueue(WordlistChecksum)
# start our local agent
Resque.enqueue(LocalAgent)