metasploit-framework/lib/rex/proto/tftp/server.rb.ut.rb

30 lines
423 B
Ruby
Executable File

#!/usr/bin/env ruby
# -*- coding: binary -*-
#
# $Revision$
#
# $Id$
#
require 'rex/compat'
require 'rex/proto/tftp'
content = nil
fn = ARGV.shift
if (fn and fn.length > 0)
File.open(fn, "rb") do |fd|
content = fd.read(fd.stat.size)
end
end
content ||= "A" * (1024*1024)
tftp = Rex::Proto::TFTP::Server.new
tftp.register_file("poo", content)
tftp.start
#loop { break if not tftp.thread.alive? }
tftp.thread.join