Add T1547.015 test to add login item via applescript

This commit is contained in:
Alex M
2022-10-30 15:47:06 -05:00
parent 6f0df94b1d
commit 0fcbe1d052
3 changed files with 33 additions and 1 deletions
+24 -1
View File
@@ -39,4 +39,27 @@ atomic_tests:
cleanup_command: |
mv -Force #{settings_json_tmp} #{settings_json_def}
taskkill /F /IM "#{calculator}" > $null
name: powershell
name: powershell
- name: Add macOS LoginItem using Applescript
description: |
Runs osascript on a file to create new LoginItem for current user.
NOTE: Will popup dialog prompting user to Allow or Deny Terminal.app to control "System Events"
Therefore, it can't be automated until the TCC is granted.
The login item will launch Safari.app when user logs in.
supported_platforms:
- macos
input_arguments:
scriptfile:
description: path to Applescript source to add Safari LoginItem.
type: String
default: PathToAtomicsFolder/T1547.015/src/add_login_item.osa
cleanup_script:
description: path to Applescript source to delete Safari LoginItem.
type: String
default: PathToAtomicsFolder/T1547.015/src/remove_login_item.osa
executor:
command: |
osascript #{scriptfile}
cleanup_command: |
osascript #{cleanup_script}
name: bash
+5
View File
@@ -0,0 +1,5 @@
tell application "System Events"
get full name of current user
make new login item at end of login items with properties ¬
{path:"/Applications/Safari.app", name:"Safari"}
end tell
@@ -0,0 +1,4 @@
tell application "System Events"
get full name of current user
delete login item "Safari"
end tell