跳转到主要内容

Netconan网络配置匿名工具

项目描述

Netconan

Netconan(网络配置匿名化工具)用于匿名化包含敏感网络信息的文本文件。

使用Netconan,一个敏感的输入文件

$ cat sensitive/cisco.cfg
! This is intentionet's sensitive comment
username admin password 7 122A001901
enable secret 5 $1$wtHI$0rN7R8PKwC30AsCGA77vy.
!
tacacs-server host 1.2.3.4 key pwd1234
ip address 10.10.20.30/24
ip address 2001:2002::9d3b:1
!
route-map sea-to-lax ...
route-map sea-to-atl ...

可以被匿名化

$ netconan -i sensitive -o anonymized \
    --sensitive-words intentionet,sea,lax,atl \
    --anonymize-passwords \
    --anonymize-ips
WARNING No salt was provided; using randomly generated "WNo5pX28MJOrqxfv"
INFO Anonymizing cisco.cfg

以生成您可以放心分享的输出文件。

$ cat anonymized/cisco.cfg
! This is db1792's sensitive comment
username admin password 7 09424B1D1A0A1913053E012724322D3765
enable secret 5 $1$0000$EhfXcDfB7iiakW6mwMy1i.
!
tacacs-server host 7.227.130.88 key netconanRemoved2
ip address 10.72.218.183/24
ip address cd7e:83e:1eaf:2ada:7535:591e:6d47:a4b8
!
route-map e69ceb-to-880ac2 ...
route-map e69ceb-to-5d37ad ...

安装Netconan

使用pip安装Netconan

$ pip install netconan

功能

Netconan可以匿名化 许多类型的敏感信息

  • 如密码或SNMP社区字符串(--anonymize-passwords-p),许多常用网络供应商。

  • IPv4和IPv6地址(--anonymize-ips-a)。

  • 用户指定的敏感词(--sensitive-words-w)。请注意,无论上下文如何,任何指定的敏感词都会被替换,即使它是更大字符串的一部分。

  • 用户指定的AS号码(--as-numbers-n)。请注意,任何与指定AS号码匹配的数字都将被匿名化。

Netconan试图保留有用的结构。例如,

  • Netconan在匿名化IPv4和IPv6地址时保留前缀:在匿名化之前具有公共前缀的IP地址将在匿名化后共享相同的前缀长度。更多信息,请参阅J. Xu等人,《关于保留前缀的IP流量跟踪匿名化设计与性能》,ACM SIGCOMM网络测量研讨会,2001年[链接]。

  • 默认情况下,IPv4类和私有使用前缀(参见IANA IPv4分配)被保留,但可以覆盖(使用--preserve-prefixes,例如--preserve-prefixes 12.0.0.0/8将保留遇到的IP地址的前导八位12,但匿名化12之后的八位)。

  • 默认情况下,每个IP地址的最后8位被保留。这防止了IP匿名化破坏重要的网络结构,例如点对点IPv4 /30链路或NAT池。这可以被覆盖为新数字B,使用--preserve-host-bits B,并且可以完全禁用,使用--preserve-host-bits 0

  • 可以可选地保留特定地址,例如。

    • --preserve-addresses跳过对指定网络或地址的匿名化。例如,--preserve-addresses 12.0.0.0/8,13.12.11.10将跳过对12.0.0.0/8网络中任何地址的匿名化,并跳过对13.12.11.10的匿名化。

    • --preserve-private-addresses跳过匿名化所有属于私有使用块的地址。

  • 保留AS号码块(即匿名化的公共AS号码在匿名化后仍位于公共AS号码范围内)。

  • 标准密码和哈希格式(盐化md5、思科类型7、Juniper类型9)被识别并用符合格式的替代品替换。

当提供相同的用户可控制盐(--salt-s)时,Netconan是确定性的。使用相同盐处理的文件是兼容的(例如,以相同方式匿名化的IP地址)无论它们是否一起或单独匿名化。建议在配置文件中设置盐,以便每次使用netconan时都能获得兼容的匿名化。

对于可逆操作(特别是IP地址匿名化),Netconan可以生成一个反匿名化文件(--undo-u),前提是提供与匿名化相同的盐(--salt-s)。

运行netconan

Netconan处理输入文件或递归处理输入目录中的文件(跳过以.开头的文件)并将处理后的文件保存到指定的输出。

有关不常用功能的更多信息,请参阅Netconan帮助(-h)。有关配置文件语法的更多信息,请参阅此处

usage: netconan [-h] [--version] [-a] [-c CONFIG] [-d DUMP_IP_MAP] -i INPUT
                [-l {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [-n AS_NUMBERS] -o
                OUTPUT [-p] [-r RESERVED_WORDS] [-s SALT] [-u]
                [-w SENSITIVE_WORDS] [--preserve-prefixes PRESERVE_PREFIXES]
                [--preserve-addresses PRESERVE_ADDRESSES]
                [--preserve-private-addresses]
                [--preserve-host-bits PRESERVE_HOST_BITS]

Args that can start with '--' can also be set in a config file (specified via
-c). If an arg is specified in more than one place, then command line values
override config file values which override defaults. Config file syntax
allows: key=value, flag=true, stuff=[a,b,c] (for more details, see here
https://goo.gl/R74nmi).

optional arguments:
  -h, --help            show this help message and exit
  --version             Print version number and exit
  -a, --anonymize-ips   Anonymize IP addresses
  -c CONFIG, --config CONFIG
                        Netconan configuration file with defaults for these
                        CLI parameters
  -d DUMP_IP_MAP, --dump-ip-map DUMP_IP_MAP
                        Dump IP address anonymization map to specified file
  -i INPUT, --input INPUT
                        Input file or directory containing files to anonymize
  -l {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Determines what level of logs to display
  -n AS_NUMBERS, --as-numbers AS_NUMBERS
                        List of comma separated AS numbers to anonymize
  -o OUTPUT, --output OUTPUT
                        Output file or directory where anonymized files are
                        placed
  -p, --anonymize-passwords
                        Anonymize password and snmp community lines
  -r RESERVED_WORDS, --reserved-words RESERVED_WORDS
                        List of comma separated words that should not be
                        anonymized
  -s SALT, --salt SALT  Salt for IP and sensitive keyword anonymization
  -u, --undo            Undo reversible anonymization (must specify salt)
  -w SENSITIVE_WORDS, --sensitive-words SENSITIVE_WORDS
                        List of comma separated keywords to anonymize
  --preserve-prefixes PRESERVE_PREFIXES
                        List of comma separated IP prefixes to preserve.
                        Specified prefixes are preserved, but the host bits
                        within those prefixes are still anonymized. To
                        preserve prefixes and host bits in specified blocks,
                        use --preserve-addresses instead
  --preserve-addresses PRESERVE_ADDRESSES
                        List of comma separated IP addresses or networks to
                        preserve. Prefixes and host bits within those networks
                        are preserved. To preserve just prefixes and anonymize
                        host bits, use --preserve-prefixes
  --preserve-private-addresses
                        Preserve private-use IP addresses. Prefixes and host
                        bits within the private-use IP networks are preserved.
                        To preserve specific addresses or networks, use
                        --preserve-addresses instead. To preserve just
                        prefixes and anonymize host bits, use --preserve-
                        prefixes
  --preserve-host-bits PRESERVE_HOST_BITS
                        Preserve the trailing bits of IP addresses, aka the
                        host bits of a network. Set this value large enough to
                        represent the largest interface network (e.g., 8 for a
                        /24 or 12 for a /20) or NAT pool.

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

netconan-0.12.3.tar.gz (50.3 kB 查看哈希值)

上传时间 源代码

构建分发

netconan-0.12.3-py2.py3-none-any.whl (50.2 kB 查看哈希值)

上传时间 Python 2 Python 3

由以下组织支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面