Skip to content

Instantly share code, notes, and snippets.

@tprynn
tprynn / md4.rb
Created August 6, 2014 15:33
Ruby md4 implementation
def md4(string)
# functions
mask = (1 << 32) - 1
f = proc {|x, y, z| x & y | x.^(mask) & z}
g = proc {|x, y, z| x & y | x & z | y & z}
h = proc {|x, y, z| x ^ y ^ z}
r = proc {|v, s| (v << s).&(mask) | (v.&(mask) >> (32 - s))}
# initial hash
a, b, c, d = 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476
@tprynn
tprynn / ssls.md
Last active October 1, 2023 11:49
List of libraries implementing SSL/TLS

List of libraries implementing SSL/TLS

Generic OpenSSL replacement

  • LibreSSL
  • BearSSL

Embedded

  • mbedTLS (PolarSSL)
  • MatrixSSL
@tprynn
tprynn / util.js
Last active February 1, 2022 13:34
Frida utility functions
module.exports = {
hexStringToIntArray: function(str) {
var res = []
for(var i = 0; i < str.length; i += 2) {
res.push(parseInt(str.substring(i, i+2), 16))
}
return res
},
byteArrayToHexString: function(array) {
f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAsARAAAAAAABAAAAAAAAAALgKAAAAAAAAAAAAAEAAOAAIAEAAHAAbAAYAAAAFAAAAQAAAAAAAAABAAEAAAAAAAEAAQAAAAAAAwAEAAAAAAADAAQAAAAAAAAgAAAAAAAAAAwAAAAQAAAAAAgAAAAAAAAACQAAAAAAAAAJAAAAAAAAcAAAAAAAAABwAAAAAAAAAAQAAAAAAAAABAAAABQAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAFwHAAAAAAAAXAcAAAAAAAAAACAAAAAAAAEAAAAGAAAAYAcAAAAAAABgB2AAAAAAAGAHYAAAAAAAKAIAAAAAAAAwAgAAAAAAAAAAIAAAAAAAAgAAAAYAAAB4BwAAAAAAAHgHYAAAAAAAeAdgAAAAAADQAQAAAAAAANABAAAAAAAACAAAAAAAAAAEAAAABAAAABwCAAAAAAAAHAJAAAAAAAAcAkAAAAAAAEQAAAAAAAAARAAAAAAAAAAEAAAAAAAAAFDldGQEAAAAOAYAAAAAAAA4BkAAAAAAADgGQAAAAAAANAAAAAAAAAA0AAAAAAAAAAQAAAAAAAAAUeV0ZAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAvbGliNjQvbGQtbGludXgteDg2LTY0LnNvLjIABAAAABAAAAABAAAAR05VAAAAAAACAAAABgAAACAAAAAEAAAAFAAAAAMAAABHTlUA9Il3qGrQRKItg7lrcUo3xLlmyI4BAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAASAAAAAAAAAAAAAAAAAAAAAAAAACAAAAASAAAAAAAAAAAAAAAAAAAAAAAAADIAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABkAAAASAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAASAAAA
@tprynn
tprynn / linuxprivchecker.py
Last active December 24, 2018 03:11
removed some unnecessarily verbose checks
#!/usr/env python
###############################################################################################################
## [Title]: linuxprivchecker.py -- a Linux Privilege Escalation Check Script
## [Author]: Mike Czumak (T_v3rn1x) -- @SecuritySift
##-------------------------------------------------------------------------------------------------------------
## [Details]:
## This script is intended to be executed locally on a Linux box to enumerate basic system info and
## search for common privilege escalation vectors such as world writable files, misconfigurations, clear-text
## passwords and applicable exploits.
@tprynn
tprynn / flowers.pde
Created November 14, 2013 06:32
A generative art project that spawns a multitude of flowers
void setup() {
size(640, 480);
background(255);
}
void draw() {
base(int(random(width)),int(random(height)));
delay(100*(30/frameCount));
}
@tprynn
tprynn / life.go
Last active December 23, 2015 18:29
CSAW CTF 2013 - Misc 300 Life Solution in Golang -- WildcatSec
// life.go
// This file solves CSAW CTF 2013 - Misc 300
// Challenge was to take an ASCII Game-of-Life, advance by n generations, and return the new game, then repeat
package main
import (
"fmt"
"net"
"regexp"
@tprynn
tprynn / csaw2013recon.md
Last active December 23, 2015 18:19
CSAW CTF 2013 Recon Write-up

CSAW CTF 2013 Recon Write-up -- WildcatSec

Recon 1 - Alexander Taylor

I was totally stuck on this one until we recieved the hint "Bro, do you even PNG?" Immediately we know that the key or a hint will be hidden somewhere in an image. First step for recon is always check the judges page, which usually gives you some lead or info. Download the relevant picture (ataylor.png). Then check exif data:

Tanner:csaw $ exiftool ataylor.png
ExifTool Version Number         : 9.29
File Name                       : ataylor.png
Directory : .
@tprynn
tprynn / curve25519.rb
Created May 25, 2015 17:56
ECDHE + Curve25519 academic implementation in Ruby
# Curve25519+ECDH implementation in Ruby
# Disclaimer: This code is for learning purposes ONLY. It is NOT secure.
# Tanner Prynn
require 'SecureRandom'
require 'digest'
# Fast Modular Exponentiation (base**exp % mod)
def modexp(base, exp, mod)
prod = 1
@tprynn
tprynn / sha1.rb
Created August 6, 2014 15:31
Ruby sha1 implementation
def sha1(string)
# functions and constants
mask = 0xffffffff
s = proc{|n, x| ((x << n) & mask) | (x >> (32 - n))}
f = [
proc {|b, c, d| (b & c) | (b.^(mask) & d)},
proc {|b, c, d| b ^ c ^ d},
proc {|b, c, d| (b & c) | (b & d) | (c & d)},
proc {|b, c, d| b ^ c ^ d},
].freeze