Skip to content
Artur Zochniak edited this page Oct 12, 2015 · 17 revisions

TFTPy – A Pure Python TFTP Protocol Implementation

About TFTPy

TFTPy is a pure Python implementation of the Trivial File Transfer Protocol

I wrote it because the VoIP company that I work for uses TFTP to pull firmware loads for our sets, and at times when this doesn’t work we use a Windows-based diagnostic tool to troubleshoot the connection.

As all of the computers in my home run some flavour of Linux or FreeBSD, this tool wasn’t much use to me, so I started one of my own. I decided to use Python since it’s comfortable and available for the platforms that I care about, and was surprised to not find a pre-existing TFTP library for it. So, I wrote one, and here it is. It’s not 1.0 yet, but downloading is production-ready IMHO, as some of the people using it tell me.

Features

At this time, it supports the following RFCs:

  • 1350 The TFTP Protocol, revision 2 (octet mode only)
  • 2347 TFTP Option Extension
  • 2348 TFTP Blocksize Option
  • 2349 TFTP Timeout Interval and Transfer Size Options (just the tsize option right now)

Installing

Linux

which python pip || sudo apt-get python python-pip
sudo pip install tftpy
tftp_server.py -r . --debug

Windows

#tip: get pip via manual installation or via https://chocolatey.org/, or execute 
#as an admin: c:/ProgramData/chocolatey/bin/choco install sudo python pip
pip install tftpy
tftp_server.py -r . --debug #(note that /python*/Scripts has to be in PATH env variable)

Future Plans

I do have plans for this code before a 1.0 release, including the following:

  • Full RFC 1350 compliance, including netascii mode (I could care less about “mail” mode).
  • Symmetric UDP support. I don’t know of an RFC for this but it’s a no-brainer for NAT traversal. In this mode the server should always respond on the port that the RRQ was sent to, so stateful firewalls will permit the response.

The Code

You can find the latest release at the SourceForge Project Page, as a source tarball. It should also be in PyPi.

The latest code though is always on the master branch in Github.

The Github project page is right here.

Support

SourceForge doesn’t make the mailing list easy to find, so here is a direct link" if you’d like to join.

Feel free to email me with any questions, or contact me through github.

To submit a bug report, please use the issue tracker in the Github project page. I’ve shut down the trackers at sourceforge for now.

Documentation

I am working on some documentation via the Sphinx project. The current ones are here.