Skip to content

Instantly share code, notes, and snippets.

View robbmanes's full-sized avatar
🎮
pew pew

Robb Manes robbmanes

🎮
pew pew
View GitHub Profile
@robbmanes
robbmanes / Makefile
Created November 23, 2021 17:16
Example character device driver for generating large minor numbers
obj-m += bigdummy.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
@robbmanes
robbmanes / test-podman-api.sh
Created September 1, 2021 20:59
Simple script to test compatibility with podman API v2/Docker Engine API
#!/bin/bash
CONTAINER_NAME="nginx"
ENDPOINT="localhost:8080/v3.0.0"
function section {
echo ""
echo $1
printf -v UNDERLINE "%-${#1}s" '='
echo "${UNDERLINE// /=}"
}
@robbmanes
robbmanes / sigkill_tracer.stp
Created August 25, 2021 16:44
Trace sending and receiving of SIGKILL on Linux systems
#!/usr/bin/env stap
probe begin {
printf("Watching for signal(9) and reporting sender and receiver statuses...\n");
}
probe signal.syskill {
if(sig == 9) {
printf("[%s] SEND===> PID %d (%s) sent signal %d (%s) to PID %d (%s)\n",
ctime(gettimeofday_s()),
@robbmanes
robbmanes / iopl_test.c
Created August 17, 2021 18:49
iopl syscall test
#include <stdio.h>
#include <sys/io.h>
#include <errno.h>
#define LEVEL 3
int main(int argc, char **argv)
{
int rc;
rc = iopl(LEVEL);
@robbmanes
robbmanes / bigheader.conf
Created May 25, 2021 13:43
Useful Nginx Confs
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
@robbmanes
robbmanes / tcp_conn_blaster.py
Created March 17, 2021 16:24
Script that sets up a server to accept connections and a client to flood the server with connections.
import logging
import socket
import sys
import threading
import time
CLIENT_CONN_ADDR="127.0.0.1"
CLIENT_NUM_CONNS=10
SERVER_PORT=8888
SERVER_SYN_BACKLOG=128
@robbmanes
robbmanes / Dockerfile
Last active February 16, 2021 19:12
vmovsd-checker
FROM registry.redhat.io/ubi8-minimal
COPY vmovsd-checker.asm /root/
WORKDIR /root/
RUN microdnf install binutils -y && \
as vmovsd-checker.asm -o vmovsd-checker.o && \
ld vmovsd-checker.o -o vmovsd-checker && \
rm vmovsd-checker.o vmovsd-checker.asm && \
chmod +x vmovsd-checker
ENTRYPOINT ["/root/vmovsd-checker"]
@robbmanes
robbmanes / bashy-bois.sh
Last active February 8, 2023 01:05
bashy-bois
#!/bin/bash
# bashy-bois.sh
# Maintained by Robb Manes <robbmanes@protonmail.com>
#
# A collection of bash functions that I've used and written over time.
# You CAN use this as a single script, but you probably want to pick-and-choose what you're looking for.
# It's probably best to assume you need to be root to do anything below unless otherwise specified.
# find_all_ptraces
@robbmanes
robbmanes / bz1872868_workaround.yaml
Created October 7, 2020 16:52
rhbz1872868-runc-crio-workaround
apiVersion: v1
kind: Namespace
metadata:
name: bz1872868-workaround
labels:
app: bz1872868-workaround
---
apiVersion: v1
kind: ServiceAccount
metadata:
@robbmanes
robbmanes / watch-unix-socket.stp
Last active October 17, 2023 09:24
Systemtap script to watch UNIX socket input
/*
* watch_unix_socket.stp
*
* This is a simply more modern version of the script found here:
* https://sourceware.org/systemtap/wiki/WSunixSockets
*
* The first argument is the location of the file descriptor for a UNIX socket.
* To find this address, for example, for the Docker socket run:
*
* # lsof 2>&1 | awk '/docker.sock/ {print $7}' | grep -v '0t0' | sort -u