# 2.7. Network

The `Network` instance is accessible via `windows.system.network`

Note

See sample Network - socket exploration

class `windows.winobject.network.``Network`
  `firewall`

    The firewall of the system

    Type: | `Firewall`

  `ipv4`

    List of TCP IPv4 socket (connection and listening)

    Type: | [`TCP4Connection`]

  `ipv6`

    List of TCP IPv6 socket (connection and listening)

    Type: | [`TCP6Connection`]

## 2.7.1. Connections

class `windows.winobject.network.``TCP4Connection`

  A TCP4 socket (connected or listening)

  `close`()

    Close the connection <require elevated process>

  `established`

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

  `local_addr`

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

    Type: | `str`

  `local_port`

    Type: | `int`

  `remote_addr`

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

    Type: | `str`

  `remote_host`

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

    Type: | `str` or `int`

  `remote_port`

    Type: | `int`

  `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`

  A TCP6 socket (connected or listening)

  `established`

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

  `local_addr`

    Local address IP

    Type: | `str`

  `local_port`

    Type: | `int`

  `remote_addr`

    remote address IP

    Type: | `str`

  `remote_host`

    Equals to `self.remote_addr` for Ipv6

  `remote_port`

    Type: | `int`

  `remote_proto`

    Equals to `self.remote_port` for Ipv6

## 2.7.2. Firewall

class `windows.winobject.network.``Firewall`

  The windows firewall

  `current_profile_types`

    Mask of the profiles currently enabled

    Type: | `long`

  `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`

  `rules`

    The rules of the firewall

    Type: | [`FirewallRule`] – A list of rule

  `value`

    current value

class `windows.winobject.network.``FirewallRule`

  A rule of the firewall

  `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`

  `application_name`

    Name of the application to which apply the rule

    Type: | `unicode`

  `description`

    Description of the rule

    Type: | `unicode`

  `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`

  `enabled`

    `True` if rule is enabled

  `grouping`

    Grouping of the rule

    Type: | `unicode`

  `interface_types`

    Types of interface of the rule

    Type: | `unicode`

  `local_address`

    Local address of the rule

    Type: | `unicode`

  `local_port`

    Local port of the rule

    Type: | `unicode`

  `name`

    Name of the rule

    Type: | `unicode`

  `protocol`

    Protocol to which apply the rule

    Type: | `long`

  `remote_address`

    Remote address of the rule

    Type: | `unicode`

  `remote_port`

    Remote port of the rule

    Type: | `unicode`

  `service_name`

    Name of the service to which apply the rule

    Type: | `unicode`

  `value`

    current value