Sending a raw AX.25 frame with Python

Earlier this week I set up Dire Wolf on my mac and was immediately confronted by a lack of tooling to send AX.25 packets. At the time I resorted to using Xastir on a separate Linux machine. What if I wanted to perform a simple transmission test using software already present on the mac, such as Python?

I’ve written a Python 2 script that does this to a very basic degree—you get to specify the source and destination callsigns and a message, which is transmitted as a UI frame with no protocol (0xF0). Digipeaters are not supported. You can grab it here if you want: send_kiss_frame.py

python send_kiss_frame.py vk7ntk-2 vk7ntk-1 "This is a test message to myself"

There are four main steps involved.

  1. Encode the source and destination callsigns;
  2. Build up the AX.25 frame by combining the encoded addresses and the user’s message;
  3. Insert this as the payload of a KISS “send data” frame;
  4. Connect to Dire Wolf on localhost, which listens for KISS commands on TCP 8001, and send this frame.

Although the script has utility and educational value, I wouldn’t recommend writing any serious packet application in this style. Code comments explain mostly what’s happening but if you wish to make any modifications you should refer to the KISS spec and the AX.25 spec.