Arpchat – Text your friends on the same network using just ARP
github.com
github.com
I actually got a chance to use it in a totally-offline setting a bit ago, which was fun! ... however, I then found a major bug that was causing tons of latency, and I fixed it but I haven't gotten around to building new artifacts yet, so you might want to build from scratch if you're planning on testing it out in a real setting for some reason. I also added fun username colors and message times. I promise I'll upload a new release soon!
If you're interested, I wrote an article about a year ago about how ArpChat works: https://kognise.dev/writing/arp
# sudo getcap ./arpchat
./arpchat cap_net_raw=ep
I receive "error getting channel, might be missing permissions"edit: the received error is from arpchat, not any of the setcap setup.
$ sudo setcap CAP_NET_RAW+ep ./arpchat
$ ./arpchat
perhaps try sudo on the arpchat binary if notI tried it with sudo and it also failed with the same message.
I've tried it on an arch-based laptop and a debian-based laptop with the same results.
pnet = "0.34.0"
Interestingly with Arch it worked fine for me before, but with my Pi, I got the permission error, but changing the pnet ver seemed to fix anyway.Regarding Arch, I updated everything earlier today but I am running the LTS kernel.
Even though ArpChat would probably give network admins a heart attack, your mind is most certainly fucking rad, ma'am. =) I too am the kind of person that read books on OSI layers for funsies, lol. Keep playing with code! Reminds me a bit of justine tunney's work with things like https://justine.lol/ape.html where someone just goes way deep on a thing that few people seem to fully understand (in her case it would be "compiler binary format minutiae" among other things) and then asks a crazy question like "what if it were possible to mesh all the binary formats together into a meta-format that actually runs on all of them?" and then conjures up this crazy thing that actually works.
For that of you who have no idea what the Address Resolution Protocol (ARP) is, to a first approximation it is the missing link between your MAC address (what Ethernet runs on) and your IP address (what Internet runs on). After your IP routing table, which you can see with `route`, decides what immediate next IP address to forward a packet to, then your ARP cache, which you can see with `arp`, will decide which MAC address that IP correspond to (usually your router's local IP address).
Knowing that ARP even exists is considered mild esoterica today, to say nothing of its IPv6 sibling the Network Discovery Protocol. But even though you don't use it much in modern cloud-based deployments, knowing it exists makes your bird's eye view of how the whole network stack works that much more holistic.
It is true that software engineers may sooner run into it when debugging their home network than their application though as cloud and traditional networks are very different.
And you can, say, hardcode the ARP entries from other computers on your network when they have fixed IP addresses.
More commonly, this is 802.11 nowadays, though I guess ARP would be used at any data link layer protocol when the host needs to get an IP: https://en.wikipedia.org/wiki/Data_link_layer
but if you have a wired connection and a wifi connection to the same router, will one use arp and the other not use it?
I meant that it's typically (for end users) the protocol between the wireless interface (MAC) and network gateway (IP) now, rather than:
> the missing link between your MAC address (what Ethernet runs on) and your IP
What follows is non-expert commentary and I probably get several details wrong. But here is my deeper understanding:
In reality, Ethernet is a really old protocol (like Metcalfe started working on it back in 1973), and the way we use it today is very different from the way it was originally imagined. In the original paper, you would hook up say 10 computers to a single giant cable and just have Computer A send data to Computer B by sending that data to _everyone_ and letting anyone who wasn't Computer B just quietly drop the network traffic. That's a really elegant design, in the same way a rock is a really elegant weapon, but these days we usually plug any Ethernet devices we have into an Ethernet switch and that does most of the filtering for us -- moving us from a complete graph where everyone is connected directly to everyone back to a spoke-and-hub design with the switch as the hub. But the original Ethernet _did_ end up using MAC addresses as the way to distinguish Computer A from Computer B, and so the analogy stuck in my brain as a "wrong but useful" model.
Now 802.11, aka wifi, comes right out the box with a spoke-and-hub model. All your traffic goes through your wireless router/switch/modem/whatever it's called. Even when you want to share things with something like BitTorrent or Syncthing on the local network, Computer A's wireless network card doesn't usually directly transfer files to Computer B's wireless network card - it goes from A, to router, to B. There's nothing technical I'm aware of that stops this direct A-B transfer, since we know wireless cards can both pull and push data, but you would have to do some networking legwork to get them to be on the same subnet to do so, which probably involves a lot of manual fiddling with IP addresses or something.
But 802.11 also emerged into a landscape where MAC addresses are ubiquitous, so it still uses ARP to translate between IP and MAC for reasons I'm not entirely sure of (probably practically that MAC addresses change a lot less often than IP addresses to).
Using ARP doesn't offer any particular advantage, and I would note since many modern switches do thinks like snooping arp packets, putting a high amount of bogus ARP traffic on the network could actually have some negative impact. It's still fun at any rate and reminds me of the type of crap that I used to make when I was learning. As alluded to before, I personally would have chosen to abuse ICMP for this purpose; maybe it's a future avenue for development. Kudos to the fun project!
This shouldn’t work today, but back then, a naive TCP/IP implementation (which is to say, many of them) would happily participate.
ARP, DNS, HTTP, TLS, on the one hand they really are the things that may pop into your head when you think about those things, but they are also simultaneously Just Numbers. ARP has access to the same numbers as HTTP. UDP doesn't get access to 11-bit bytes. DNS does not have special CPU instructions only it gets access to. It's All Just Numbers. And in the end you can stuff whatever numbers you like onto the line and the rest of the world is just going to take those numbers and do... whatever they do with them.
You see the samba share message in your file browser, click it and can edit the filenames to update a 3-line "bulletin board".
https://github.com/jedahan/samba-haiku/blob/master/index.js
Even this was a re-implementation that used WIFI ssids to make a captive portal haiku.
It's possible this chat app could break through VLANs in certain circumstances.
But it is easy to send out arbitrary ARP requests using almost anything and watch them with Wireshark.
It works pretty well, although sometimes you have to restart after your laptop wakes up before it sees others on the LAN. That and not being able to open a message window to someone direct from the tray icon are really my only grips. Can cut and paste pictures (of funny cats) and even send files and other capabilities I've never used. (This is not a paid advertisement, I've just started rambling.)
> So I spoofed the system administrator's username (not hard on Win9x) and sent off a stern warning, which must've surprised them since suddenly all the messages stopped. :)
> I also described ARP as a layer 3 protocol. There’s some contention on this — while I think this is the most accurate and easiest explanation, networking is more nuanced than the OSI model might convey. Some would describe ARP as a level 2 or even level 2.5 protocol. For our purposes, I believe calling it level 3 makes the most sense.
TCP/IP doesn't follow the OSI model, so the nuance of OSI isn't directly applicable. ARP is practically defined (ref Stevens) as being in layer 2.5 (of the TCP/IP model), so i believe calling it 2.5 would make the most sense.
and i mean, ARP frames aren't routable. so they clearly aren't L3.
That reminds me of a chat software that I did in Delphi 3 back in 1999/2000 (being not that much older than OP) for our LAN parties, that was basically broadcasting on 255.255.255.255 [0]
It was inspired by Kali (remember Kali? [1]) and IRC.
I think it worked until we moved from hubs to switches ;)
Keep on coding! :)
Should work fine on switched network (like DHCP) ? - but won't cross subnets.
Ed: maybe some of you moved to wireless - and some stayed on a different cabled subnet?
I don't even understand the network code all that much (actually written by a friend) but it does use INADDR_ANY, INADDR_BROADCAST and SO_BROADCAST.
edit: Tried it on two old Windows 7 computers on my mixed rj45 / wifi home network and some chat data are received by the other party and some don't, or it crashes. Fun.
edit2: Actually works great on a version where I could set a specific broadcast address like 192.168.1.255.
I've been to ski resorts where there's no phone reception, and I love it that way. No one's on their phones. But it's easy to lose someone for an entire day (or until your agreed meeting time).
Is it possible to use something like this to setup a wireless network which would facilitate chat without a connection to the outside world?
Ok now that I typed it it sounds crazy but I always thought this should be possible
Also: I tried this on a United/KLM flight recently, and it didn't work for me.
[1] https://onemileatatime.com/news/united-airlines-free-infligh...
Modern network protocols have so much extra reserved bits that you can add pretty much anything want in it; keep going ;)