Skip to content

Instantly share code, notes, and snippets.

View CFSworks's full-sized avatar

Sam Edwards CFSworks

  • Boulder, CO
View GitHub Profile
@CFSworks
CFSworks / gist:db19c10f674ea82a1c1ff7314780790a
Created February 1, 2021 23:40
Nintendo LP2P decryption tool
#!/usr/bin/env python3
import re
import argparse
import pathlib
import binascii
from dataclasses import dataclass
from scapy.all import *
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
@CFSworks
CFSworks / decrypt_ccmp.py
Last active January 30, 2021 03:46
Utility script for decrypting CCMP in a pcapng capture
#!/usr/bin/env python3
import argparse
import binascii
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from scapy.all import *
# HEY! Please don't use this for any production/security purpose!
@CFSworks
CFSworks / Makefile
Created January 2, 2019 11:55
LLVM LTO bug
libbug.so: a.o b.o
clang++ -O1 -flto -shared -o $@ $^
%.o: %.cpp common.h
clang++ -O1 -flto -o $@ -c $<
clean:
rm libbug.so a.o b.o
.PHONY: clean
@CFSworks
CFSworks / cg.cxx
Created December 30, 2018 05:42
Panda3D issue #496
// g++ -o cg cg.cxx -I /opt/nvidia-cg-toolkit/include/ /opt/nvidia-cg-toolkit/lib64/libCg.so
#include <Cg/cg.h>
#include <iostream>
#include <fstream>
int main()
{
const char *args = nullptr;
std::ifstream file("shader.txt");
@CFSworks
CFSworks / .clang-format
Created March 15, 2018 04:36
WIP Panda3D clang-format rules
# Indentation
UseTab: Never
IndentWidth: 2
ContinuationIndentWidth: 2
ConstructorInitializerIndentWidth: 2
# Spaces
SpaceAfterTemplateKeyword: false
#SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
@CFSworks
CFSworks / 01-dmesg.txt
Created November 16, 2017 21:15
Damaged Raspberry Pi 3 - output of various commands
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.41-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #1023 SMP Tue Aug 8 16:00:15 BST 2017
[ 0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt:Machine model: Raspberry Pi 3 Model B Rev 1.2
[ 0.000000] cma: Reserved 8 MiB at 0x3ac00000
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] On node 0 totalpages: 242688
[ 0.000000] free_area_init_node: node 0, pgdat 80c6eec0, node_mem_map ba3a1000
#!/usr/bin/env pypy
import numpy as np
if __name__ == '__main__':
while True:
array = np.zeros([3], dtype=int)
np.argwhere(array.sum() == 0)
@CFSworks
CFSworks / gist:51d7b3434875f18ccbcef8d0063066ef
Last active August 31, 2017 19:34
CFSworks's must-have Debian packages
# These are the packages I tend to bring with me onto every Debian system I administer,
# and are therefore the packages I tend to install first thing in a fresh Debian system.
# Obviously, not all of them are necessary for a specific environment, so this list
# serves more as a baseline to pick from than a list of requirements.
# List is sorted in ascending order of "risk" to the system vs. likely usefulness
# (i.e. how likely it is to be abused by an attacker and whether it's more likely to
# help a sysadmin than create a security nightmare)
bzip2
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@CFSworks
CFSworks / vultr_facts.py
Last active August 29, 2015 14:15
Vultr host-information lookup (for use in startup scripts)
#!/usr/bin/env python2
# This script retrieves the information for your current Vultr node and prints Facter facts.
import urllib
import sys
import json
API_KEY = sys.argv[1] # This will crash unless you provide the API key.
def fetch(url):
return urllib.urlopen(url).read()