2013-08-29, 10:57
Hi,
Below is a small fix in the network activity detection code:
Below is a small fix in the network activity detection code:
Code:
# detects incoming network activity
def detectNetworkActivity():
import subprocess
output = subprocess.Popen('netstat -ano | grep ESTABLISHED | grep -v "127.0.0.1" | grep -v "off"',
stdout=subprocess.PIPE,
shell=True).communicate()
output = output[0].strip()
if output:
output = output.split("\n")
for line in output:
logging.info('Netstat output: ' + line)
clients_nb = len(output)
else:
clients_nb = 0
logging.info(str(clients_nb) + ' client(s) connected')
return clients_nb > 0