Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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
/**********
* SmartThings Arduino Shield On/Off
* For use on Arduino Mega
* author: github.com/tprynn
* Attach Shield normally with switch on 2/3.
* Jumper pins:
* - 18 (Tx1) to Shield 3 (Rx)
* - 19 (Rx1) to Shield 2 (Tx)
**********/
/**********
* SmartThings Arduino Shield Passthrough
* For use on Arduino Mega
* author: github.com/tprynn
* Attach Shield normally with switch on 2/3.
* Jumper pins:
* - 18 (Tx1) to Shield 3 (Rx)
* - 19 (Rx1) to Shield 2 (Tx)
**********/
/* ISTA 303 Assignment 1
* Tanner Prynn
* communities.pde
* Implements a signal-passing automata based on a random graph.
* Some notes:
* - Nodes are connected according to their relative distances.
* - Communication between nodes in the same community is shown in green,
* communication between different communities is shown in red.
* - Nodes are more likely to communicate within their own communities.
* - Messages spread outward from their origination point.