Skip to content

Commit

Permalink
Fileless execution condition specified
Browse files Browse the repository at this point in the history
  • Loading branch information
msutovsky-r7 committed Feb 5, 2025
1 parent b678126 commit 0d558a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Binary file removed lib/msf/core/payload/adapter/.fetch.rb.swo
Binary file not shown.
17 changes: 12 additions & 5 deletions lib/msf/core/payload/adapter/fetch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ def generate_fetch_commands
#
case datastore['FETCH_COMMAND'].upcase
when 'FTP'
return datastore['FETCH_FILELESS'] && !windows? ? _generate_ftp_command_fileless : _generate_ftp_command
return datastore['FETCH_FILELESS'] && linux? ? _generate_ftp_command_fileless : _generate_ftp_command
when 'TNFTP'
return datastore['FETCH_FILELESS'] && !windows? ? _generate_tnftp_command_fileless : _generate_tnftp_command
return datastore['FETCH_FILELESS'] && linux? ? _generate_tnftp_command_fileless : _generate_tnftp_command
when 'WGET'
return datastore['FETCH_FILELESS'] && !windows? ? _generate_wget_command_fileless : _generate_wget_command
return datastore['FETCH_FILELESS'] && linux? ? _generate_wget_command_fileless : _generate_wget_command
when 'CURL'
return datastore['FETCH_FILELESS'] && !windows? ? _generate_curl_command_fileless : _generate_curl_command
return datastore['FETCH_FILELESS'] && linux? ? _generate_curl_command_fileless : _generate_curl_command
when 'TFTP'
return datastore['FETCH_FILELESS'] && !windows? ? _generate_tftp_command_fileless : _generate_tftp_command
return datastore['FETCH_FILELESS'] && linux? ? _generate_tftp_command_fileless : _generate_tftp_command
# ignoring certutil when FETCH_FILELESS is enabled
when 'CERTUTIL'
return _generate_certutil_command
Expand Down Expand Up @@ -155,6 +155,13 @@ def windows?
@windows
end

def linux?
return @linux unless @linux.nil?

@linux = platform.platforms.first == Msf::Module::Platform::Linux
@linux
end

def _check_tftp_port
# Most tftp clients do not have configurable ports
if datastore['FETCH_SRVPORT'] != 69 && datastore['FetchListenerBindPort'].blank?
Expand Down

0 comments on commit 0d558a1

Please sign in to comment.