Below is the file 'standalone.py' from this revision. You can also download the file.
#!/usr/bin/env python # pygtk stuff import pygtk pygtk.require("2.0") import gtk import gtk.glade import gobject import tftp import sys def set_read(fd, func, user_data=None): gtk.input_add(fd, gobject.IO_IN, func, user_data) def set_write(fd, func, user_data=None): gtk.input_add(fd, gobject.IO_OUT, func, user_data) def set_timeout(time, func, user_data=None): return gtk.timeout_add(3000, func, user_data) def remove_timeout(id): return gtk.timeout_remove(id) def notify(name, tpl): print name, tpl def authenticate(request, client_addr, filename): return True if __name__ == '__main__': io = tftp.TFTPIOFunctions(set_read, set_write, set_timeout, remove_timeout, notify, authenticate) if len(sys.argv) > 1: port = int(sys.argv[1]) else: port = 69 t = tftp.TFTPServer(io, port, verbose=False) t.store.set_export("hosts", open("/etc/hosts").read()) gtk.main()