Skip to content

Instantly share code, notes, and snippets.

@jps3
Created December 3, 2018 00:09
Show Gist options
  • Save jps3/a2f9945539adf2c0ede27e4a12333087 to your computer and use it in GitHub Desktop.
Save jps3/a2f9945539adf2c0ede27e4a12333087 to your computer and use it in GitHub Desktop.
#!/bin/sh -e
#
# This was tested with Debian Linux 8 and 9
#
# (The arguments for the `last` command will not work with macOS/Darwin)
#
# $ last -adFi
# jps3 pts/0 Sun Dec 2 18:55:37 2018 still logged in 172.16.2.70
# XXXXXX pts/0 Sun Dec 2 17:23:21 2018 - Sun Dec 2 17:25:29 2018 (00:02) 10.10.219.245
# YYYYYY pts/1 Sun Dec 2 13:36:26 2018 - Sun Dec 2 15:49:48 2018 (02:13) 192.168.107.24
#
#
PATH=/bin:/usr/bin
\last -adFi | \
\awk 'BEGIN { printf("begin\nverbose\n") };
{ print $NF };
END { printf("end\n") }' | \
\nc whois.cymru.com 43
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment