|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | +require 'rex' |
| 8 | +require 'msf/core/auxiliary/report' |
| 9 | + |
| 10 | +class Metasploit3 < Msf::Post |
| 11 | + include Msf::Post::Windows::Registry |
| 12 | + include Msf::Auxiliary::Report |
| 13 | + include Msf::Post::Windows::Services |
| 14 | + include Msf::Post::Windows::Priv |
| 15 | + include Msf::Post::Windows::ShadowCopy |
| 16 | + |
| 17 | + def initialize(info={}) |
| 18 | + super(update_info(info, |
| 19 | + 'Name' => 'Windows Domain Controller Hashdump', |
| 20 | + 'Description' => %q{ |
| 21 | + This module attempts to copy the NTDS.dit database from a live Domain Controller |
| 22 | + and then parse out all of the User Accounts. It saves all of the captured password |
| 23 | + hashes, including historical ones. |
| 24 | + }, |
| 25 | + 'License' => MSF_LICENSE, |
| 26 | + 'Author' => ['theLightCosine'], |
| 27 | + 'Platform' => [ 'win' ], |
| 28 | + 'SessionTypes' => [ 'meterpreter' ] |
| 29 | + )) |
| 30 | + end |
| 31 | + |
| 32 | + def run |
| 33 | + if preconditions_met? |
| 34 | + copy_database_file |
| 35 | + end |
| 36 | + end |
| 37 | + |
| 38 | + def copy_database_file |
| 39 | + database_file_path = nil |
| 40 | + case sysinfo["OS"] |
| 41 | + when /2003/ |
| 42 | + |
| 43 | + when /2008|2012/ |
| 44 | + else |
| 45 | + print_error "This version of Windows in unsupported" |
| 46 | + end |
| 47 | + end |
| 48 | + |
| 49 | + def is_domain_controller? |
| 50 | + status = false |
| 51 | + service_list.each do |svc| |
| 52 | + if svc[:name] == 'NTDS' |
| 53 | + status = true |
| 54 | + break |
| 55 | + end |
| 56 | + end |
| 57 | + status |
| 58 | + end |
| 59 | + |
| 60 | + def preconditions_met? |
| 61 | + status = true |
| 62 | + unless is_domain_controller? |
| 63 | + print_error "This does not appear to be an AD Domain Controller" |
| 64 | + status = false |
| 65 | + end |
| 66 | + unless is_admin? |
| 67 | + print_error "This module requires Admin privs to run" |
| 68 | + status = false |
| 69 | + end |
| 70 | + if is_uac_enabled? |
| 71 | + print_error "This module requires UAC to be bypassed first" |
| 72 | + status = false |
| 73 | + end |
| 74 | + return status |
| 75 | + end |
| 76 | + |
| 77 | + |
| 78 | +end |
0 commit comments