Skip to content

Instantly share code, notes, and snippets.

View chtzvt's full-sized avatar
🌻
‍To create a little flower is the labor of ages.

Charlton Trezevant chtzvt

🌻
‍To create a little flower is the labor of ages.
View GitHub Profile
@chtzvt
chtzvt / grandstream_ddns.sh
Created November 1, 2021 15:57
GrandStream HT801/HT802 dynamic DNS autoupdater.
#!/bin/bash
EMAIL="you@example.com"
GS_HOSTNAME="your-grandstream-hostname"
STATUS_FILE='/tmp/.voip_ip_stat'
touch $STATUS_FILE
timeout 3 bash -c "printf '@' | telnet -e \@ $GS_HOSTNAME 22" 2>&1 >/dev/null
host_alive=$?
@chtzvt
chtzvt / pkiaudit.sh
Created November 1, 2021 15:53
Simple Bash-based HTTPS cert expiration checker to monitor things and send me emails.
#!/usr/bin/env bash
THRESH_DAYS="7"
EMAIL=""
rm -f /home/jobs/scripts/pkiaudit.tmp
/etc/nopehq-configs/pki/tools/valid_audit.sh -s -t $THRESH_DAYS -i /etc/nopehq-configs/pki/tools/audit.ignore -d /etc/nopehq-configs/dns/nopeHQ-lan.hosts >/home/jobs/scripts/pkiaudit.tmp
NUM_WARNS=$(cat /home/jobs/scripts/pkiaudit.tmp | wc -l)
@chtzvt
chtzvt / b2_sync.sh
Created November 1, 2021 15:50
Rate-limited backup to BackBlaze B2 with IPTables
#!/bin/bash
# You can adjust the maximum throuhput limits (in mbits) here
BW_MAX_RATE=500mbit
BW_BURST_RATE=560mbit
IFACE=ens3
# Local/remote paths
B2_SOURCE_PATH="/local/path/to/backupdir"
B2_DEST_BUCKET="b2://your-bucket-name"
import base64
import hashlib
class CardHasher():
def __init__(self, **kwargs):
if 'alg' in kwargs:
self.hasher = kwargs['alg']
else:
self.hasher = hashlib.sha256
# 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`
--
@chtzvt
chtzvt / birthdays_are_pii.go
Created June 1, 2019 04:54
How to shut down an entire birthdaybot.io installation for the good of mankind
// 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"
)
@chtzvt
chtzvt / pass.js
Last active April 21, 2019 18:44
Absurdly ridiculous quick n dirty random password sheet generator
// 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 = "";
@chtzvt
chtzvt / fcm_subscriber_lambda.py
Created April 11, 2019 16:30
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
CONFIG = {
'CLIENT_API_KEY': "",
'SERVER_API_KEY': "",
'DEFAULT_TOPICS': ["all", "some_topic_here"]
}
// 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"
@chtzvt
chtzvt / slido_hax.py
Created January 27, 2019 19:45
l m a o
from __future__ import print_function
import requests
import os, time
def get_token():
url = 'https://app2.sli.do/api/v0.5/events/5a4dcc05-4c5c-41be-9ce1-0dd1c4dc77c4/auth'
headers = {
'origin': 'https://app2.sli.do',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-US,en;q=0.9',