Skip to content

Instantly share code, notes, and snippets.

Avatar
🎵

Charlton Trezevant ctrezevant

🎵
View GitHub Profile
View CardHasher.py
import base64
import hashlib
class CardHasher():
def __init__(self, **kwargs):
if 'alg' in kwargs:
self.hasher = kwargs['alg']
else:
self.hasher = hashlib.sha256
View today_in_history.sh
# 0 7 1-31/2 * * bash /home/charlton/scripts/cal.sh >/dev/null 2>&1
EMAIL=''
HOST="$(cat /etc/hostname)"
echo "
Today in history:
`calendar -f /home/charlton/.calendar/calendar`
--
@ctrezevant
ctrezevant / birthdays_are_pii.go
Created Jun 1, 2019
How to shut down an entire birthdaybot.io 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 (
"fmt"
"github.com/nlopes/slack"
"time"
)
@ctrezevant
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 https://www.rempe.us/diceware/#eff
function genPass(numWords) {
var randChars = "@%^*().?:;+=-_";
var gen = getWords(numWords, 5);
var passwd = [];
for (var i = gen.length - 1; i != -1; i--) {
var goodness = "";
@ctrezevant
ctrezevant / fcm_subscriber_lambda.py
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.
View fcm_subscriber_lambda.py
from __future__ import print_function
import urllib2
import urllib
import json
CONFIG = {
'CLIENT_API_KEY': "",
'SERVER_API_KEY': "",
'DEFAULT_TOPICS': ["all", "some_topic_here"]
}
View maria.go
// https://cybertalents.com/competitions/quals-saudi-oman-national-cyber-security-ctf-2019/maria/
// 🂁 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 (
"fmt"
"math/rand"
"net/http"
@ctrezevant
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
ctrezevant / cloudflare_origin_whitelist.sh
Created Jan 5, 2019
Running a web server behind cloudflare? Run this at startup to apply the freshest firewall rules for their network, automagically :)
View cloudflare_origin_whitelist.sh
# 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 https://www.cloudflare.com/ips-v4`;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 https://www.cloudflare.com/ips-v4`;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 https://www.cloudflare.com/ips-v4`;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
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
/* USAGE:
* 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
ctrezevant / flightspy.sh
Created Nov 20, 2018
Gather interesting telemetry data from your Southwest flight!
View flightspy.sh
#! /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 http://southwestwifi.com/current.json'
You can’t perform that action at this time.