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` | |
-- |
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" | |
) |
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 = ""; |
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" |
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; |
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 |
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. | |
* |
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' |
NewerOlder