Skip to content

Instantly share code, notes, and snippets.

View kategray's full-sized avatar

Kate Gray kategray

  • CoreCodec, Inc.
View GitHub Profile
@kategray
kategray / build_universal.sh
Created April 13, 2021 15:21
Build universal (x86_64 + arm64) x264 libraries on an intel x86 Mac
#!/bin/bash
#
# build-universal.sh
#
# Compile a universal x264 binary on OS X (intel).
#
# Requires nasm. Install with homebrew: 'brew install nasm'
#
CONFIGURE_OPTS='--enable-shared --enable-static'
@kategray
kategray / convert.ps1
Last active April 9, 2021 23:44
Convert a cisco PKCS12 (PEM/text format) to a binary P12 for OpenSSL
#
# Opens up keypair.txt and writes to keypair.p12
#
# Skip the first and last lines, and trim any whitespace
$text = (Get-Content keypair.txt | Select-Object -skip 1 | Select-Object -skiplast 1).Trim()
# Convert from Base64 to Bytes
$bytes = [System.Convert]::FromBase64String($text)
@kategray
kategray / .zshrc
Last active April 12, 2024 09:27
M1 dual homebrew (x86_64 and arm64) setup
#
# .zshrc for Mac M1 chips to handle both x86_64 and arm64 homebrew
#
# Be sure to remove .zprofile in order to prevent invalid paths, and
# remove /usr/local/bin from /etc/paths.
#
# Install both arch homebrew versions with:
# arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# arch -arm64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@kategray
kategray / createmrz.php
Created October 13, 2020 11:05
Create a MRZ for ID cards
#!/usr/bin/env php
<?php
// Line 1
$document_number = rand (0, 1000000000); // 9 Digits
$country = 'XXX'; // Unspecified
$document_type = 'I'; // ID Card
$document_subtype = '<'; // Generally 'D', or '<' for ID
$line1_optional = 'COMPANY'; // Optional, 15 chars
@kategray
kategray / pwcheck.php
Created October 5, 2020 03:26
Check a password against pwncheck in PHP.
<?php
#!/usr/bin/env php
$password = 'password';
$hash = sha1($password);
$truncated = substr ($hash, 0, 5); // First 5 characters
$checkValue = substr ($hash, 5); // Rest of the characters
$url = sprintf ('https://api.pwnedpasswords.com/range/%s', $truncated);
echo (sprintf ("Getting hashes from URL %s.\n", $url));
@kategray
kategray / notes.md
Created April 24, 2019 16:30
Interview notes

Tools

Starting script

DOMAIN='codebykate.com'
HOST='codebykate.com'
PROTO='https'
APP_PATH='/'
IP=`dig +short ${HOST}`
@kategray
kategray / fuse.txt
Created April 24, 2019 00:08
NXP J2A040 Fusing
# Information in this script was obtained from public sources, and not under NDA with NXP.
# GPShell style APDU commands, but you should be able to adapt it to anything that can send raw APDU's to the card
# Our TK Key
00A4040010C238E449F725B1510EAA699550CABA16
# Reset card to factory defaults - THIS WILL WIPE OUT ALL APPLETS INSTALLED
00F00000
# Set the Card to use T=1 transmission mode
@kategray
kategray / clean.sh
Created February 14, 2019 09:40 — forked from gwpl/clean.sh
`openssl pkeyutl` how to: -sign -verify -encrypt -decrypt , using openssh keys snippets/examples
rm -v pub.pkcs8 test.sign test.txt.decrypted test.txt.encrypted
@kategray
kategray / dld2ihex.php
Created January 26, 2019 16:37
Convert a Cypress .dld format firmware to an Intel Hex firmware
#!/usr/bin/env php
<?php
/**
* Convert a cypress DLD file to an intel hex file for analysis purposes.
*
* Cypress DLD files start with the string "FF380001020304050607".
*
* You can produce a binary output using something like:
* ./dld2ihex.php [file].dld > [file.ihex]
* objcopy -I ihex [file].ihex -O binary [file].bin
@kategray
kategray / xbee.c
Created September 18, 2018 11:57
XBEE Packet Calculation
#include <stdio.h>
#include <stdint.h>
#define CRC_LOCATION 13
#define DATA_START 3
int main(void) {
// your code goes here
uint8_t packet[] = {0x7E, 0x00, 0x0A, 0x01, 0x01, 0x50, 0x01, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0X00};