spaces/tabs cleanup
git-svn-id: file:///home/svn/framework3/trunk@14115 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
47cb10c70b
commit
27c41e41f7
|
@ -19,32 +19,38 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
def initialize
|
||||
super(
|
||||
'Name' => 'John the Ripper Linux Password Cracker',
|
||||
'Version' => '$Revision$',
|
||||
'Description' => %Q{
|
||||
'Name' => 'John the Ripper Linux Password Cracker',
|
||||
'Version' => '$Revision$',
|
||||
'Description' => %Q{
|
||||
This module uses John the Ripper to identify weak passwords that have been
|
||||
aquired from unsahdowed passwd files from Unix systems. The module will noly crack
|
||||
MD5 and DES implementations by default. Set Crypt to true to also try to crack
|
||||
Blowfish and SHA implementations. Warning: This is much slower.
|
||||
aquired from unsahdowed passwd files from Unix systems. The module will noly crack
|
||||
MD5 and DES implementations by default. Set Crypt to true to also try to crack
|
||||
Blowfish and SHA implementations. Warning: This is much slower.
|
||||
},
|
||||
'Author' => ['TheLightCosine <thelightcosine[at]gmail.com>',
|
||||
'hdm'
|
||||
] ,
|
||||
'License' => MSF_LICENSE # JtR itself is GPLv2, but this wrapper is MSF (BSD)
|
||||
'Author' =>
|
||||
[
|
||||
'TheLightCosine <thelightcosine[at]gmail.com>',
|
||||
'hdm'
|
||||
] ,
|
||||
'License' => MSF_LICENSE # JtR itself is GPLv2, but this wrapper is MSF (BSD)
|
||||
)
|
||||
|
||||
register_options([OptBool.new('Crypt',[false, 'Try crypt() format hashes(Very Slow)', false])])
|
||||
|
||||
register_options(
|
||||
[
|
||||
OptBool.new('Crypt',[false, 'Try crypt() format hashes(Very Slow)', false])
|
||||
]
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
def run
|
||||
wordlist = Rex::Quickfile.new("jtrtmp")
|
||||
|
||||
wordlist.write( build_seed().join("\n") + "\n" )
|
||||
|
||||
wordlist.write( build_seed().join("\n") + "\n" )
|
||||
wordlist.close
|
||||
|
||||
|
||||
hashlist = Rex::Quickfile.new("jtrtmp")
|
||||
|
||||
|
||||
myloots = myworkspace.loots.find(:all, :conditions => ['ltype=?', 'linux.hashes'])
|
||||
unless myloots.nil? or myloots.empty?
|
||||
myloots.each do |myloot|
|
||||
|
@ -59,31 +65,31 @@ class Metasploit3 < Msf::Auxiliary
|
|||
end
|
||||
end
|
||||
hashlist.close
|
||||
|
||||
|
||||
print_status("HashList: #{hashlist.path}")
|
||||
|
||||
|
||||
print_status("Trying Format:md5 Wordlist: #{wordlist.path}")
|
||||
john_crack(hashlist.path, :wordlist => wordlist.path, :rules => 'single', :format => 'md5')
|
||||
print_status("Trying Format:md5 Rule: All4...")
|
||||
john_crack(hashlist.path, :incremental => "All4", :format => 'md5')
|
||||
print_status("Trying Format:md5 Rule: Digits5...")
|
||||
john_crack(hashlist.path, :incremental => "Digits5", :format => 'md5')
|
||||
|
||||
|
||||
|
||||
|
||||
print_status("Trying Format:des Wordlist: #{wordlist.path}")
|
||||
john_crack(hashlist.path, :wordlist => wordlist.path, :rules => 'single', :format => 'des')
|
||||
print_status("Trying Format:des Rule: All4...")
|
||||
john_crack(hashlist.path, :incremental => "All4", :format => 'des')
|
||||
print_status("Trying Format:des Rule: Digits5...")
|
||||
john_crack(hashlist.path, :incremental => "Digits5", :format => 'des')
|
||||
|
||||
|
||||
print_status("Trying Format:bsdi Wordlist: #{wordlist.path}")
|
||||
john_crack(hashlist.path, :wordlist => wordlist.path, :rules => 'single', :format => 'bsdi')
|
||||
print_status("Trying Format:bsdi Rule: All4...")
|
||||
john_crack(hashlist.path, :incremental => "All4", :format => 'bsdi')
|
||||
print_status("Trying Format:bsdi Rule: Digits5...")
|
||||
john_crack(hashlist.path, :incremental => "Digits5", :format => 'bsdi')
|
||||
|
||||
|
||||
if datastore['Crypt']
|
||||
print_status("Trying Format:crypt Wordlist: #{wordlist.path}")
|
||||
john_crack(hashlist.path, :wordlist => wordlist.path, :rules => 'single', :format => 'crypt')
|
||||
|
@ -92,14 +98,14 @@ class Metasploit3 < Msf::Auxiliary
|
|||
print_status("Trying Rule: Digits5...")
|
||||
john_crack(hashlist.path, :incremental => "Digits5", :format => 'crypt')
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
cracked = john_show_passwords(hashlist.path)
|
||||
|
||||
|
||||
print_status("#{cracked[:cracked]} hashes were cracked!")
|
||||
|
||||
cracked[:users].each_pair do |k,v|
|
||||
|
||||
|
||||
print_status("#{cracked[:cracked]} hashes were cracked!")
|
||||
|
||||
cracked[:users].each_pair do |k,v|
|
||||
if v[0] == "NO PASSWORD"
|
||||
passwd=""
|
||||
else
|
||||
|
@ -112,17 +118,15 @@ class Metasploit3 < Msf::Auxiliary
|
|||
:sname => 'ssh',
|
||||
:user => k,
|
||||
:pass => passwd
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def build_seed
|
||||
|
||||
seed = []
|
||||
|
||||
seed = []
|
||||
#Seed the wordlist with Database , Table, and Instance Names
|
||||
schemas = myworkspace.notes.find(:all, :conditions => ['ntype like ?', '%.schema%'])
|
||||
unless schemas.nil? or schemas.empty?
|
||||
|
@ -133,43 +137,38 @@ class Metasploit3 < Msf::Auxiliary
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
instances = myworkspace.notes.find(:all, :conditions => ['ntype=?', 'mssql.instancename'])
|
||||
unless instances.nil? or instances.empty?
|
||||
instances.each do |anote|
|
||||
seed << anote.data['InstanceName']
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Seed the wordlist with usernames, passwords, and hostnames
|
||||
|
||||
|
||||
myworkspace.hosts.find(:all).each {|o| seed << john_expand_word( o.name ) if o.name }
|
||||
myworkspace.creds.each do |o|
|
||||
seed << john_expand_word( o.user ) if o.user
|
||||
seed << john_expand_word( o.pass ) if (o.pass and o.ptype !~ /hash/)
|
||||
end
|
||||
|
||||
|
||||
# Grab any known passwords out of the john.pot file
|
||||
john_cracked_passwords.values {|v| seed << v }
|
||||
|
||||
|
||||
|
||||
#Grab the default John Wordlist
|
||||
john = File.open(john_wordlist_path, "r")
|
||||
john.each_line{|line| seed << line.chomp}
|
||||
|
||||
|
||||
unless seed.empty?
|
||||
seed.flatten!
|
||||
seed.uniq!
|
||||
end
|
||||
|
||||
print_status("Wordlist Seeded with #{seed.length} words")
|
||||
|
||||
return seed
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
print_status("Wordlist Seeded with #{seed.length} words")
|
||||
|
||||
return seed
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue