Tuesday, February 9, 2016

MTFTP my own TFTP client and server

There are many TFTP implementations available in the web so why did I write this script?

Well. It is a very good exercise. It's a simple protocol so it's an affordable project. You have to implement the client side and, why not? the server side.

But there is a deeper reason for this.  It's just a first step. If you check the script's help you will notice you can change the UDP port for the connections. Using a nonstandard port will allow you to use it even if there is another TFTP server running in your computer. You can also hide the server. Or even you can try to bypass a firewall using an open port like DNS or so.

Right.  I'm thinking about security.  

Changing the UDP port will only work for a simple firewall, if a simple ACL (Access Control List) can be considered as a firewall. I do.

A more advanced firewall may do deep protocol inspection so if you try to use port 53 it will not work. But what will happen if there are other nonstandard ports open? Or even there are some standards ports open as port 7 (UDP ECHO)?  

Not concerned? Well, this is just a TFTP and you need to have the script running at both sides of the firewall. On the other hand many times the information to be transferred does not need to be long and many servers today can run a python script which is no more than a text file.

The next step is moving to use ICMP instead UDP. I leave this for the next release if I ever publish it. 

Does your firewall allow 'ping'?  
Have fun, stay legal.