Skip to content

Commit a91f5f5

Browse files
committed
Substitutes cmd_exec with mkdir to create_process
1 parent 6c5522c commit a91f5f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/exploits/linux/persistence/init_systemd_override.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def install_persistence
104104

105105
unless exists?(service_dir)
106106
vprint_status("Creating #{service_dir}")
107-
cmd_exec("mkdir -p '#{service_dir}'") # don't use mkdir because it does a register_dir_for_cleanup that we don't want, or it ruins persistence
107+
create_process('mkdir', args: ['-p', service_dir])
108108
end
109109

110110
if exists?(override_conf)
@@ -143,13 +143,13 @@ def install_persistence
143143
systemd_socket_id = cmd_exec('id -u')
144144
systemd_socket_dir = "/run/user/#{systemd_socket_id}"
145145
cmd_exec("XDG_RUNTIME_DIR=#{systemd_socket_dir} systemctl daemon-reload")
146+
146147
@clean_up_rc << 'execute -f /bin/systemctl -a "daemon-reload"'
147148
@clean_up_rc << "execute -f /bin/systemctl -a \"restart #{datastore['SERVICE']}.service\""
148149

149150
if datastore['ReloadService']
150151
vprint_status("Reloading #{datastore['SERVICE']} service")
151152
cmd_exec("XDG_RUNTIME_DIR=#{systemd_socket_dir} systemctl restart #{datastore['SERVICE']}.service")
152-
153153
end
154154
end
155155
end

0 commit comments

Comments
 (0)