Skip to content

Instantly share code, notes, and snippets.

@jo-makar
jo-makar / apt-and-zoom.md
Created July 4, 2021 19:43
Apt and zoom (or any custom deb)

Apt and zoom (or any custom deb)

Setup

mkdir -p /srv/apt
# copy to update-zoom.py to /srv/apt

echo 'APT::Update::Pre-Invoke {"cd /srv/apt && ./update-zoom.py && apt-ftparchive packages . >Packages && apt-ftparchive release . >Release";};' >/etc/apt/apt.conf.d/100custom
echo 'deb [trusted=yes] file:/srv/apt ./' >/etc/apt/sources.list.d/custom.list
@jo-makar
jo-makar / aws-ami-scratch.md
Created January 28, 2021 19:53
Create an AWS AMI from scratch

Create an AWS AMI from scratch

  • Create (or import) a virtual machine
    • Any hypervisor would work though KVM does not easily support exporting to an OVA
      • The challenge with KVM is not the disk conversion from qcow2 but the generation of an OVF file (TODO Investigate options)
    • Note that the virtual machine should not be EFI-based, which EC2 does not support
  • Install and configure cloud-init (minimally for deploying the ssh keypair and resetting the sshd host keys)
    • Assuming a Centos / Red Hat based system:
yum -y install cloud-init
@jo-makar
jo-makar / Dockerfile
Last active January 23, 2023 06:59
Metasploit framework as a docker container including persistent database storage
FROM debian:10
RUN apt-get update && \
apt-get install -y curl gnupg2 nmap postgresql postgresql-client
# Ref: https://docs.rapid7.com/metasploit/installing-the-metasploit-framework/#installing-the-metasploit-framework-on-linux
RUN cd /root && curl -o msfinstall https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb && chmod +x msfinstall
RUN cd /root && ./msfinstall
# Ref: https://www.offensive-security.com/metasploit-unleashed/using-databases/
@jo-makar
jo-makar / tls-client.py
Created June 5, 2020 03:46
TLS server and client demo
#!/usr/bin/env python3
import argparse, contextlib, socket, ssl
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--host', '-o', default='localhost')
parser.add_argument('--port', '-p', type=int, default=4430)
args = parser.parse_args()
@jo-makar
jo-makar / logger.go
Last active May 11, 2020 18:00
Logging framework
package logger
import (
"fmt"
"io"
"path"
"runtime"
"strings"
"sync"
"time"
@jo-makar
jo-makar / 0-systray-notify.md
Last active May 11, 2020 03:16
Systray notifier

Systray notifier

This is a simple project to receive D-Bus desktop notifications and display them with a systray application.

Purposefully displaying notifications only when the systray application is right-clicked, if OSD notifications is your preference there are a multitude of options available: notification-daemon, notify-osd, dunst, etc.

screenshot

@jo-makar
jo-makar / debian-ssh-install.md
Created May 8, 2020 03:40
Install Debian over SSH

Create the modified ISO

mount -o loop debian-10.0.0-amd64-netinst.iso /mnt/loop
mkdir debian-10.0.0-amd64-netinst
shopt -s dotglob; cp -rv /mnt/loop/* debian-10.0.0-amd64-netinst/
umount /mnt/loop

dd if=debian-10.0.0-amd64-netinst.iso of=isohdpfx.bin bs=1 count=432

cp debian-10.0.0-amd64-netinst/.disk/mkisofs .
@jo-makar
jo-makar / i3-session.py
Last active December 24, 2019 01:32
Framework to restore/build an i3 session
#!/usr/bin/env python3
# Restore/build an i3 session
import argparse, json, logging, queue, subprocess, threading
if __name__ == '__main__':
def i3msg(args):
cmd = ['i3-msg'] + args
logging.info('cmd = %r', cmd)
subprocess.check_call(cmd, stderr=subprocess.STDOUT, encoding='utf-8')
@jo-makar
jo-makar / proc-mem.md
Last active October 17, 2019 20:02
Read live process memory

Read live process memory

/proc/$pid/maps describes virtual memory regions with the first column being the address range

cd /proc/$pid/mem

# Extract the start and end address for the first entry (NR==1)
eval $(awk -F'[- ]' 'NR==1 {print "s="$1" e="$2}' maps)
@jo-makar
jo-makar / pxeboot.md
Last active May 28, 2024 17:42
Setup a PXE boot server

Setup a PXE boot server

Using dnsmasq (on Debian)

apt-get install dnsmasq pxelinux syslinux-common syslinux-efi

mkdir /srv/tftpboot

ln -s /usr/lib/PXELINUX/pxelinux.0 /srv/tftpboot/