Skip to content

Instantly share code, notes, and snippets.

@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/
@jo-makar
jo-makar / logstream.cpp
Created April 19, 2019 14:15
Logging framework implemented as an input stream
#include "logstream.hpp"
#include <chrono>
#include <ctime>
#include <mutex>
#include <thread>
using namespace std;
unsigned int thread_id() {
static unsigned int idx = 0;
@jo-makar
jo-makar / 0-sqli.md
Last active April 2, 2019 15:14
SQL injection notes / tools

SQL injection notes / tools

userpass.py

Assume a login page with the query: select password from admins where username=\'%s\'

Login outright use:

  • username: ' union select "foo"; --
  • password: foo
@jo-makar
jo-makar / suricata.py
Last active September 11, 2018 19:48
Suricata rule lexer/parser
# Suricata rule lexer/parser
#
# http://www.dabeaz.com/ply/ply.html
# https://suricata.readthedocs.io/en/latest/rules/intro.html
#
# TODO Perhaps a better approach is to isolate the signature parsing code from the suricata source
# and create bindings for higher-level languages around that isolated code
# See https://github.com/OISF/suricata/tree/master/src/detect-parse.{c,h} SigParse()
@jo-makar
jo-makar / metrics.py
Last active March 27, 2018 11:55
Thread-safe metrics storage that calculates rate of change using linear regression
import collections, datetime, threading, time
class MetricsThread(threading.Thread):
'''
Thread-safe metrics storage that calculates rate of change using linear regression (ie line-fitting).
Values can be stored by (external) increment calls and/or by periodic callback functions.
Keyword arguments:
callbacks -- metrics to be also determined periodically via callbacks,