Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
puhitaku committed Mar 21, 2023
1 parent 2a10881 commit d84e603
Showing 1 changed file with 73 additions and 1 deletion.
74 changes: 73 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,74 @@
# tftp-now
Just one executable to run TFTP commands with no installation and no painful configuration.

*Single-binary TFTP server and client that you can use right now. No package installation, no configuration, no frustration.*


# tl;dr

1. Download the latest executable

- Linux [amd64](https://github.com/puhitaku/tftp-now/releases/latest/download/tftp-now-linux-amd64) /
[arm](https://github.com/puhitaku/tftp-now/releases/latest/download/tftp-now-linux-arm) /
[arm64](https://github.com/puhitaku/tftp-now/releases/latest/download/tftp-now-linux-arm64) /
[riscv64](https://github.com/puhitaku/tftp-now/releases/latest/download/tftp-now-linux-riscv64)
- macOS [amd64](https://github.com/puhitaku/tftp-now/releases/latest/download/tftp-now-darwin-amd64) /
[arm64](https://github.com/puhitaku/tftp-now/releases/latest/download/tftp-now-darwin-arm64)
- Windows [amd64](https://github.com/puhitaku/tftp-now/releases/latest/download/tftp-now-windows-amd64.exe) /
[arm64](https://github.com/puhitaku/tftp-now/releases/latest/download/tftp-now-windows-arm64.exe)

1. Run it.

1. As a server: `tftp-now-{OS}-{ARCH} serve`
1. As a client, to read (receive): `tftp-now-{OS}-{ARCH} read -path remote/path/to/read.bin -output read.bin`
1. As a client, to write (send): `tftp-now-{OS}-{ARCH} write -path remote/path/to/write.bin -input write.bin`


# Why

I enjoy installing OpenWrt onto routers, but one of the main challenges is transferring it to the bootloader via TFTP. To do this, a temporary TFTP server or client is necessary, but I have always struggled with setting up a TFTP server.

While macOS has an out-of-the-box TFTP server, it requires running launchctl to invoke the hidden server. The process is tricky, and I always Google for guidance.

Linux distros, on the other hand, usually don't have a built-in TFTP server. Installing tftpd via apt is an option, but it's configured for inetd by default and requires some additional configuration. Only the manpage and Google can provide guidance on how to do it properly.

As for Windows, it doesn't come with a TFTP server by default, except for the server variants. Community-based software is the first choice for Windows, and again, Google is the go-to source for finding the right software to download.

It's frustrating that setting up a TFTP server is always such a hassle. This is why I created tftp-now.


# How

Fortunately, there is a well-developed TFTP server/client implementation for Golang available at https://github.com/pin/tftp. The example code snippet provided on the site is exactly what I was looking for. However, since it's just an example, it lacks proper security checks and validation. To address this, I implemented these features myself and integrated the package into a simple CLI.


# Download & Run

Download the latest executable from [the release page](https://github.com/puhitaku/tftp-now/releases/latest). If there's no binary that runs on your system, please raise an issue.

```
$ tftp-now
Usage of tftp-now:
tftp-now <command> [<args>]
Server Commands:
serve Start TFTP server
Client Commands:
read Read a file from a TFTP server
write Write a file to a TFTP server
Other Commands:
help Show this help
Example (serve): start serving on 0.0.0.0:69
$ tftp-now serve
Example (read): receive '{server root}/dir/foo' from 192.168.1.1 and save it to 'bar'.
$ tftp-now read -host 192.168.1.1 -path dir/foo -output bar
Example (write): send 'bar' to '{server root}/dir/foo' of 192.168.1.1.
$ tftp-now write -host 192.168.1.1 -path dir/foo -input bar
```

0 comments on commit d84e603

Please sign in to comment.