A simple dependency-free, single-file userland TFTP server, similar in spirit to python3 -m http.server.
If you want a TFTP client, use
curl.
The server is a single file that only depends on the python stdlib, thus it can be easily executed via curl:
curl -fsSL https://raw.githubusercontent.com/bytedream/tftp/main/src/server.py | python3 -Or install locally (you may have to add the --break-system-packages flag):
git clone https://github.com/bytedream/tftp
pip install ./tftp
# alternative: install it from the git repo directly
pip install git+https://github.com/bytedream/tftp
python3 -m tftp.server| Option | Description |
|---|---|
port |
Port number (default: 69) |
-b, --bind |
Bind address (default: all interfaces) |
-d, --directory |
Serve this directory (default: current directory) |
-w, --write |
Allow upload (WRQ) requests |
Serve the current directory on the default port (requires root/elevated privileges):
curl -fsSL https://raw.githubusercontent.com/bytedream/tftp/main/src/server.py | python3 -
# or, if installed locally:
python3 -m tftp.serverServe a specific directory on a non-privileged port:
curl -fsSL https://raw.githubusercontent.com/bytedream/tftp/main/src/server.py | python3 - 6969 -d /srv/tftp
# or, if installed locally:
python3 -m tftp.server 6969 -d /srv/tftpAllow file uploads:
curl -fsSL https://raw.githubusercontent.com/bytedream/tftp/main/src/server.py | python3 - -d /srv/tftp -w
# or, if installed locally:
python3 -m tftp.server 6969 -d /srv/tftp -w- Read (RRQ) and write (WRQ) requests
octetandnetasciitransfer modes- Option negotiation (RFC 2347):
blksize,tsize,timeout - Path traversal protection
- Concurrent transfers via threading
- RFC 1350 -- The TFTP Protocol (Revision 2)
- RFC 2347 -- TFTP Option Extension
- RFC 2348 -- TFTP Blocksize Option
- RFC 2349 -- TFTP Timeout Interval and Transfer Size Options
This project is licensed under the MIT License - see the LICENSE file for more details.