Opkg package 'python3-nftables'?

Hi, after below assistance i have an bash script but my scope is growing and i want to migrate to python3 scripting. I need python3-nftables module/sdk. Does it exist? I cant find it...

Ethertype Packet counter needed

You can directly import upstream code:

opkg update && opkg install python3-ctypes
cd /usr/lib/python3.10/
wget https://git.netfilter.org/nftables/plain/py/nftables.py

Test script:

#!/usr/bin/python3

import nftables
import json

nft = nftables.Nftables()
nft.set_json_output(True)
rc, output, error = nft.cmd("list ruleset")
print(json.loads(output))
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.