File: nftables.py

package info (click to toggle)
pyroute2 0.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,700 kB
  • sloc: python: 50,245; makefile: 280; javascript: 183; ansic: 81; sh: 44; awk: 17
file content (22 lines) | stat: -rwxr-xr-x 444 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3

from pyroute2.nftables.main import NFTables


# nfgen_family 0 == inet
def show_nftables(family: int = 0) -> None:
    nft = NFTables(nfgen_family=family)
    tables = nft.get_tables()
    chains = nft.get_chains()
    rules = nft.get_rules()

    print("Tables:")
    print(tables)
    print("\nChains:")
    print(chains)
    print("\nRules:")
    for rule in rules:
        print(rule, type(rule))


show_nftables(0)