Skip to content

Instantly share code, notes, and snippets.

@pyllyukko
pyllyukko / keybase.md
Created May 3, 2014 09:26
keybase.md

Keybase proof

I hereby claim:

  • I am pyllyukko on github.
  • I am pyllyukko (https://keybase.io/pyllyukko) on keybase.
  • I have a public key whose fingerprint is B284 21D6 03DE 0A1D 17AE 4415 78C2 DF2D 1A17 0CC6

To claim this, I am signing this object:

@pyllyukko
pyllyukko / rc4.sh
Created May 16, 2015 11:04
RC4 stream cipher algorithm written in Bash
#!/bin/bash
################################################################################
# file: rc4.sh
# created: 15-05-2011
# modified: 2014 Sep 04
#
# https://secure.wikimedia.org/wikipedia/en/wiki/RC4
#
# NOTES:
# - ord() & chr() from http://mywiki.wooledge.org/BashFAQ/071
@pyllyukko
pyllyukko / format_string_calculator.sh
Last active September 26, 2015 10:31
Format string calculator
#!/bin/bash
# simple format string exploit calculator for wargames etc.
declare -a values=()
declare -i dpa=6
function calculate_fmt() {
local result
if [ ${1} -le ${2} ]
@pyllyukko
pyllyukko / hetu.sh
Created September 30, 2015 12:31
Finnish personal identity code calculator/generator
#!/bin/bash
################################################################################
# hetu.sh - finnish personal identity code calculator/generator
#
# by pyllyukko - https://github.com/pyllyukko
#
# more info:
# https://secure.wikimedia.org/wikipedia/en/wiki/National_identification_number#Finland
#
################################################################################
@pyllyukko
pyllyukko / dnssec_root_keys.sh
Last active March 5, 2025 14:31
DNSSEC root keys fetcher
#!/bin/bash
# dnssec_root_keys.sh
#
# mostly copied from https://calomel.org/dns_bind.html, but with different verification and trusted-keys (vs. managed-keys)
export PATH="/usr/sbin:/sbin:/usr/bin:/bin"
for PROGRAM in \
dnssec-dsfromkey \
gpgsm \
@pyllyukko
pyllyukko / hetu.c
Last active June 27, 2020 19:03
hetu.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define C "0123456789ABCDEFHJKLMNPRSTUVWXY"
#define X(y, z) y*10+z-48-y
#define Y(z) (!(z%4)&&(z%100)||!(z%400))
@pyllyukko
pyllyukko / bits.awk
Last active May 13, 2022 23:19
bits.awk
#!/usr/bin/gawk -f
# https://www.gnu.org/software/gawk/manual/gawk.html#Nondecimal_002dnumbers
#
# https://www.gnu.org/software/gawk/manual/gawk.html#Ordinal-Functions
#
# TODO:
# - truncate static bytes
# - padding
@pyllyukko
pyllyukko / ftp.sh
Created April 7, 2016 18:42
FTP client written in Bash
#!/bin/sh
################################################################################
# ftp.sh 0.2.1 -- pyllyukko #
# #
# - needs a few hundred more error checks=) #
# - works nicely as a poc though #
# - uses only 2 external programs, #
# cat for downloading and bc for unit conversion (e.g. B->KiB), #
# which is unnecessary anyway=) #
# #
@pyllyukko
pyllyukko / check_gpg_key.sh
Last active May 13, 2022 23:19
Check PGP key expiration
#!/bin/bash
################################################################################
# check PGP secret key(s) expiration
#
# created: 17-06-2014
################################################################################
if [ ${BASH_VERSINFO[0]} -ne 4 ]
then
echo -e "error: bash version != 4, this script might not work properly!" 1>&2
echo " you can bypass this check by commenting out lines $[${LINENO}-2]-$[${LINENO}+2]." 1>&2
@pyllyukko
pyllyukko / twortune.rb
Created December 6, 2016 10:28
Print random tweet from Tweet archive
#!/usr/bin/ruby
# Print random tweet from Tweet archive
require "csv"
tweets = CSV.read('/home/pyllyukko/Documents/twitter-20161205/tweets.csv')
i = rand(1..tweets.count-1)
puts tweets[i][5]