Skip to content

Instantly share code, notes, and snippets.

View elecnix's full-sized avatar

Nicolas Marchildon elecnix

View GitHub Profile
require 'rubygems'
require 'mechanize'
postal_codes = File.open("postal_codes.txt").read.split("\n")
# randomize to make the pattern slightly harder to see in logs
postal_codes = postal_codes.sort_by {|e| rand(10_000)}
@agent = WWW::Mechanize.new do |a|
a.user_agent_alias = 'Mac Safari'
a.max_history = 1
#!/bin/sh
cd /usr/share/meld/meld/
echo "Patching files in $(pwd)"
sed '
s/\(color_delete_bg"[^"]*\)"[^"]*"/\1"#003300"/
s/\(color_replace_bg"[^"]*\)"[^"]*"/\1"#112233"/
s/\(color_replace_fg"[^"]*\)"[^"]*"/\1"gray80"/
s/\(color_conflict_fg"[^"]*\)"[^"]*"/\1"White"/
cat top-1m.csv | sed -e 's_.*,\(.*\)_echo | openssl s\_client -connect \1:443 > certs/\1.pem\&_' > certs.sh
bash certs.sh
ls certs | xargs -L1 -I DOMAIN echo 'openssl x509 -in certs/DOMAIN -text -noout > checks/DOMAIN.check' > checks.sh
bash checks.sh
cat top-1m.csv | sed -e 's#.*,\(.*\)#\1#'| xargs -n1 -P20 -I DOM grep -H 'Not After' checks/DOM.pem.check 2>/dev/null | cut -d ':' -f 1,3-|sed -e 's_checks/\(.*\).pem.check: \(.*\)_\1,\2_' > top-1m-expiry.csv