So, the batch file would convert a line that looks like this:
Code: Select all
2013.07.23 13:45:08 LOG5[10152:15604]: Service [stunnel-sslh] accepted connection from 71.194.51.232:2078
To look like this:
Code: Select all
07/23/13 - 01:45:08pm: Service [stunnel-sslh] accepted connection from: c-71-194-51-232.hsd1.il.comcast.net:2078 [70.197.3.139:2078]
Before:
2013.07.23 13:45:08 LOG5[10152:15604]: Service [stunnel-sslh] accepted connection from 71.194.51.232:2078
After:
07/23/13 - 01:45:08pm: Service [stunnel-sslh] accepted connection from: c-71-194-51-232.hsd1.il.comcast.net:2078 [70.197.3.139:2078]
Here's a small section of the stunnel log file:
Code: Select all
2013.07.23 10:16:00 LOG5[10152:15136]: Service [stunnel-sslh] connected remote server from 24.12.152.129:58773
2013.07.23 10:16:00 LOG3[10152:15136]: SSL_read: Connection reset by peer (WSAECONNRESET) (10054)
2013.07.23 10:16:00 LOG5[10152:832]: Connection reset: 272 byte(s) sent to SSL, 96 byte(s) sent to socket
2013.07.23 10:17:53 LOG5[10152:4000]: Service [stunnel-sslh] accepted connection from 71.194.51.232:5535
2013.07.23 10:17:53 LOG5[10152:16008]: connect_blocking: connected 24.12.152.129:7777
2013.07.23 10:17:53 LOG5[10152:4000]: Service [stunnel-sslh] connected remote server from 24.12.152.129:58799
2013.07.23 10:17:53 LOG5[10152:13212]: Service [stunnel-sslh] accepted connection from 71.194.51.232:5508
2013.07.23 10:17:53 LOG5[10152:3348]: Service [stunnel-sslh] accepted connection from 71.194.51.232:5509
2013.07.23 10:17:53 LOG5[10152:2884]: Service [stunnel-sslh] accepted connection from 71.194.51.232:5519
Linux script:
Code: Select all
grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' /log/stunnel.log | sort | uniq
| grep -v 127.0.0 | grep -v 192.168. >stout
echo -n "" >stout2
echo -n "" >stout2x
for a in `cat stout` ; do
echo -n $a " ">>stout2;
echo -n "s/"$a"/"$a" " >>stout2x;
host $a | awk '{print $5}' >>stout2;
host $a | awk '{print $5"/g"}' >>stout2x; done sed -f stout2x /log/stunnel.log >stunnelx.log =======