Skip to content

Instantly share code, notes, and snippets.


Charlton Trezevant ctrezevant

View GitHub Profile
import base64
import hashlib
class CardHasher():
def __init__(self, **kwargs):
if 'alg' in kwargs:
self.hasher = kwargs['alg']
self.hasher = hashlib.sha256
# 0 7 1-31/2 * * bash /home/charlton/scripts/ >/dev/null 2>&1
HOST="$(cat /etc/hostname)"
echo "
Today in history:
`calendar -f /home/charlton/.calendar/calendar`
ctrezevant / birthdays_are_pii.go
Created Jun 1, 2019
How to shut down an entire installation for the good of mankind
View birthdays_are_pii.go
// step (1) register for the free premium trial
// step (2) create a new team using the participants list of one of the default channels
// step (3) run this script
package main
import (
ctrezevant / pass.js
Last active Apr 21, 2019
Absurdly ridiculous quick n dirty random password sheet generator
View pass.js
// Absurdly ridiculous random password sheet generator
// For use at
function genPass(numWords) {
var randChars = "@%^*().?:;+=-_";
var gen = getWords(numWords, 5);
var passwd = [];
for (var i = gen.length - 1; i != -1; i--) {
var goodness = "";
ctrezevant /
Created Apr 11, 2019
A simple lambda function to subscribe Firebase Cloud Messaging clients to a set of topics. Used to furnish web push notification support in the CTFd web UI during SunshineCTF 2019.
from __future__ import print_function
import urllib2
import urllib
import json
'DEFAULT_TOPICS': ["all", "some_topic_here"]
View maria.go
// 🂁 ctrezevant@sdf ~ $ time go run ctf.go
// go run ctf.go 1.17s user 0.45s system 48% cpu 3.341 total
package main
import (
ctrezevant / banmi.js
Last active May 6, 2019
banmi.js is a simple module for implementing rate-limited lockouts
View banmi.js
// banmi.js - 2.0
// A simple module for rate-limited lockouts
// (c) 2019 Charlton Trezevant
// MIT License
var Banmi = {};
// Initial ban length, which is used to calculate the scaling ban length per
// the total number of failed attempts
Banmi.initialBanLength = 120;
ctrezevant /
Created Jan 5, 2019
Running a web server behind cloudflare? Run this at startup to apply the freshest firewall rules for their network, automagically :)
# For railgun- allow incoming connections on port 2408 from Cloudflare's ip ranges
echo 'Applying latest firewall configuration for Cloudflare Railgun...'
for i in `curl`;do iptables -I INPUT -p tcp -s $i --dport 2408 -j ACCEPT; done;
# For regular 'ol communication over HTTP(S), which should still be coming only via cloudflare
echo 'Applying latest firewall configuration for incoming HTTP traffic from Cloudflare...'
for i in `curl`;do iptables -I INPUT -p tcp -s $i --dport 80 -j ACCEPT; done;
echo 'Applying latest firewall configuration for incoming HTTP traffic from Cloudflare...'
for i in `curl`;do iptables -I INPUT -p tcp -s $i --dport 443 -j ACCEPT; done;
# Now that we've defined our whitelists, let's block out everyone else from talking to ports 2408, 80, and 443
ctrezevant / debugf.h
Last active May 29, 2020
A tiny little macro to help debug your C code.
View debugf.h
// debugf.h
// Charlton Trezevant - 2018
// MIT license
* To use this macro, simply paste it into your source file (you may also
* include debugf.h if you have many source files). Doing this will define
* the function debugf(), which acts as a thin wrapper around fprintf() with
* a little added pizazz.
ctrezevant /
Created Nov 20, 2018
Gather interesting telemetry data from your Southwest flight!
#! /usr/bin/env bash
# The oneliner below will gather the latest telemetry data about your Southwest flight every two seconds.
# Each response is stored as a text file in JSON format, with the name of the file being the current time.
# I recommend running this in a directory you've created for this purpose.
watch -n 2 -x bash -c 'curl -o $(date +%T).json'