Skip to content

Instantly share code, notes, and snippets.

View kylemanna's full-sized avatar

Kyle Manna kylemanna

View GitHub Profile
@kylemanna
kylemanna / onfailure.sh
Created September 11, 2014 08:44
Example failure handler for systemd that emails me
#!/bin/bash
#
# Author: Kyle Manna <kyle@kylemanna.com>
#
# Simple systemd script used to be called via something like:
#
# Example Unit section of a service file:
#
# [Unit]
# ...
@kylemanna
kylemanna / README-python-service-on-systemd-activated-socket.md
Last active May 12, 2024 12:27 — forked from drmalex07/README-python-service-on-systemd-activated-socket.md
An example network service with systemd-activated socket in Python. #systemd #python #socket #socket-activation

README

The example below creates a TCP server listening on a stream (i.e. SOCK_STREAM) socket. A similar approach can be followed to create a UDP server on a datagram (i.e. SOCK_DGRAM) socket. See man systemd.socket for details.

An example server

Create an simple echo server at ~/tmp/foo/serve.py.

@kylemanna
kylemanna / podman-compose.yaml
Last active March 17, 2024 22:02
Podman Compose File that runs Windows in KVM + QEMU
# Podman Compose File that runs Windows in KVM + QEMU
#
# Upstream: https://github.com/dockur/windows
#
# Note: Can't run this rootless as the netardvark proxy doesn't create a host
# network interface for communication with the container which is what's
# expected for the iptables NAT port forwarding rule to work for port 3389.
# Instead it arrives appearing to be from the same interface and skips the nat
# redirect and fails.
#
@kylemanna
kylemanna / android-ca-cert-hash.sh
Last active March 7, 2024 20:41
Generate hash file name for Root CAs on Android. Handy for things like mitmproxy.
CERT=$1
NAME=$(openssl x509 -in $HOME/.mitmproxy/mitmproxy-ca-cert.cer -subject_hash_old -noout)
cp ${CERT} ${OUT}/system/etc/security/cacerts/${NAME}.0
@kylemanna
kylemanna / gist:1367672
Created November 15, 2011 17:20
Relocate ELF binary file for use with JTAG debugging
#!/bin/sh
# Following command will relocate the linux kernel elf file from
# 0xc000_0000 to 0x8000_0000 which coincides with the actual load
# address on TI OMAP3 platforms.
# This should also work for debugging the second stage of u-boot
# after it has been relocated
arm-none-linux-gnueabi-objcopy --change-addresses -0x40000000 vmlinux vmlinux.2
#!/usr/bin/env python
"""Prefix wrapper for wireguard-vanity-address
* Improve performance for generating keys with common prefixes.
* Extract prefixes delimited by a '+' or '/'.
* Exit at least on match for each prefix.
Usage:
$ wg-vanity.py ex{1,2,3}
Searching for ['ex1/', 'ex1+', 'ex2/', 'ex2+', 'ex3/', 'ex3+'] with ['wireguard-vanity-address', '--in', '2', 'ex']
@kylemanna
kylemanna / dnsmasq.sh
Created March 15, 2017 02:35
Simple tftp server using dnsmasq
$ sudo dnsmasq -kd -p 0 -C /dev/null -u nobody --enable-tftp --tftp-root=/srv/ftp
@kylemanna
kylemanna / README.md
Created November 1, 2023 23:28
Simple network speedtest in Docker container

README

Run a quick network test.

docker run --rm -it --workdir=/tmp alpine sh -c 'apk add -u bash grep; wget -qO- network-speed.xyz | su -s /bin/bash nobody'

#
# Read from journalctl outputting json and sort the data by program frequency
#
# https://blog.kylemanna.com/linux/systemd-journalctl-sort-by-frequency
#
# Author: Kyle Manna
#
# invocation: journalctl -o json --since "1 month ago" | jq -s -f systemd-journalctl-sort-by-program-frequency.jq
#
@kylemanna
kylemanna / AuthyToOtherAuthenticator.md
Created December 24, 2021 04:56 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the