Skip to content

Instantly share code, notes, and snippets.

View kbabioch's full-sized avatar

Karol Babioch kbabioch

View GitHub Profile
@kbabioch
kbabioch / wireguard
Last active March 12, 2024 14:35
LSBInitScript for Wireguard: This is a leightweight init script for Wireguard. While Wireguard itself requires only minimal overhead to setup and start, it still requires some script invocations (e.g. during boot).
#! /bin/bash
# Copyright (c) 2021 Karol Babioch <karol@babioch.de>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@kbabioch
kbabioch / dnssey-keymgr.md
Created April 10, 2023 12:03
systemd unit files for dnssec-keymgr

systemd unit files for dnssec-keymgr (bind 9.16). No longer relevant with 9.18, but might still be useful. Archiving it here.

dnssec-keymgr@.service:

[Unit]
Description=dnssey-keymgr for %i

[Service]
Environment=DNSSEC_POLICY_FILE=/etc/dnssec-policy.conf
@kbabioch
kbabioch / crash-heatpump.py
Last active March 22, 2023 10:42
Demonstation of a vulnerability in Alpha Innotec heatpumps (firmware version V3.85.8 (r7193)).
#! /usr/bin/env python3
import argparse
import socket
parser = argparse.ArgumentParser()
parser.add_argument('ip')
parser.add_argument('port', type=int)
args = parser.parse_args()
@kbabioch
kbabioch / oea-box-info.py
Created March 18, 2021 21:52
Custom Ansible module to collection hardware-specific information about a Enigma2-based receiver (based on boxbranding from OE-Alliance).
#! /usr/bin/env python
# Copyright (c) 2021 Karol Babioch <karol@babioch.de>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@kbabioch
kbabioch / hooks.py
Created June 7, 2018 09:46
Prototype of a hook for urlwatch to retrieve releases from GitHub via official API
# Copyright (c) 2018 Karol Babioch <karol@babioch.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@kbabioch
kbabioch / check_systemd_failed
Created June 3, 2019 22:06
This is a very simple script that will check for failed systemd units by parsing the output of systemctl(1).
#!/usr/bin/env python3
# Copyright (c) 2019 Karol Babioch <karol@babioch.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@kbabioch
kbabioch / check-nsec3param
Created February 14, 2019 21:00
Checks NSEC3PARAM for a given zone
#! /usr/bin/env python3
#
# Copyright (c) 2019 Karol Babioch <karol@babioch.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@kbabioch
kbabioch / check-soa-consistency.py
Created February 9, 2019 16:31
Checks for consistency of SOA records in zone belonging to a given name on all authoritative nameservers
#! /usr/bin/env python3
import argparse
import logging
import re
import subprocess
import sys
# Exit codes
EXIT_OK = 0
@kbabioch
kbabioch / check_postfix_log.py
Created November 9, 2017 16:49
Analyzes mail log files from Postfix (in Python)
#! /usr/bin/env python
from datetime import datetime, timedelta
from optparse import OptionParser
import sys
import re
# TODO Read log lines backwards
desc="""This is a simple Nagios plugin that will analyze the mail log from
@kbabioch
kbabioch / check_postfix_log.go
Created November 9, 2017 16:47
Analyzes mail log files from Postfix (in Go)
package main
import (
"bufio"
"flag"
"fmt"
"os"
"regexp"
"strconv"
"time"