Package udpconn Documentation
Class Conn
this class provide a quick interface to read /proc/net/tcp and give the informations about the current connexion to host
https://www.kernel.org/doc/Documentation/networking/proc_net_tcp.txt
/proc/net/tcp <<-- Example -->>
sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
0: 0100007F:0035 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 32059 1 0000000000000000 100 0 0 10 0
1: 00000000:0016 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 44971 1 0000000000000000 100 0 0 10 0
2: 0100007F:0277 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 24125 1 0000000000000000 100 0 0 10 0
3: 0100007F:6989 00000000:0000 0A 00000000:00000000 00:00000000 00000000 122 0 26080 1 0000000000000000 100 0 0 10 0
4: 00000000:14EB 00000000:0000 0A 00000000:00000000 00:00000000 00000000 102 0 25337 1 0000000000000000 100 0 0 10 0
5: 2401A8C0:AC56 2401A8C0:0016 01 00000000:00000000 02:0007DDFA 00000000 1000 0 59815 3 0000000000000000 20 4 30 10 -1
6: 2401A8C0:0016 2401A8C0:AC56 01 00000000:00000000 02:0007DDFA 00000000 0 0 61538 4 0000000000000000 20 4 31 10 17
7: 2401A8C0:E71E CEC93AD8:01BB 01 00000000:00000000 00:00000000 00000000 1000 0 69532 1 0000000000000000 39 4 30 10 -1
8: 2401A8C0:E360 8A13D9AC:01BB 01 00000000:00000000 00:00000000 00000000 1000 0 72008 1 0000000000000000 158 4 30 10 -1
__init__
def __init__(self, procfilename, protocole)
initialization method that inherit IfaceInfoTools class
conn
def conn(self)
(alias) same is connexion(self)
conn_by_status
def conn_by_status(self, connstatus)
get {tcp, udp} connexion with last_ack '09' {tcp, udp} status
connexion
def connexion(self)
return a list of all {tcp, udp} connexion
get_close_conn
def get_close_conn(self)
get {tcp, udp} connexion with close '07' {tcp, udp} status
get_close_wait_conn
def get_close_wait_conn(self)
get_closing_conn
def get_closing_conn(self)
get {tcp, udp} connexion with closing '0B' {tcp, udp} status
get_established_conn
def get_established_conn(self)
get {tcp, udp} connexion with established '01' {tcp, udp} status
get_fin_wait1_conn
def get_fin_wait1_conn(self)
get {tcp, udp} connexion with fin_wait1 '04' {tcp, udp} status
get_fin_wait2_conn
def get_fin_wait2_conn(self)
get {tcp, udp} connexion with fin_wait2 '05' {tcp, udp} status
get_last_ack_conn
def get_last_ack_conn(self)
get {tcp, udp} connexion with last_ack '09' {tcp, udp} status
get_listen_conn
def get_listen_conn(self)
get {tcp, udp} connexion with listen '0A' {tcp, udp} status
get_max_state_conn
def get_max_state_conn(self)
get {tcp, udp} connexion with max_state '0C' {tcp, udp} status
get_syn_recv_conn
def get_syn_recv_conn(self)
get {tcp, udp} connexion with recv '03' {tcp, udp} status
get_syn_sent_conn
def get_syn_sent_conn(self)
get {tcp, udp} connexion with syn_sent '02' {tcp, udp} status
get_time_wait_conn
def get_time_wait_conn(self)
get {tcp, udp} connexion with time_wait '06' {tcp, udp} status
hex2ip
def hex2ip(self, x_addr)
private methode convert hexadecimal representation to string decimal ip address return string (as ip address representation)
ip2hex
def ip2hex(self, addr)
private methode convert string decimal ip address to hexadecimal representation return string (as hex representation)
ip_address
def ip_address(self, ifacename)
private methode get ip address of interface using socket interface
local_addrs
def local_addrs(self)
get dict of local address and ports list { 'local_host_ip': [list of ports] }
local_ports
def local_ports(self)
get list of ports used by local host [listen, established, ...]
network_address
def network_address(self, ipaddr, mask)
private methode used to calculate the network address
network_mask
def network_mask(self, ifacename)
private methode get net mask address of interface using socket interface
read_file_as_table
def read_file_as_table(self, filename)
private method that read given file completly and return it as list of lines
remote_addrs
def remote_addrs(self)
get dict of remote address and ports list { 'remote_host_ip': [list of ports], }
remote_ports
def remote_ports(self)
get list of ports used by remote host
reverse_ip
def reverse_ip(self, ipaddress)
Private method that reverse ip address
Class UDPConn
None
__init__
def __init__(self)
conn
def conn(self)
(alias) same is connexion(self)
conn_by_status
def conn_by_status(self, connstatus)
get {tcp, udp} connexion with last_ack '09' {tcp, udp} status
connexion
def connexion(self)
return a list of all {tcp, udp} connexion
get_close_conn
def get_close_conn(self)
get {tcp, udp} connexion with close '07' {tcp, udp} status
get_close_wait_conn
def get_close_wait_conn(self)
get_closing_conn
def get_closing_conn(self)
get {tcp, udp} connexion with closing '0B' {tcp, udp} status
get_established_conn
def get_established_conn(self)
get {tcp, udp} connexion with established '01' {tcp, udp} status
get_fin_wait1_conn
def get_fin_wait1_conn(self)
get {tcp, udp} connexion with fin_wait1 '04' {tcp, udp} status
get_fin_wait2_conn
def get_fin_wait2_conn(self)
get {tcp, udp} connexion with fin_wait2 '05' {tcp, udp} status
get_last_ack_conn
def get_last_ack_conn(self)
get {tcp, udp} connexion with last_ack '09' {tcp, udp} status
get_listen_conn
def get_listen_conn(self)
get {tcp, udp} connexion with listen '0A' {tcp, udp} status
get_max_state_conn
def get_max_state_conn(self)
get {tcp, udp} connexion with max_state '0C' {tcp, udp} status
get_syn_recv_conn
def get_syn_recv_conn(self)
get {tcp, udp} connexion with recv '03' {tcp, udp} status
get_syn_sent_conn
def get_syn_sent_conn(self)
get {tcp, udp} connexion with syn_sent '02' {tcp, udp} status
get_time_wait_conn
def get_time_wait_conn(self)
get {tcp, udp} connexion with time_wait '06' {tcp, udp} status
hex2ip
def hex2ip(self, x_addr)
private methode convert hexadecimal representation to string decimal ip address return string (as ip address representation)
ip2hex
def ip2hex(self, addr)
private methode convert string decimal ip address to hexadecimal representation return string (as hex representation)
ip_address
def ip_address(self, ifacename)
private methode get ip address of interface using socket interface
local_addrs
def local_addrs(self)
get dict of local address and ports list { 'local_host_ip': [list of ports] }
local_ports
def local_ports(self)
get list of ports used by local host [listen, established, ...]
network_address
def network_address(self, ipaddr, mask)
private methode used to calculate the network address
network_mask
def network_mask(self, ifacename)
private methode get net mask address of interface using socket interface
read_file_as_table
def read_file_as_table(self, filename)
private method that read given file completly and return it as list of lines
refresh
def refresh(self)
this function refresh the informations collected when the class is loaded if you want to work with fresh data use this function to reload the data updated
reload
def reload(self)
same as self.refresh()
remote_addrs
def remote_addrs(self)
get dict of remote address and ports list { 'remote_host_ip': [list of ports], }
remote_ports
def remote_ports(self)
get list of ports used by remote host
reverse_ip
def reverse_ip(self, ipaddress)
Private method that reverse ip address