Skip to content

Instantly share code, notes, and snippets.

@kangtastic
kangtastic / aes.py
Last active December 13, 2021 05:38
An implementation of the Advanced Encryption Standard (AES) block cipher in pure Python 3.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2019 James Seo <james@equiv.tech> (github.com/kangtastic).
# This file is released under the WTFPL, version 2 (wtfpl.net).
#
# aes.py: An implementation of the Advanced Encryption Standard (AES) block
# cipher in pure Python 3.
#
# Description: Zounds! Yet another implementation of AES!
@kangtastic
kangtastic / md4.py
Last active March 28, 2024 09:48
An implementation of the MD4 hash algorithm in pure Python 3.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2019 James Seo <james@equiv.tech> (github.com/kangtastic).
#
# This file is released under the WTFPL, version 2 (wtfpl.net).
#
# md4.py: An implementation of the MD4 hash algorithm in pure Python 3.
#
# Description: Zounds! Yet another rendition of pseudocode from RFC1320!
@kangtastic
kangtastic / sha1.py
Last active March 30, 2019 09:00
An implementation of the SHA-1 hash algorithm in pure Python 3.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2019 James Seo <james@equiv.tech> (github.com/kangtastic).
#
# This file is released under the WTFPL, version 2 (wtfpl.net).
#
# sha1.py: An implementation of the SHA-1 hash algorithm in pure Python 3.
#
# Description: Zounds! Yet another rendition of pseudocode from Wikipedia!
@kangtastic
kangtastic / nornir-iosvulns.py
Last active January 3, 2019 03:07
List Cisco Security Advisories for IOS devices in a Nornir inventory.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2018 James Seo <james@equiv.tech> (github.com/kangtastic).
# Hat tip Eric Tedor (github.com/etedor) for the idea!
#
# This file is released under the WTFPL, version 2 (wtfpl.net).
#
# nornir-iosvulns.py: List Cisco Security Advisories for IOS devices in a
# Nornir inventory.
@kangtastic
kangtastic / dhcp6c_attduid.sh
Last active December 8, 2017 14:20
Print (as a hexstring) the contents of a dhcp6c_duid file for the dhcp6c DHCPv6 client
#!/bin/sh
# File: dhcp6c-attduid.sh
# Description: Script to print (as a hexstring) the contents of a dhcp6c_duid
# file for the dhcp6c DHCPv6 client.
# Intended for use with routers connected to u-Verse Fiber with the
# Residential Gateway bypassed.
# this awk one-liner should be fully portable
printduidhexstring() { echo -n "$*" | awk 'BEGIN{for(n=0;n<256;n++)ord[sprintf("%c",n)]=n}{len=split($0,c,"");printf("%02x00000200000de9",len+6);for(i=1;i<=len;i++)printf("%x",ord[c[i]]);print("")}'; }
echo "Print (as a hexstring) the contents of a dhcp6c_duid file for the dhcp6c DHCPv6 client."
@kangtastic
kangtastic / att6rd.sh
Last active November 1, 2020 20:28
AT&T 6rd script for Linux routers
#!/bin/bash
# Create a 6rd tunnel on a Linux router using AT&T U-Verse Fiber/DSL.
#
# Only creates a tunnel and sets up a default route. IPv6 connectivity for LAN
# clients requires, at minimum, sending Router Advertisements (with radvd/
# dnsmasq) to the LAN interface and enabling IPv6 forwarding in the kernel.
# IPv6 firewalling with ip6tables is also a very good idea.
#
# Hat tip VictorLowther: https://gist.github.com/VictorLowther/2969270
#