Tag Archives: network

Glade and python – network tester

THIS IS A WORK IN PROGRESS ! .. Updates follow

UPDATE: Found a glade project from 2002

The goal of this project is to have a raspberry-pi with a screen wich shows network information.
It wil be using a battery, touchscreen .. maybe some status leds.
When debugging network issues we want to have information when/if/how a network port works on our switches.

It should show:

  • dhcp ip
  • gateway
  • can access internet?
  • speedtest
  • detect if vlan tagged network packets are present on the port?
  • icmp test
  • list of detected nearby hosts?

A long time ago i played with glade and C / Perl.

But i’d rather use python so i’m looking into glade/python combi for this little project.

Glade is a gnome/GTK user interface RAD tool. (Rapid Application Development)

i’ve used zenity and yad before to create simple gui’s for bash scripts, these where only for quick and dirty solutions. (See other posts)
Glade is a far better solution, but a little harder to use.

Below is a little framework i started with

Python script

import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

class Handler:
    def onDestroy(self, *args):

    def on_firstbutton_clicked(self, button):
        print("Ping test")

builder = Gtk.Builder()

window = builder.get_object("Main")


Glade file

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkWindow" id="Main">
    <property name="can-focus">False</property>
    <property name="title" translatable="yes">Networktool</property>
    <property name="default-width">440</property>
    <property name="default-height">250</property>
    <property name="icon-name">network-wired</property>
      <object class="GtkFixed" id="fixed1">
        <property name="visible">True</property>
        <property name="can-focus">False</property>
          <object class="GtkButton" id="firstbutton">
            <property name="label" translatable="yes">Ping test</property>
            <property name="width-request">100</property>
            <property name="height-request">16</property>
            <property name="visible">True</property>
            <property name="can-focus">True</property>
            <property name="receives-default">True</property>
            <signal name="clicked" handler="on_firstbutton_clicked" swapped="no"/>
            <property name="x">56</property>
            <property name="y">40</property>
          <object class="GtkButton" id="speedtest">
            <property name="label" translatable="yes">Speed test</property>
            <property name="width-request">100</property>
            <property name="height-request">16</property>
            <property name="visible">True</property>
            <property name="can-focus">True</property>
            <property name="receives-default">True</property>
            <property name="x">56</property>
            <property name="y">89</property>
          <object class="GtkTextView">
            <property name="width-request">179</property>
            <property name="height-request">166</property>
            <property name="visible">True</property>
            <property name="can-focus">True</property>
            <property name="x">222</property>
            <property name="y">36</property>

Which is generated using the Glade designer

When running you get below screen

Old glade program (2003)


I used to draw my network using inkscape, or graphviz. But the last years i’ve been using DrawIO. A friend is drawing his. So i posted some tips.

When using inkscape, i liked the way that i could view more or less details using layers. But editing was hard.

Getting DrawIO:

There is a online version: https://app.diagrams.net/
You can download a AppImage
And .. install it in your nextcloud, which is the way i’m using it.
(Login as admin, click Apps and search for draw.io)

Some tips on using images ..
Below is a example of a Mikrotik switch with connector points.

Use a search engine to look for images, the ones with front facing connectors are easier to use.
I always look for images which have a transparent background.
Using google you can use below ‘trick’
google > images > tools > color > transparent
Just copy-paste into your DrawIO document, it is better to have a large picture which you can resize as the other way around.

Adding connection points:

Left click the image in DrawIO, right mouse and Edit connection points

Now you can place/remove edit connection points.

Due to security reasons i won’t be posting my complete network image ..

Another tip:

Network sheet a friend is working on

Device is not straight, so its harder to get the connections right. Besides that, the lines are below the device. Click line and select bring to front.


Changed stuff in my arpscanner

I want to know whats on my network, and be informed when a alien device connects.
This also helps me gathering all devices and macaddresses for a cmdb.

I’ve got below in my crontab

5 * * * * root /usr/local/bin/arpscanner

And the script:

# Using a scanner on a specific vlan/interface
arp-scan -l -g  -I p1p1.10 | grep ^10 | grep -vi packets > /var/log/arpscanner
cat /var/log/arpscanner | awk '{ print $2 }'| while read ; do
grep $REPLY /var/local/arpscanner.lst >/dev/null || echo $REPLY | mail -s arpscanner henri@henriaanstoot.nl

New and checked devices i put in the file mentioned above:

                00:21:5d:gg:gg:7a       Description
                ac:67:b2:gg:gg:a0       Liligo Twatch
                b8:27:eb:gg:dd:fd       Nieuwe octoprint
                d8:f1:5b:gg:gg:4a       WLAN Dungeon
                48:3f:da:gg:gg:fe       Uboot ESP
                8e:93:79:gg:gg:5d       Tablet Monique
                d8:f1:5b:gg:gg:06       ESP Radar
                dc:a6:32:gg:gg:fb       RPI4
                00:1e:ec:gg:gg:ab       laptop
                68:05:ca:gg:gg:68       storage bak