Skip to content

Instantly share code, notes, and snippets.

@etcwilde
etcwilde / failed.sh
Last active January 27, 2017 00:11
Fun Shell Scripts
#!/bin/sh
# Who is trying to access your server without permission?
sudo journalctl -u sshd \
| awk '/Failed password for/ {print $11}' \
| while read address; do whois "$address" \
| grep -m 1 -i "Country: " \
| sed "s/[Cc]ountry:/$address/"; done \
| awk '{print $2 " --> " $1}' \
| uniq -c \
@etcwilde
etcwilde / ght-restore-psql
Last active September 3, 2019 19:26
Restore the GHTorrent database to postgres instead of mysql (based on mysql-2017-01-19 image)
#!/usr/bin/env bash
# Evan Wilde <[email protected]>
# July 20, 2017
# defaults
user="postgres"
passwd=""
host="localhost"
db="ghtorrent"
tmpdir='/tmp'