2012-06-29 05:18:28 +00:00
|
|
|
# -*- coding: binary -*-
|
2010-05-26 22:39:56 +00:00
|
|
|
|
2011-05-12 20:03:55 +00:00
|
|
|
require 'rex/proto/tftp'
|
2010-05-26 22:39:56 +00:00
|
|
|
|
|
|
|
module Msf
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# This mixin provides a TFTPServer
|
|
|
|
#
|
|
|
|
###
|
|
|
|
module Exploit::TFTPServer
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super
|
|
|
|
|
|
|
|
@tftp = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def start_service(tag, exe)
|
|
|
|
@tftp = Rex::Proto::TFTP::Server.new
|
|
|
|
@tftp.register_file(tag, exe)
|
|
|
|
print_status("Starting TFTP server to host \"#{tag}\" (#{exe.length} bytes)") if datastore['VERBOSE']
|
|
|
|
@tftp.start
|
2010-08-14 04:58:27 +00:00
|
|
|
add_socket(@tftp.sock)
|
2010-05-26 22:39:56 +00:00
|
|
|
@tftp
|
|
|
|
end
|
|
|
|
|
|
|
|
def stop_service
|
|
|
|
print_status("Stopping TFTP server") if datastore['VERBOSE']
|
|
|
|
@tftp.stop
|
|
|
|
end
|
|
|
|
|
|
|
|
attr_accessor :tftp
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|