Mirror of metasploit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tftp.rb 563B

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: binary -*-
  2. require 'rex/proto/tftp'
  3. module Msf
  4. ###
  5. #
  6. # This mixin provides a TFTPServer
  7. #
  8. ###
  9. module Exploit::TFTPServer
  10. def initialize(info = {})
  11. super
  12. @tftp = nil
  13. end
  14. def start_service(tag, exe)
  15. @tftp = Rex::Proto::TFTP::Server.new
  16. @tftp.register_file(tag, exe)
  17. vprint_status("Starting TFTP server to host \"#{tag}\" (#{exe.length} bytes)")
  18. @tftp.start
  19. add_socket(@tftp.sock)
  20. @tftp
  21. end
  22. def stop_service
  23. vprint_status("Stopping TFTP server")
  24. @tftp.stop
  25. end
  26. attr_accessor :tftp
  27. end
  28. end