Skip to content

Instantly share code, notes, and snippets.

View Eeko's full-sized avatar

Eetu Korhonen Eeko

  • Stockholm
View GitHub Profile
@Eeko
Eeko / inis-times-poller.sh
Created March 4, 2020 16:04
Small bash-script for monitoring the status of free times for Dublin Immigration Registration appointment system. Fetches the CSRF-tokens from the form and uses it to query for free times every 30 seconds from the page. Requires restart every once in a while since the CSRF-tokens do expire for the site.
#!/bin/bash
SITECONTENT=$(curl https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/AppSelect?OpenForm)
K=$(echo $SITECONTENT|egrep -o '<input id="k" type="hidden" value="\w+"'|cut -c36-67)
P=$(echo $SITECONTENT|egrep -o '<input id="p" type="hidden" value="\w+"'|cut -c36-67)
echo "P=$P K=$K"
#watch -n10 "curl 'https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/(getApps4DTAvailability)?readform&&cat=All&sbcat=All&typ=Renewal&k=$K&p=$P' -H 'Connection: keep-alive' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Sec-Fetch-Dest: empty' -H 'X-Requested-With: XMLHttpRequest' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-Mode: cors' -H 'Referer: https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/AppSelect?OpenForm' --compressed"
watch -n30 "curl 'https://burghquayregistrationoffice.ini
@Eeko
Eeko / cyberindex.sh
Last active August 29, 2015 13:57
Calculates the scientific cyberindex of a document
#!/bin/bash
IFS=$'\n'
if [ -z "$1" ]; then
echo "Usage: ./cyberindex.sh <filename>";
else
INDEX=$(bc -l <<< "scale=5;$(grep -c -i 'cyber' $1)/$(wc -l < $1)");
echo "Cyberindex of '$1': $INDEX";
fi
unset IFS
@Eeko
Eeko / threaded socket server process
Created September 4, 2013 14:03
A mock socket server for simulating vulnerabilities for remote exploits
#!/usr/bin/python -u
# -*- coding: utf-8 -*-
# A multi-threadable server program to provide mock-answers to socket queries.
# Usable for simulating server processes for various remote exploits
# by Eeko, 2013
# inspired by http://stackoverflow.com/questions/15486064/simple-tcp-server-in-python
import socket
import SocketServer
import time
import threading