In the series “why wouldn’t I put this out public instead of just saving it to my own notes”: Moving the Zabbix database to a new database server. Step 1: Dumping the current database # mysqldump –single-transaction zabbix | gzip > /mnt/zbx-dump.sql.gz No need to stop Zabbix for this. Add –user and –host and similar […]
Reading XML with Python
In an earlier post I wrote about reading CSV files with Python. This time let’s read some XML using just Python standard library, the ElementTree XML API. For the demonstration I’ll use this short XML output from Nmap: Originally the Nmap output was not indented at all but I copied it to VSCode and reformatted […]
Sending DHCP Discover with Python and Scapy
Simple example how to send a UDP packet with Scapy in a Python application: When using sendp() it is necessary to construct the full packet, starting from L2 Ethernet frame. The “/” operator is cleverly used when combining the layers of the packet.
PowerShell Memos
This post contains some of my various and continuous memos for exploring and learning PowerShell. These are not organized in any particular order. Get-Alias (no explanation needed) Get-Command: Use when unsure which commands are available Get-Member: Shows the methods and properties of an object. Also shows the object type. Example: PS C:\> $name = “Markku” […]
Configuring SNMP Trap Receiver for Zabbix on Debian
In order to handle SNMP traps in Zabbix you need to configure your server to receive the traps. Here are the steps, tested with Zabbix 5.4 on Debian Linux 10 (Buster), assuming Zabbix server has already been installed from the official repository: (Note: Long commands and paths below can appear split incorrectly, so be careful […]
Inter-Process Communication with Named Pipes between Python and PowerShell
I have a hunch that I may later need IPC between Python and PowerShell applications on Windows, so I did some research, and managed to make a small example of IPC using named pipes. Here the PowerShell app is the server, waiting for connections, and Python app is the client. simplepipeserver.ps1: simplepipeclient.py: The Python app […]
Comparing Version Numbers in Python
The distutils module is going to be deprecated in Python 3.10, and to be removed in Python 3.12. Hence, my current standard way of comparing version number strings is using pkg_resources module (part of setuptools): >>> from pkg_resources import parse_version as version >>> version(“1.0”) <Version(‘1.0’)> >>> version(“1.8.9”) < version(“2.0”) True >>> version(“2.0.9”) < version(“2.1”) True […]
Customizing Wireshark Settings
I’ve done countless troubleshooting sessions so that I’m having Wireshark open with a relevant capture file and either I’m showing my findings to the other participants or doing straight up live packet analysis. Sometimes the sessions are followed up with questions about how did I actually have Wireshark configured because it looked different on their […]
Git Configurations
I use Git almost daily but I need my memos for the uncommon operations. Therefore the posts: Part 1: Git Configurations (this post) Part 2: Using Forks in GitHub When I’m using Git I need to first configure it. Well, strictly speaking, if I’m only going to clone some repository I don’t need to especially […]
Creating an API with Amazon API Gateway and AWS Lambda
This is all about creating your first API in the Amazon cloud, serverless (= using someone else’s servers). In this example I’ll create: An AWS Lambda function (in Python) that is the code that does the things I want to do when someone calls my API An Amazon API Gateway that is the frontend for […]