From 4c0ac00f38167a8d64705c19b594d30c4792b633 Mon Sep 17 00:00:00 2001 From: Eliott Teissonniere <10683430+DeveloppSoft@users.noreply.github.com> Date: Wed, 20 Jun 2018 09:13:51 +0000 Subject: [PATCH] Make screensaver works on OSX --- modules/post/multi/manage/screensaver.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/post/multi/manage/screensaver.rb b/modules/post/multi/manage/screensaver.rb index 910b2391b1..87558f411e 100644 --- a/modules/post/multi/manage/screensaver.rb +++ b/modules/post/multi/manage/screensaver.rb @@ -13,7 +13,7 @@ class MetasploitModule < Msf::Post }, 'License' => MSF_LICENSE, 'Author' => [ 'Eliott Teissonniere'], - 'Platform' => [ 'linux' ], + 'Platform' => [ 'linux', 'osx' ], 'SessionTypes' => [ 'shell', 'meterpreter' ], 'Actions' => [ @@ -44,6 +44,8 @@ class MetasploitModule < Msf::Post case session.platform when 'linux' cmd_vexec('xdg-screensaver lock') + when 'osx' + cmd_vexec('pmset displaysleepnow') end true @@ -53,6 +55,8 @@ class MetasploitModule < Msf::Post case session.platform when 'linux' cmd_vexec('xdg-screensaver activate') + when 'osx' + cmd_vexec('open -a ScreenSaverEngine') end true @@ -62,6 +66,9 @@ class MetasploitModule < Msf::Post case session.platform when 'linux' cmd_vexec('xdg-screensaver reset') + when 'osx' + print_error('Not supported on Mac OSX, you can still lock the screen or start the screensaver') + return false end true