reperire
Reperire is a C program to perform LAN hostname discovery. The idea is to run
reperire on many computers and automatically be able to connect to each other
by hostname. I use Windows, Mac, and Linux, so I wanted to make this
cross-platform, but once I got it to work on Mac and Linux, I didn't want to
re-write it for Windows. However, my protocol is fairly simple, so it could
be easily implemented on any platform. I do plan to eventually add Windows
support.
See
reperire's github page.
Why?
I wanted to be able to just run ssh aphelion to ssh
to my laptop from my desktop when they were on the same LAN.
The name comes from putting 'discover' into Google translate and choosing
various languages until something cool came up.
Uses
- Have your friends install it and not have to care about manually finding each other's IPs. (Though, nmap -sn <IP>/<Bits> is useful.
- Install on your raspberry pi and connect to it by name.
Protocol Specification
- Broadcast a UDP packet with your hostname to port 49364. The UDP payload should be preceded with a single byte: 0x05.
- Listen on UDP port 49364.
- On receipt of a UDP packet beginning with 0x05, wait a random amount of time up to 5 seconds. Then reply, directly, with a packet beginning with 0x06 followed by your hostname.
- Store the host name of any incoming packet in an SQLite database.
- Every 50 hostnames or 5 seconds since the last hostname write all of the stored hosts to /etc/hosts.
- Every 5 minutes, clear the SQLite database and re-send a broadcast with 0x05 and your hostname.
Known Problems
-
Easily Hackable
- No encryption on transmitted data.
- Easy to spoof.
- No enforcement to reply. (One can silently collect hostnames)
- Requires root privileges to write to /etc/hosts.