Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.

Added hybrid attacks #420

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions helpers/build_crack_cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def buildCrackCmd(job_id, task_id)
end
when 'combinator'
cmd = hc_binpath + ' -m ' + hashtype + ' --potfile-disable' + ' --status --status-timer=15' + ' --outfile-format 5 ' + ' --outfile ' + crack_file + ' ' + ' -a 1 ' + target_file + ' ' + wordlist_one.path + ' ' + ' ' + wordlist_two.path + ' ' + @task.hc_rule.to_s
when 'maskword'
cmd = hc_binpath + ' -m ' + hashtype + ' --potfile-disable' + ' --status --status-timer=15' + ' --outfile-format 5 ' + ' --outfile ' + crack_file + ' ' + ' -a 6 ' + target_file + ' ' + wordlist.path + ' ' + mask
when 'wordmask'
cmd = hc_binpath + ' -m ' + hashtype + ' --potfile-disable' + ' --status --status-timer=15' + ' --outfile-format 5 ' + ' --outfile ' + crack_file + ' ' + ' -a 7 ' + target_file + ' ' + mask + ' ' + wordlist.path

else
puts 'INVALID ATTACK MODE: ' + attackmode.to_s
end
Expand Down
18 changes: 18 additions & 0 deletions helpers/compute_task_keyspace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ def getKeyspace(task)
cmd = hashcatbinpath + ' ' + wordlist1_path + ' --keyspace'
keyspace2 = `#{cmd}`
cmd = hashcatbinpath + ' ' + wordlist2_path + ' --keyspace'

elsif task.hc_attackmode == 'wordmask'
# get wordlist path
wordlist = Wordlists.first(id: task.wl_id)
wl_path = wordlist.path

# build hashcat keyspace command

cmd = hashcatbinpath + ' -a 6 ' + wl_path + ' ' + task.hc_mask + ' --keyspace'

elsif task.hc_attackmode == 'maskword'

# get wordlist path
wordlist = Wordlists.first(id: task.wl_id)
wl_path = wordlist.path

# build hashcat keyspace command
cmd = hashcatbinpath + ' -a 7 ' + task.hc_mask + ' ' + wl_path + ' --keyspace'
end

# run hashcat keyspace command
Expand Down
22 changes: 20 additions & 2 deletions routes/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
end

wordlist = Wordlists.first(id: params[:wordlist])

wordlist_wm = Wordlists.first(id: params[:wordlist_wm])
wordlist_mw = Wordlists.first(id: params[:wordlist_mw])
# must have two word lists
if params[:attackmode] == 'combinator'
wordlist_count = 0
Expand Down Expand Up @@ -106,6 +107,14 @@
task.wl_id = wordlist_list
task.hc_rule = rule_list
task.hc_mask = 'NULL'
elsif params[:attackmode] == 'wordmask'
task.wl_id = wordlist_wm.id
task.hc_mask = params[:mask_wm]
task.hc_rule = 'NULL'
elsif params[:attackmode] == 'maskword'
task.wl_id = wordlist_mw.id
task.hc_mask = params[:mask_mw]
task.hc_rule = 'NULL'
end
task.save

Expand Down Expand Up @@ -141,7 +150,8 @@
end

wordlist = Wordlists.first(id: params[:wordlist])

wordlist_wm = Wordlists.first(id: params[:wordlist_wm])
wordlist_mw = Wordlists.first(id: params[:wordlist_mw])
# mask field cannot be empty
if params[:attackmode] == 'maskmode'
if !params[:mask] || params[:mask].empty?
Expand Down Expand Up @@ -198,6 +208,14 @@
elsif params[:attackmode] == 'combinator'
task.wl_id = wordlist_list
task.hc_rule = rule_list
elsif params[:attackmode] == 'wordmask'
task.wl_id = wordlist_wm.id
task.hc_mask = params[:mask_wm]
task.hc_rule = 'NULL'
elsif params[:attackmode] == 'maskword'
task.wl_id = wordlist_mw.id
task.hc_mask = params[:mask_mw]
task.hc_rule = 'NULL'
end

# generate keyspace of new task and save to db
Expand Down
153 changes: 153 additions & 0 deletions views/task_edit.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,63 @@
document.getElementById('maskmode_div').style.display = 'none';
document.getElementById('bruteforce_div').style.display = 'none';
document.getElementById('combinator_div').style.display = 'none';
document.getElementById('wordmask_div').style.display = 'none';
document.getElementById('maskword_div').style.display = 'none';

}
else if(Index == "maskmode")
{
document.getElementById('dictionary_div').style.display = 'none';
document.getElementById('maskmode_div').style.display = 'inline';
document.getElementById('bruteforce_div').style.display = 'none';
document.getElementById('combinator_div').style.display = 'none';
document.getElementById('wordmask_div').style.display = 'none';
document.getElementById('maskword_div').style.display = 'none';
}
else if(Index == "bruteforce")
{
document.getElementById('dictionary_div').style.display = 'none';
document.getElementById('maskmode_div').style.display = 'none';
document.getElementById('bruteforce_div').style.display = 'inline';
document.getElementById('combinator_div').style.display = 'none';
document.getElementById('wordmask_div').style.display = 'none';
document.getElementById('maskword_div').style.display = 'none';
}
else if(Index == "combinator")
{
document.getElementById('dictionary_div').style.display = 'none';
document.getElementById('maskmode_div').style.display = 'none';
document.getElementById('bruteforce_div').style.display = 'none';
document.getElementById('combinator_div').style.display = 'inline';
document.getElementById('wordmask_div').style.display = 'none';
document.getElementById('maskword_div').style.display = 'none';
}
else if(Index == "wordmask")
{
document.getElementById('dictionary_div').style.display = 'none';
document.getElementById('maskmode_div').style.display = 'none';
document.getElementById('bruteforce_div').style.display = 'none';
document.getElementById('combinator_div').style.display = 'none';
document.getElementById('wordmask_div').style.display = 'inline';
document.getElementById('maskword_div').style.display = 'none';
}
else if(Index == "maskword")
{
document.getElementById('dictionary_div').style.display = 'none';
document.getElementById('maskmode_div').style.display = 'none';
document.getElementById('bruteforce_div').style.display = 'none';
document.getElementById('combinator_div').style.display = 'none';
document.getElementById('wordmask_div').style.display = 'none';
document.getElementById('maskword_div').style.display = 'inline';
}
else
{
document.getElementById('bruteforce_div').style.display = 'none';
document.getElementById('maskmode_div').style.display = 'none';
document.getElementById('bruteforce_div').style.display = 'none';
document.getElementById('combinator_div').style.display = 'none';
document.getElementById('wordmask_div').style.display = 'none';
document.getElementById('maskword_div').style.display = 'none';
}
}
- if @task
Expand Down Expand Up @@ -76,21 +105,43 @@
%option{value: 'maskmode', name: 'attackmode', type: 'button'} Mask Mode
%option{value: 'bruteforce', name: 'attackmode', type: 'button'} Brute Force
%option{value: 'combinator', name: 'combinator', type: 'button'} Combinator
%option{value: 'wordmask', name: 'attackmode', type: 'button'} Hybrid Wordlist + Mask
%option{value: 'maskword', name: 'attackmode', type: 'button'} Hybrid Mask + Wordlist
- elsif @task.hc_attackmode == 'maskmode'
%option{value: 'dictionary', name: 'attackmode', type: 'button'} Dictionary
%option{value: 'maskmode', name: 'attackmode', type: 'button', selected: 'selected'} Mask Mode
%option{value: 'bruteforce', name: 'attackmode', type: 'button'} Brute Force
%option{value: 'combinator', name: 'combinator', type: 'button'} Combinator
%option{value: 'wordmask', name: 'attackmode', type: 'button'} Hybrid Wordlist + Mask
%option{value: 'maskword', name: 'attackmode', type: 'button'} Hybrid Mask + Wordlist
- elsif @task.hc_attackmode == 'combinator'
%option{value: 'dictionary', name: 'attackmode', type: 'button'} Dictionary
%option{value: 'maskmode', name: 'attackmode', type: 'button'} Mask Mode
%option{value: 'bruteforce', name: 'attackmode', type: 'button'} Brute Force
%option{value: 'combinator', name: 'combinator', type: 'button', selected: 'selected'} Combinator
%option{value: 'wordmask', name: 'attackmode', type: 'button'} Hybrid Wordlist + Mask
%option{value: 'maskword', name: 'attackmode', type: 'button'} Hybrid Mask + Wordlist
- elsif @task.hc_attackmode == 'bruteforce'
%option{value: 'dictionary', name: 'attackmode', type: 'button'} Dictionary
%option{value: 'maskmode', name: 'attackmode', type: 'button'} Mask Mode
%option{value: 'bruteforce', name: 'attackmode', type: 'button', selected: 'selected'} Brute Force
%option{value: 'combinator', name: 'combinator', type: 'button'} Combinator
%option{value: 'wordmask', name: 'attackmode', type: 'button'} Hybrid Wordlist + Mask
%option{value: 'maskword', name: 'attackmode', type: 'button'} Hybrid Mask + Wordlist
- elsif @task.hc_attackmode == 'wordmask'
%option{value: 'dictionary', name: 'attackmode', type: 'button'} Dictionary
%option{value: 'maskmode', name: 'attackmode', type: 'button'} Mask Mode
%option{value: 'bruteforce', name: 'attackmode', type: 'button'} Brute Force
%option{value: 'combinator', name: 'combinator', type: 'button'} Combinator
%option{value: 'wordmask', name: 'attackmode', type: 'button', selected: 'selected'} Hybrid Wordlist + Mask
%option{value: 'maskword', name: 'attackmode', type: 'button'} Hybrid Mask + Wordlist
- elsif @task.hc_attackmode == 'maskword'
%option{value: 'dictionary', name: 'attackmode', type: 'button'} Dictionary
%option{value: 'maskmode', name: 'attackmode', type: 'button'} Mask Mode
%option{value: 'bruteforce', name: 'attackmode', type: 'button'} Brute Force
%option{value: 'combinator', name: 'combinator', type: 'button'} Combinator
%option{value: 'wordmask', name: 'attackmode', type: 'button'} Hybrid Wordlist + Mask
%option{value: 'maskword', name: 'attackmode', type: 'button', selected: 'selected'} Hybrid Mask + Wordlist
.section
%div{class: "label_leftalign field"}
- if @task.hc_attackmode == 'dictionary'
Expand Down Expand Up @@ -209,6 +260,78 @@
.form-group
.col-xs-offset-2.col-xs-1
%button.btn.btn-primary{type: 'submit'} Update
- if @task.hc_attackmode == 'wordmask'
#wordmask_div{style: 'display:inline'}
.form-group
%label.control-label.col-xs-2{for: ''} Wordlist:
.col-xs-4
%select.form-control{name: 'wordlist_wm'}
- @wordlists.each do |wordlist|
- if @task.wl_id.to_i == wordlist[:id].to_i
%option{value: "#{wordlist[:id]}", name: 'wl_id', type: 'button', selected: 'selected'} #{wordlist[:name]} (#{wordlist[:size]} words)
- else
%option{value: "#{wordlist[:id]}", name: 'wl_id', type: 'button'} #{wordlist[:name]} (#{wordlist[:size]} words)
%p
.form-group
%label.control-label.col-xs-2{for: ''} Hashcat Mask:
.col-xs-4
<input class='form-control' id='mask_wm' name='mask_wm' type='textbox' value="#{@task.hc_mask}" >
%p
.form-group
.col-xs-offset-2.col-xs-10
%button.btn.btn-primary{type: 'submit'} Update
- else
#wordmask_div{style: 'display:none'}
.form-group
%label.control-label.col-xs-2{for: ''} Wordlist:
.col-xs-4
%select.form-control{name: 'wordlist_wm'}
- @wordlists.each do |wordlist|
%option{value: "#{wordlist.id}", name: 'wl_id', type: 'button'} #{wordlist.name} (#{wordlist.size} words)
.form-group
%label.control-label.col-xs-2{for: ''} Hashcat Mask:
.col-xs-4
<input class='form-control' id='mask_wm' name='mask_wm' type='textbox' value="#{@task.hc_mask}" >
%p
.form-group
.col-xs-offset-2.col-xs-10
%button.btn.btn-primary{type: 'submit'} Update
- if @task.hc_attackmode == 'maskword'
#maskword_div{style: 'display:inline'}
.form-group
%label.control-label.col-xs-2{for: ''} Hashcat Mask:
.col-xs-4
<input class='form-control' id='mask_mw' name='mask_mw' type='textbox' value="#{@task.hc_mask}" >
%p
.form-group
%label.control-label.col-xs-2{for: ''} Wordlist:
.col-xs-4
%select.form-control{name: 'wordlist_mw'}
- @wordlists.each do |wordlist|
- if @task.wl_id.to_i == wordlist[:id].to_i
%option{value: "#{wordlist[:id]}", name: 'wl_id', type: 'button', selected: 'selected'} #{wordlist[:name]} (#{wordlist[:size]} words)
- else
%option{value: "#{wordlist[:id]}", name: 'wl_id', type: 'button'} #{wordlist[:name]} (#{wordlist[:size]} words)
%p
.form-group
.col-xs-offset-2.col-xs-10
%button.btn.btn-primary{type: 'submit'} Update
- else
#maskword_div{style: 'display:none'}
.form-group
%label.control-label.col-xs-2{for: ''} Hashcat Mask:
.col-xs-4
<input class='form-control' id='mask_mw' name='mask_mw' type='textbox' value="#{@task.hc_mask}" >
%p
.form-group
%label.control-label.col-xs-2{for: ''} Wordlist:
.col-xs-4
%select.form-control{name: 'wordlist_mw'}
- @wordlists.each do |wordlist|
%option{value: "#{wordlist.id}", name: 'wl_id', type: 'button'} #{wordlist.name} (#{wordlist.size} words)
.form-group
.col-xs-offset-2.col-xs-10
%button.btn.btn-primary{type: 'submit'} Update

- else
.span15
Expand Down Expand Up @@ -245,6 +368,8 @@
%option{value: 'maskmode', name: 'attackmode', type: 'button'} Mask Mode
%option{value: 'combinator', name: 'combinator', type: 'button'} Combinator
%option{value: 'bruteforce', name: 'attackmode', type: 'button'} Brute Force
%option{value: 'wordmask', name: 'attackmode', type: 'button'} Hybrid Wordlist + Mask
%option{value: 'maskword', name: 'attackmode', type: 'button'} Hybrid Mask + Wordlist
.section
%div{class: "label_leftalign field"}
#dictionary_div{style: 'display:none'}
Expand Down Expand Up @@ -307,3 +432,31 @@
.form-group
.col-xs-offset-2.col-xs-1
%button.btn.btn-primary{type: 'submit'} Create
#wordmask_div{style: 'display:none'}
.form-group
%label.control-label.col-xs-2{for: ''} Wordlist:
.col-xs-4
%select.form-control{name: 'wordlist_wm'}
- @wordlists.each do |wordlist|
%option{value: "#{wordlist.id}", name: 'wl_id', type: 'button'} #{wordlist.name} (#{wordlist.size} words)
.form-group
%label.control-label.col-xs-2{for: ''} Hashcat Mask:
.col-xs-4
<input class='form-control' id='mask_wm' name='mask_wm' type='textbox' placeholder='i.e. ?l?u?u?u' >
.form-group
.col-xs-offset-2.col-xs-10
%button.btn.btn-primary{type: 'submit'} Create
#maskword_div{style: 'display:none'}
.form-group
%label.control-label.col-xs-2{for: ''} Hashcat Mask:
.col-xs-4
<input class='form-control' id='mask_mw' name='mask_mw' type='textbox' placeholder='i.e. ?l?u?u?u' >
.form-group
%label.control-label.col-xs-2{for: ''} Wordlist:
.col-xs-4
%select.form-control{name: 'wordlist_mw'}
- @wordlists.each do |wordlist|
%option{value: "#{wordlist.id}", name: 'wl_id', type: 'button'} #{wordlist.name} (#{wordlist.size} words)
.form-group
.col-xs-offset-2.col-xs-10
%button.btn.btn-primary{type: 'submit'} Create