Skip to main content

snspoliciestocsv

Description

A simple script to extract policies from a Stormshield Network Security device configuration file to CSV

Options

$ python3 snspoliciestocsv.py -h
Usage: snspoliciestocsv.py [options]
Version: 1.11

Options:
  -h, --help            show this help message and exit

  Main parameters:
    -i INPUT_FILE, --input-file=INPUT_FILE
                        Partial or full Stormshield Network security appliance
                        configuration file. Ex: filter.cfg
    -o OUTPUT_FILE, --output-file=OUTPUT_FILE
                        Output csv file (default ./policies-out.csv)
    -s, --skip-header   Do not print the csv header
    -d DELIMITER, --delimiter=DELIMITER
                        CSV delimiter (default ";")

Examples

exemple.txt

[Filter]
separator color="000000" comment="Allow VPN A to B" collapse="1"
pass inspection firewall log ipproto vpn-esp proto none from A to B	# Créée le 1970-01-01 00:00:01, par Serge (1.2.3.4)
separator color="000000" comment="Block B to C" collapse="1"
block from B to C port ssh	# Prenez un chewing-gum EmileCréée le 1970-01-01 00:00:02, par Odile (1.2.3.5)
block from A to G port ssh	# àloléCréée le 1970-01-01 00:00:02, par Léon (1.2.3.5)

policies-out.csv

type;log;from;to;ipproto;proto;port;comment;creation_date;user;ip_user
Allow VPN A to B;;;;;;;;;;
pass;log;A;B;vpn-esp;none;; ;1970-01-01 00:00:01;Serge;1.2.3.4
Block B to C;;;;;;;;;;
block;;B;C;;;ssh; Prenez un chewing-gum Emile;1970-01-01 00:00:02;Odile;1.2.3.5
block;;A;G;;;ssh; àlolé;1970-01-01 00:00:02;Léon;1.2.3.5

Dependencies and installation

  • Python 3 or superior (sorry but Python 2 is a pain with csv unicode stuff)
  • The easiest way to setup everything: pip install snspoliciestocsv and then directly use $ snspoliciestocsv
  • Or git clone that repository

Changelog

  • version 1.12 - 08/13/2018: Fixing the README layout on PyPI
  • version 1.11 - 07/22/2017: Fixing some utf-8 issues, and adding the log column
  • version 1.0 - 07/14/2017: Initial commit

Disclaimer and license

  • I don't own anything on the Stormshield brand and am not affiliated with organization
  • snspoliciestocsv is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
    • snspoliciestocsv is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    • See the GNU Lesser General Public License for more details: http://www.gnu.org/licenses/

Contact

  • Thomas Debize < tdebize at mail d0t com >

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snspoliciestocsv-1.12.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file snspoliciestocsv-1.12.tar.gz.

File metadata

  • Download URL: snspoliciestocsv-1.12.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.15

File hashes

Hashes for snspoliciestocsv-1.12.tar.gz
Algorithm Hash digest
SHA256 978d57d27e8e20c9028fe2b8fe5e306d4dea5464476949951c6d014c6999b69b
MD5 d5b70222f787cda42fb522423b856c2b
BLAKE2b-256 14385cf32ca87c65c3b5769c2b6143a26f722e8fe846a1640dceb805e3ef4a8e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.12 This release

1 file

1.11

1 file

1.1

1 file

1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page