Skip to main content

Python Snippets

Useful Python3 snippets as I come across them.

 

 

Using xmltodict on the command line with ipset

Use ipset to dump a set list via xml, then convert that to json.

ipset list observed-unathorized -output xml | python3 -c 'import xmltodict, sys, json; json.dump(xmltodict.parse(sys.stdin.read(), process_namespaces=True), sys.stdout, indent=4);'

 

#end