Skip to main content

Output details of hosts on the network found by Linux's avahi mdns server in JSON.

Project description

avahi-json

@readwithai - X - blog - machine-aided reading - 📖⚡️🖋️

Query the local network for devices and services using MDNS bia avahi (like avahi-browser -ar) but output results in easy-to-use JSON.

Motivation

I have an Android phone on my home network. I also use KDE connect on the phone. I occassionally want to connect to this phone via ADB over a TCP connection, but the IP address is not fixed.

I could use KDE connect to find the device since KDE connect advertises itself using an MDNS services (i.e. avahi). This would be all well and good - but the avahi command-line tool neither allows me to directly query for my phone, nor does it produce machine-readable output.

Therefore I am writing something which queries for services on the network using avahi and outputs theresult in beautiful JSON. I am slightly surprised that no one has done this before.

Installation

You must first install the python3-avahi bindings. These are handled by apt on Ubuntu and can be installed with sudo apt install python3-avahi.

You can then install avahi-json itself using pipx with the following command (--system-site-packages is needed for avahi and dbus):

pipx install --system-site-packages avahi-json

You need to have avahi, Linux's mdns daemon, installed to use this. But this tends to be installed by default.

Usage

Run avahi-json: this will give you services on the network with a separate JSON entry on each line.

About me

I am @readwithai. I create tools for reading, research and agency sometimes using the markdown editor Obsidian.

I also create a stream of tools that are related to carrying out my work.

I write about lots of things - including tools like this - on X. My blog is more about reading and research and agency.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

avahi_json-1.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

avahi_json-1.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file avahi_json-1.1.0.tar.gz.

File metadata

  • Download URL: avahi_json-1.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for avahi_json-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6b42b16e0363f2553b90d9581c656ac343f6951df61c2db025d35527ae994449
MD5 bde31b85de81d8ee3fbcf1457b90081f
BLAKE2b-256 784de4bdd7394b6095d5023b6092e8ce00de3345b29366704446ef538b666da6

See more details on using hashes here.

File details

Details for the file avahi_json-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: avahi_json-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for avahi_json-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e7af3932dfeccc9b17c741d52406a5ff256e5e8b07a6167ed53ed00deeb6ea5
MD5 cc1d042502567f8f41f2f04107b7f65e
BLAKE2b-256 220f3fd63bbb1500a77a416f5c89ee50e96ecb08e4c4f2a42907b5d0a8fb64a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page