Pi-hole data right from your terminal. Live updating view, query history extraction and more!

Pi-CLI

CodeQL

Pi-CLI is a command line program used to view data from a Pi-Hole instance directly in your terminal.

terminal

Features

  • Live view
    • As shown above, Pi-CLI can generate a live updating view of your Pi-Hole data
    • Updates down to a minimum of 1s, providing essentially live query data. Support for smaller intervals may come in the future.
    • Update parameters including the number of queries being logged in the 'latest queries' table and watch the UI automatically update and pull in the correct data for you. Use your arrow keys to scroll and navigate the table.
  • One off commands
    • Don't want a live view? No worries! Use one of the subcommands of Pi-CLI to tell it exactly what data you want, and it will give it to you. No fancy UI needed.
  • Quickly configure and forget
    • Run one setup command, and Pi-CLI will store and remember all of your details for next time.
  • Lightweight
    • In its default configuration, the live view of Pi-CLI only uses ~10MB memory, usually less.
  • Secure
    • Your API key is never stored in plaintext. Pi-CLI uses cross-platform OS keyring libraries to make sure your Pi-Hole API key is both securely stored and easy to retrieve in the future.

Usage

picli.exe [global options] command [command options] [arguments...]

For help, run ~$ ./picli -h

Commands

   setup, s   Configure Pi-CLI
   config, c  Interact with stored configuration settings
   run, r     Run a one off command without booting the live view
   help, h    Shows a list of commands or help for one command

One off use of the run command

   summary, s          Extract a basic summary of data from the Pi-Hole
   top-queries, tq     Extract the current top 10 permitted DNS queries
   top-ads, ta         Extract the current top 10 blocked domains
   latest-queries, lq  Extract the latest x queries. Takes a flag for -q, the number of queries to extract

FAQ

  • Where do I get my API key?
    • Navigate to your Pi-Hole's web interface, then settings. Click on the API/Web interface tab press 'Show API token'
  • Pre-Compiled binaries?
  • How do I compile myself?
    • cd ./src && go build -o picli

If you find Pi-CLI useful, please consider donating to the Pi-Hole project

Or, feel free to submit code to make Pi-CLI even more useful!

Owner
Reece Mercer
Software Engineer at BAE Systems & undergraduate CS Student at City, University of London. Lover of tech & space.
Reece Mercer
Comments
  • raspberry pi4

    raspberry pi4

    Hi there, should this run on a raspbery pi4? I get this error when running the setup:

    $ picli setup
    Please enter the IP address of your Pi-Hole: 127.0.0.1
    Please enter the port that exposes the web interface (default 80): 80
    Please enter your preferred data refresh rate in seconds (default 1s): 1
    Enter API key (stored securely, not in a file): *****
    2021/02/21 12:20:42 exec: "dbus-launch": executable file not found in $PATH
    
  • pictl does not find pi-hole when Admin interface hosted in nginx instead of lighttps

    pictl does not find pi-hole when Admin interface hosted in nginx instead of lighttps

    I have disabled lighttpd and use nginx to host the admin website of PiHole. When setting up pi-cli, I and up in a loop:

    root@raspberrypi1:/home/pi/picli/src# ./picli setup
    Please enter the IP address of your Pi-Hole: 127.0.0.1
    Please enter the port that exposes the web interface (default 80): 8080
    Pi-Hole doesn't seem to be alive, check your details and try again!
    
    Please enter the IP address of your Pi-Hole: ^C
    

    Port/IP are valid, nginx ist listening:

    root@raspberrypi1:/home/pi/picli/src# netstat -tulpen
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name
    tcp        0      0 127.0.0.1:4711          0.0.0.0:*               LISTEN      999        19651      813/pihole-FTL
    tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      0          300146     3031/nginx: master
    tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      0          300144     3031/nginx: master
    tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      999        19642      813/pihole-FTL
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          16294      759/sshd
    tcp        0      0 127.0.0.1:443           0.0.0.0:*               LISTEN      0          300147     3031/nginx: master
    tcp6       0      0 ::1:4711                :::*                    LISTEN      999        19649      813/pihole-FTL
    tcp6       0      0 :::80                   :::*                    LISTEN      0          300145     3031/nginx: master
    tcp6       0      0 :::53                   :::*                    LISTEN      999        19644      813/pihole-FTL
    tcp6       0      0 :::22                   :::*                    LISTEN      0          16296      759/sshd
    tcp6       0      0 :::443                  :::*                    LISTEN      0          300148     3031/nginx: master
    
  • Keyring issue?

    Keyring issue?

    Pi4b / Raspbarian 5.4.83-v7l+ #1379 SMP Mon Dec 14 13:11:54 GMT 2020 armv7l GNU/Linux Headless / No desktop env.

    After configure I get: 2021/02/21 17:26:52 The name org.freedesktop.secrets was not provided by any .service files

    Sleuthing around it seems to be a keyring issue but I have keyring installed (https://pypi.org/project/keyring/), many say to install gnome-keyring but that bloats a tremendous amount. Do you know another way through this?

  • Investigate flashing UI elements under Linux

    Investigate flashing UI elements under Linux

    On Linux, (bare metal and WSL2), the UI flashes on updates. The flashes are made worse when keypresses are responded to. Having 2 separate timers for the data refresh rate and UI refresh rate will possibly be a fix. I think the speed of refreshes is causing an issue. Currently it refreshes once per iteration on a loop that iterates as fast as the CPU lets it - not ideal under any circumstances.

  • #15 #13 & some other small changes

    #15 #13 & some other small changes

    Resolves #15 (missing config file error) fixed. Resolves #13 (enable and disable Pi-Hole from live view and one off commands) implemented

    • Added proper wait groups to the update functions so the update time is accurate if the updates take longer than a second.
    • Added jumps of 10 for scrolling the query log list (and keybinds)
    • Added jumps of 10 for incrementing/decrementing the query log size (and keybinds)
  • Store config file outside of executable directory

    Store config file outside of executable directory

    It's not best practice to store the configuration file in the same directory as the actual executable. For most things like this, the user's home directory would seem to be a suitable place for it

Pi-fetch - get a summary of your pi-hole stats from your terminal

pi-fetch get a summary of your pi-hole stats from your terminal _ ___ _ _ ___|_|___| _|___| |_ ___| |_ | . | |___| _| -_| _

Jan 9, 2022
Fast, realtime regex-extraction, and aggregation into common formats such as histograms, numerical summaries, tables, and more!
Fast, realtime regex-extraction, and aggregation into common formats such as histograms, numerical summaries, tables, and more!

rare A file scanner/regex extractor and realtime summarizor. Supports various CLI-based graphing and metric formats (histogram, table, etc). Features

Dec 29, 2022
🎄 A Christmas tree right from your terminal!
🎄 A Christmas tree right from your terminal!

ctree ?? A Christmas tree right from your terminal! ?? Demo ⌛ No Refresh Don't want the tree to refresh every 2 seconds? Easy! Just add the --no-refre

Dec 20, 2022
Create new commands from your shell history or terminal.

overdub Create new commands from your shell history or terminal. TODO list for initial release Filter out unlikely commands (e.g. package managers) fr

Aug 9, 2022
Integrated console application library, using Go structs as commands, with menus, completions, hints, history, Vim mode, $EDITOR usage, and more ...
Integrated console application library, using Go structs as commands, with menus, completions, hints, history, Vim mode, $EDITOR usage, and more ...

Gonsole - Integrated Console Application library This package rests on a readline console library, (giving advanced completion, hint, input and histor

Nov 20, 2022
Live streaming from your terminal
Live streaming from your terminal

TStream - Streaming from terminal ??‍♂️ Come stream at tstream.club How to start streaming Please refer to this link Upcoming features One command to

Jan 2, 2023
ghcv-cli makes it easy to view the user-created issues, pull requests, and repositories in the terminal.
ghcv-cli makes it easy to view the user-created issues, pull requests, and repositories in the terminal.

ghcv-cli ghcv-cli makes it easy to view the user-created issues, pull requests, and repositories in the terminal. About Show a list of pull requests c

Mar 13, 2022
view stonks from the terminal
view stonks from the terminal

stonks view stonks from the terminal Preview Why? Why not >:D Installation Requirements Golang 1.16 $ git clone https://github.com/nerdthatnoonelikes/

Jun 19, 2022
Contextual information about your git projects, right on the command-line
Contextual information about your git projects, right on the command-line

gitty gitty is a smart little CLI helper for git projects, that shows you all the relevant issues, pull requests and changes at a quick glance. It cur

Jan 8, 2023
Terminal stock ticker with live updates and position tracking
Terminal stock ticker with live updates and position tracking

Ticker Terminal stock watcher and stock position tracker Features Live stock price quotes Track value of your stock positions Support for multiple cos

Jan 8, 2023
mlp is a comman line tool responsible for creating, updating and deleting kubernetes resources based on files generated by Mia-Platform Console.

mlp is a comman line tool responsible for creating, updating and deleting kubernetes resources based on files generated by Mia-Platform Console.

Apr 28, 2022
Build self-updating Go programs

selfupdate: Build self-updating Go programs NOTE: Original work at github.com/inconshreveable/go-update, modified for the needs within MinIO project P

Jan 8, 2023
A sample FaaS function that gets a stock quote and 30 day history by symbol and returns a HTML page with a generates SVG sparkline.

faas stonks This uses serverless technology to get a stock quote and 30 day sparkline from Yahoo Finance. Deployment Nimbella account Namespace with o

Sep 23, 2021
That's right - order that nice pizza 🍕 with `kubectl`

pizza-controller making kubernetes do what it was always meant to do: order pizza. https://gum.co/kubernetes-crds to get up to speed with custom resou

Sep 27, 2022
Command not found? Install it right there!
Command not found? Install it right there!

Tii On most GNU/Linux systems, when a command is not found, a message showing what can be run to install the command is printed.

Aug 10, 2022
Pure Go command line prompt with history, kill-ring, and tab completion

Prompt Prompt is a command line prompt editor with history, kill-ring, and tab completion. It was inspired by linenoise and derivatives which eschew u

Nov 20, 2021
Pure Go line editor with history, inspired by linenoise

Liner Liner is a command line editor with history. It was inspired by linenoise; everything Unix-like is a VT100 (or is trying very hard to be). If yo

Jan 3, 2023
🏗️ Fetch a specific commit without any history (shallow depth w/o cloning)

shallow-fetch-sha ??️ For a given git repository and commit, fetch and checkout just that commit without any history. This can be extremely useful in

Nov 27, 2021