Skip to content

Instantly share code, notes, and snippets.

View tylerkerr's full-sized avatar

Tyler Kerr tylerkerr

View GitHub Profile
#!/bin/bash
for (( i = 3; i < 48; i++ ))
do
echo "set interfaces ge-6/0/$i unit 0 family ethernet-switching port-mode access vlan members security"
done
@tylerkerr
tylerkerr / setgen.py
Created April 25, 2016 23:29
programmatic Junos set command generation, to eliminate tedious/manual repetitive policy creation
#!/usr/bin/env python3
basecommand = input('Enter base command, with "%" in place of iterables: ')
start = int(input('Enter range start (inclusive): '))
end = int(input('Enter range end (inclusive): '))
print("\n")
for i in range(start,end+1):
print(basecommand.replace("%", str(i)))
# print("\n%s" % basecommand)
print("\n")
#!/usr/bin/env python3
# toy diffie-hellman key exchange.
from random import SystemRandom
p = 0x00964738809dbecd4bcb9ba1d18de0f5a6fbd595383c2dbe460f8dfd6dea62d2a6bca4016806c788e89872e888137d767030c72a17ac7d6cc33e5b44a9c17ad32412656ac0770829412b502dc6010545cc26043b55bbccf7946de94c0a4c1c0386a255d9101a235e0427aefb003cc7a6e64c0860349fc6e220fc7fef110a60ad727e6af317cefbeab4216e0f76dadb816cfdf2cd90549340dc7eef977a7c3133f854088b0390a4d55d6244bc2f8f532401f6d224379b475fd1e30e4de0e52fba9273b742773dcea2c427804d3273d2f2cbcfb4d5deeb80c05282563a37777cabb4c0de696f41f622f6e59b613925ba6ec21b5b380d42f36aa6997fb6f4efcc5b4b
print("safe prime p = %s" % format(p, 'x')) # p is a 2048 bit safe prime - "safe" meaning (p-1)/2 is also prime
g = 2
print("generator g = %s" % g) # 2 is a generator of the group of order p

Keybase proof

I hereby claim:

  • I am tylerkerr on github.
  • I am tylerkerr (https://keybase.io/tylerkerr) on keybase.
  • I have a public key ASA1FQLyswHkoAnq098XiyRZi1e7nIFKxxPIfDNwv4tqOAo

To claim this, I am signing this object:

#!/usr/bin/env python3
"""
converts a power of ten to a power of two (or the reverse)
e.g. given x, 10^x = 2^y, solves for y
to convert 10^39 to a power of two: tentotwo.py 39
to convert 2^128 to a power of ten: tentotwo.py -r 128
https://tylerkerr.ca/b/2015/12/converting-powers-of-ten-to-powers-of-two
"""
import sys
#!/usr/bin/env python3
import sys, re
from operator import itemgetter
"""
takes a hex string that is potentially 'encrypted' via single-byte xor
(each hex byte has been xor'd with the same byte),
creates an output for each potential key (256 total),
#!/usr/bin/env python3
"""
http://www.spoj.com/problems/PRIME1/
output all primes between given pairs of numbers
"""
import sys
lines = sys.stdin.read().splitlines()
[tkerr@ec2a fastcoll]$
[tkerr@ec2a fastcoll]$ echo "This is the message to collide" >> message.txt
[tkerr@ec2a fastcoll]$ ./fastcoll message.txt
MD5 collision generator v1.5
by Marc Stevens (http://www.win.tue.nl/hashclash/)
Using output filenames: 'message_msg1.txt' and 'message_msg2.txt'
Using prefixfile: 'message.txt'
Using initial value: c0c167e78fdebddf3d63175436541834
#!/usr/bin/env python
import sys, os
from passlib.hash import bcrypt
f = open('commonpasswords.txt', 'r')
pws = f.readlines()
f.close()
f = open('dbmini.txt', 'r')
users = [{ 'name' : uline[1], 'hash': uline[2]} for uline in [line.rstrip('\n').split('\t', 2) for line in f.readlines()]]
#!/usr/bin/env python
import sys, os
from passlib.hash import bcrypt
user = list()
usalt = list()
uhash = list()
pwhash = list()
pos = 0