Skip to content

Commit 8c8dbc6

Browse files
author
Brent Cook
committed
Land rapid7#8692, Fix rapid7#8685, Check nil condition for #wordlist_file in jtr modules
2 parents 2c37124 + fe360e3 commit 8c8dbc6

File tree

6 files changed

+30
-0
lines changed

6 files changed

+30
-0
lines changed

modules/auxiliary/analyze/jtr_aix.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def run
3232

3333
# generate our wordlist and close the file handle
3434
wordlist = wordlist_file
35+
unless wordlist
36+
print_error('This module cannot run without a database connected. Use db_connect to connect to a database.')
37+
return
38+
end
39+
3540
wordlist.close
3641
print_status "Wordlist file written out to #{wordlist.path}"
3742
cracker.wordlist = wordlist.path

modules/auxiliary/analyze/jtr_crack_fast.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ def run
3131

3232
# generate our wordlist and close the file handle
3333
wordlist = wordlist_file
34+
unless wordlist
35+
print_error('This module cannot run without a database connected. Use db_connect to connect to a database.')
36+
return
37+
end
38+
3439
wordlist.close
3540
print_status "Wordlist file written out to #{wordlist.path}"
3641
cracker.wordlist = wordlist.path

modules/auxiliary/analyze/jtr_linux.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ def run
4646

4747
# generate our wordlist and close the file handle
4848
wordlist = wordlist_file
49+
unless wordlist
50+
print_error('This module cannot run without a database connected. Use db_connect to connect to a database.')
51+
return
52+
end
53+
4954
wordlist.close
5055
print_status "Wordlist file written out to #{wordlist.path}"
5156
cracker.wordlist = wordlist.path

modules/auxiliary/analyze/jtr_mssql_fast.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ def run
3333

3434
# generate our wordlist and close the file handle
3535
wordlist = wordlist_file
36+
unless wordlist
37+
print_error('This module cannot run without a database connected. Use db_connect to connect to a database.')
38+
return
39+
end
40+
3641
wordlist.close
3742
print_status "Wordlist file written out to #{wordlist.path}"
3843
cracker.wordlist = wordlist.path

modules/auxiliary/analyze/jtr_mysql_fast.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def run
3232

3333
# generate our wordlist and close the file handle
3434
wordlist = wordlist_file
35+
unless wordlist
36+
print_error('This module cannot run without a database connected. Use db_connect to connect to a database.')
37+
return
38+
end
39+
3540
wordlist.close
3641
print_status "Wordlist file written out to #{wordlist.path}"
3742
cracker.wordlist = wordlist.path

modules/auxiliary/analyze/jtr_postgres_fast.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ def run
3636

3737
# generate our wordlist and close the file handle
3838
wordlist = wordlist_file
39+
unless wordlist
40+
print_error('This module cannot run without a database connected. Use db_connect to connect to a database.')
41+
return
42+
end
43+
3944
wordlist.close
4045

4146

0 commit comments

Comments
 (0)