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/auxiliary/parser/unattend.rb
Views: 11780
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##456class MetasploitModule < Msf::Auxiliary78def initialize(info={})9super( update_info( info,10'Name' => 'Auxilliary Parser Windows Unattend Passwords',11'Description' => %q{12This module parses Unattend files in the target directory.1314See also: post/windows/gather/enum_unattend15},16'License' => MSF_LICENSE,17'Author' =>18[19'Ben Campbell',20],21'References' =>22[23['URL', 'https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/ff715801(v=win.10)'],24['URL', 'https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc749415(v=ws.10)'],25['URL', 'https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc732280(v=ws.10)']26],27))2829register_options([30OptPath.new('PATH', [true, 'Directory or file to parse.']),31OptBool.new('RECURSIVE', [true, 'Recursively check for files', false]),32])33end3435def run36if datastore['RECURSIVE']37ext = "**/*.xml"38else39ext = "/*.xml"40end4142if datastore['PATH'].ends_with?('.xml')43filepath = datastore['PATH']44else45filepath = File.join(datastore['PATH'], ext)46end4748Dir.glob(filepath) do |item|49print_status "Processing #{item}"50file = File.read(item)51begin52xml = REXML::Document.new(file)53rescue REXML::ParseException => e54print_error("#{item} invalid xml format.")55vprint_line(e.message)56next57end5859results = Rex::Parser::Unattend.parse(xml)60table = Rex::Parser::Unattend.create_table(results)61print_line table.to_s unless table.nil?62print_line63end64end65end66676869