Python: how to get list of listen sockets in Linux

Here is an example of Python code to get listen socket from Python: def listen_sockets(): listens = [] lines = open(“/proc/net/tcp”).readlines() for l in lines: ls = l.split() if ls[3] == ‘0A’: lp = ls[1].split(‘:’) ip = str(lp[0]) pair = “%s.%s.%s.%s:%s” %( int(ip[6:8], 16), int(ip[4:6], 16), int(ip[2:4], 16), int(ip[0:2], 16), int(lp[1], 16)) listens.append(str(pair)) return listenslistens…

How to block huge amount of IP addresses with use of ipset in Fedora 14

Sometime you need to block really big numbers of IP addresses. It could be for different reasons. For example, in case of password bruteforce, DDoS attack. Of course, you can block them just in iptables. But there can be a problem. If set of IP addresses contain thousands of items iptables performance decreases (actually, performance…

Supportex is IPv6 ready!

Our company has been successfully certified by IPv6. At the moment the number of IPv4 addresses diminishes. Next generation IPv6 is designated to replace IPv4 and obviate lot of the shortcomings. The main drawback of IPv4 is the lack IP’s addresses for all new users. Migration to IPv6 will solve the problem of addresses lack…