1 |
On 01/20/2012 07:12 PM, Grant wrote: |
2 |
>>> If the machine is running linux, then 'watch "lsof -n|grep TCP|grep |
3 |
>>> 3680"' as root is a sloppy but effective way to find it. There's |
4 |
>>> probably some way to set up a firewall rule on the host in question |
5 |
>>> that logs out the user and (possibly) PID of the connection, but I |
6 |
>>> don't know. |
7 |
>> |
8 |
>> "lsof -i" is easier, it only shows network connections :) |
9 |
>> |
10 |
>> catching it when it happens (if it is very briefly connected) could be |
11 |
>> hard with lsof... Maybe setup a tarpit firewall rule on that box so |
12 |
>> the connection stays open for a long time. |
13 |
> |
14 |
> The connections are only attempted a few times throughout the day. Is |
15 |
> a tarpit firewall rule the only way to do this? Can anyone tell me |
16 |
> what package 'watch' belongs to if that would work? |
17 |
> |
18 |
|
19 |
`watch` isn't going to help too much unless you're looking at it. Append |
20 |
the output to some log file instead. I chose netstat because its output |
21 |
looked easier to parse with a stupid regexp. |
22 |
|
23 |
while true; do |
24 |
netstat -antp | grep ':993 ' >> mystery.log; |
25 |
sleep 1; |
26 |
done; |
27 |
|
28 |
You'll want to change the port -- I tested to make sure that was really |
29 |
logging my Thunderbird connections. |