Skip to content

Instantly share code, notes, and snippets.

@bjoern-r
bjoern-r / ipsec2wireshark.py
Last active Oct 20, 2020 — forked from rectalogic/ipsec2wireshark.py
Parse spis and keys from "ip xfrm state" output and generate a Wireshark ESP decryption config that can decrypt an ESP capture.
View ipsec2wireshark.py
#!/usr/bin/env python
"""
Runs "ip xfrm state" and outputs lines to be added to ~/.wireshark/esp_sa
This process must be run using sudo.
This allows Wireshark to decrypt ipsec traffic captured with 'sudo tcpdump -vni any -U -w /tmp/esp.pcap "ip proto 50"'
"""
import sys
import subprocess
@bjoern-r
bjoern-r / BatteryVoltageGuard.ino
Created Apr 14, 2020
Simple Arduino sketch to control a relais to switch a relais if the voltage read from the adc is below a certain level
View BatteryVoltageGuard.ino
/*
Battery Guard
Use an arduino nano and connect the input voltage with an voltage divider to A0
I used 9kOhm and 1kOhm to get a /10 divider to be able to measure up to 50V
Switch points are for a 12v AGM battery.
The relais is controlled via D7.
*/
#define NUM_READINGS 10
#define RELAIS_PIN 7
#define ADC_REF 5.0
@bjoern-r
bjoern-r / codimd-oauth2.md
Last active Nov 2, 2019
CodiMD docker with Oauth2 via
View codimd-oauth2.md

CodeiMD authentication via Oauth2 with django-oidc-provider

install django-oidc-provider

create application in django-oidc-provider

Configure allowed callback urls:

https://pad.server.com/auth/oauth2/callback
http://pad.server.com/auth/oauth2/callback

Configure scopes:

@bjoern-r
bjoern-r / busybox-static-chroot.md
Last active Apr 9, 2019
busybox static chroot
View busybox-static-chroot.md

create user

usermod -G chrootlogin joe

add to sshd_config

change file /etc/ssh/sshd_config

Subsystem     sftp   internal-sftp
@bjoern-r
bjoern-r / create_start_minichroot.sh
Created Apr 8, 2019
Script to create a minimal chroot with busybox, dropbear and dtach and allow ssh access on port 5022
View create_start_minichroot.sh
#!/bin/bash
CHROOTDIR=/opt/minichroot
mkdir -p ${CHROOTDIR}/bin
mkdir -p ${CHROOTDIR}/lib64
mkdir -p ${CHROOTDIR}/etc/dropbear
mkdir -p ${CHROOTDIR}/dev
mkdir -p ${CHROOTDIR}/tmp
@bjoern-r
bjoern-r / ovpn_route.sh
Created Feb 21, 2019
openvpn script to configure routes via different routing table
View ovpn_route.sh
#!/bin/sh
# add to config
# --route-noexec
# --route-up script.sh
# --route-pre-down script.sh
echo "++++++++++++ $script_type ++++++++++++" | logger -t ovpn_route
#env | tee -a /tmp/vpn
#echo "--------------------------------------" | tee -a /tmp/vpn
@bjoern-r
bjoern-r / bloom.py
Last active Jan 23, 2019 — forked from marcan/bloom.py
Simple Bloom filter implementation in Python 3 (for use with the HIBP password list)
View bloom.py
#!/usr/bin/python3
#
# Simple Bloom filter implementation in Python 3
# Copyright 2017 Hector Martin "marcan" <marcan@marcan.st>
# Licensed under the terms of the MIT license
#
# Written to be used with the Have I been pwned? password list:
# https://haveibeenpwned.com/passwords
#
# Download the pre-computed filter here (968MB, k=11, false positive p=0.0005):
View etc_mosquitto_conf.d_sonoff.conf
#listener 1883 192.168.178.25
listener 1883
log_dest syslog
log_dest stdout
log_dest topic
log_type error
log_type warning
log_type notice
log_type information
connection_messages true
@bjoern-r
bjoern-r / sonoff2emoncms.py
Last active Dec 2, 2018
sonoff POW MQTT to emoncms publisher
View sonoff2emoncms.py
#!/usr/bin/env python
import paho.mqtt.client as mqtt
import json
import time
import requests
nodename="sonoff"
apikey="--xx--"
url="https://emoncms.org/input/post"
@bjoern-r
bjoern-r / randomTrace.md
Last active Sep 22, 2018
Random Tracepaces from around the world
View randomTrace.md

From Japan

curl nixda.biz/ip

133.11.240.193

tracepath nixda.biz

 1?: [LOCALHOST]                                         pmtu 1500
 1:  gateway                                               1.652ms