Skip to content

Instantly share code, notes, and snippets.

Created May 25, 2015 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8bc44d8ba5b4eb069322 to your computer and use it in GitHub Desktop.
Save anonymous/8bc44d8ba5b4eb069322 to your computer and use it in GitHub Desktop.
ipaddress="$(sudo cat /var/log/messages |tail|grep -Po '(peer from calling number\s)\K[^\s]*')"
iplookup="ipinfo.io/$ipaddress"
echo "New PPTP Connection Alert" > /tmp/ppp.log
echo "Source IP:" $(cat /var/log/messages |tail|grep -Po '(peer from calling number\s)\K[^\s]*') >> /tmp/ppp.log
echo "Client IP: $5" >> /tmp/ppp.log
echo "IP lookup info:\n $(curl $iplookup)" >> /tmp/ppp.log
echo "$(date)" >> /tmp/ppp.log
cat /tmp/ppp.log | mail -s "New PPTP VPN Connection" email@address.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment