Python code for display incoming request from port 80 and port 443

Python code for display incoming request from port HTTPS and port HTTPS

#!/usr/bin/python

import os


try:
    treq443 = os.popen('sudo netstat -anp |grep 443 | wc -l').read()[:-1]
    req80 = os.popen('sudo netstat -anp |grep 80 | wc -l').read()[:-1]
    print("%s %s\r\n" % (treq443, req80))   
except IOError as ex:
    print ("I/O error({0}): {1}",ex)


Leave a Reply