Module: Msf::Payload::Adapter::Fetch::Server::TFTP

Included in:
TFTP
Defined in:
lib/msf/core/payload/adapter/fetch/server/tftp.rb

Instance Method Summary collapse

Instance Method Details

#cleanup_tftp_fetch_service(fetch_service) ⇒ Object



16
17
18
# File 'lib/msf/core/payload/adapter/fetch/server/tftp.rb', line 16

def cleanup_tftp_fetch_service(fetch_service)
  fetch_service.stop
end

#fetch_protocolObject



20
21
22
# File 'lib/msf/core/payload/adapter/fetch/server/tftp.rb', line 20

def fetch_protocol
  'TFTP'
end

#initialize(*args) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/msf/core/payload/adapter/fetch/server/tftp.rb', line 8

def initialize(*args)
  super
  register_options(
    [
      Msf::OptBool.new('FETCH_SRVONCE', [ true, 'Stop serving the payload after it is retrieved', true ])
    ]
  )
end

#start_tftp_fetch_handler(srvport, srvhost, srvuri, srvexe) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/msf/core/payload/adapter/fetch/server/tftp.rb', line 24

def start_tftp_fetch_handler(srvport, srvhost, srvuri, srvexe)
  fetch_service = start_tftp_server(srvport, srvhost)
  if fetch_service.nil?
    cleanup_handler
    fail_with(Msf::Exploit::Failure::BadConfig, "Fetch handler failed to start on #{srvhost}:#{srvport}\n#{e}")
  end
  fetch_service.register_file(srvuri, srvexe, datastore['FETCH_SRVONCE'])
  fetch_service.start
  fetch_service
end

#start_tftp_server(srvport, srvhost) ⇒ Object



3
4
5
6
# File 'lib/msf/core/payload/adapter/fetch/server/tftp.rb', line 3

def start_tftp_server(srvport, srvhost)
  vprint_status("Starting TFTP server on #{Rex::Socket.to_authority(srvhost, srvport)}")
  Rex::Proto::TFTP::Server.new(srvport, srvhost, {})
end