add ssh ip geo

This commit is contained in:
xdtianyu 2014-12-23 14:45:53 +08:00
parent 9954d86b6e
commit 5da95034ac
2 changed files with 11 additions and 0 deletions

1
ssh/sshrc Normal file
View File

@ -0,0 +1 @@
/etc/ssh/sshrc.sh &

10
ssh/sshrc.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
read -d " " ip <<< $SSH_CONNECTION
#date=$(date "+%d.%m.%Y %Hh%M")
#reverse=$(dig -x $ip +short)
geo=$(curl -s http://ip.xdty.org -X POST -d "geo=$ip")
if [ -z "$geo" ];then
geo="unknown"
fi
ip="$ip($geo)"
curl -s https://www.xdty.org/mail.php -X POST -d "event=($USER) login from $ip&name=whatever&email=xxxxx@gmail.com" &