0
watch netstat -n -A inet             + notify-send "Attention new  connection"

or

watch  cat /proc/net/ip_conntrack    + notify-send "Attention new  connection"

or

watch ss -n                          + notify-send "Attention new  connection"

Do you have any idea how to connect this halves and thank you.

2
  • Wait a minute... you want a notification each time a socket is opened?
    – Braiam
    Dec 12, 2013 at 23:41
  • Which desktop manager are you using? as with some you can set a notification anyway.
    – Wilf
    Dec 12, 2013 at 23:43

1 Answer 1

0

What you need is a short bash script, like:

#!/bin/sh
while [ 1 ]
do
  if [ "PARAMETER" = "SOMETHING" ]; then
     notify-send "Attention" "There is a new connection."
  else
     echo "Nothing Found"
  fi
  sleep 5
done

Basically, this would listen for a PARAMETER (How, I don't know...), and when it equals SOMETHING, then it will send a notification. If the PARAMETER is not equal to SOMETHING, it will print Nothing Found (This is not necessary, it just shows that it is working), wait for 5 seconds, and start again.

The problem is getting it find when it has connected... None of these...

  • netstat -n -A inet
  • cat /proc/net/ip_conntrack - apparently deprecated anyway, see here
  • ss -n

...seem to produce the parameters required...


Any corrections welcome, especially with the bash script

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .