2.7. Network

The Network instance is accessible via windows.system.network

class windows.winobject.network.Network[source]
property firewall

The firewall of the system

Type:

Firewall

property ipv4

List of TCP IPv4 socket (connection and listening)

Type:

[TCP4Connection]

property ipv6

List of TCP IPv6 socket (connection and listening)

Type:

[TCP6Connection]

2.7.1. Connections

class windows.winobject.network.TCP4Connection[source]

A TCP4 socket (connected or listening)

close()[source]

Close the connection <require elevated process>

property established

True if connection is established else it’s a listening socket

property local_addr

Local address IP (x.x.x.x)

Type:

str

property local_port
Type:

int

property remote_addr

remote address IP (x.x.x.x)

Type:

str

property remote_host

Identification of the remote hostname. Equals remote_addr if the resolution fails

Type:

str or int

property remote_port
Type:

int

property remote_proto

Identification of the protocol associated with the remote port. Equals remote_port if no protocol is associated with it.

Type:

str or int

class windows.winobject.network.TCP6Connection[source]

A TCP6 socket (connected or listening)

property established

True if connection is established else it’s a listening socket

property local_addr

Local address IP

Type:

str

property local_port
Type:

int

property remote_addr

remote address IP

Type:

str

property remote_host

Equals to self.remote_addr for Ipv6

property remote_port
Type:

int

property remote_proto

Equals to self.remote_port for Ipv6

2.7.2. Firewall

class windows.winobject.network.Firewall[source]

The windows firewall

property current_profile_types

Mask of the profiles currently enabled

Type:

long

property enabled

A maping of the active firewall profiles

{

NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_DOMAIN(0x1L): True or False,

NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PRIVATE(0x2L): True or False,

NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PUBLIC(0x4L): True or False,

}

Type:

dict

from_param()

Convert a Python object into a function call parameter.

property rules

The rules of the firewall

Type:

[FirewallRule] – A list of rule

value

current value

class windows.winobject.network.FirewallRule[source]

A rule of the firewall

property action

Action of the rule, values might be:

  • NET_FW_ACTION_.NET_FW_ACTION_BLOCK(0x0L)

  • NET_FW_ACTION_.NET_FW_ACTION_ALLOW(0x1L)

subclass of long

property application_name

Name of the application to which apply the rule

Type:

unicode

property description

Description of the rule

Type:

unicode

property direction

Direction of the rule, values might be:

  • NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN(0x1L)

  • NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_OUT(0x2L)

subclass of long

property enabled

True if rule is enabled

from_param()

Convert a Python object into a function call parameter.

property grouping

Grouping of the rule

Type:

unicode

property interface_types

Types of interface of the rule

Type:

unicode

property local_address

Local address of the rule

Type:

unicode

property local_port

Local port of the rule

Type:

unicode

property name

Name of the rule

Type:

unicode

property protocol

Protocol to which apply the rule

Type:

long

property remote_address

Remote address of the rule

Type:

unicode

property remote_port

Remote port of the rule

Type:

unicode

property service_name

Name of the service to which apply the rule

Type:

unicode

value

current value