netconan网络配置匿名实用程序

netconan的Python项目详细描述


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地址(^{TT4}$,^{TT5}$)。
  • 用户指定的敏感词(--sensitive-words-w)。请注意,无论上下文如何,指定敏感词的任何出现都将被替换,即使它是较大字符串的一部分。
  • 用户指定为数字(--as-numbers-n)。请注意,与指定为数字匹配的任何数字都将被匿名化。

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

  • netconan在匿名化ipv4和ipv6地址时保留前缀:匿名化前具有公共前缀的ip地址在匿名化后将共享相同的前缀长度。有关更多信息,请参见J.Xu等人,^{EM1}$关于保留前缀的IP流量跟踪匿名化的设计和性能,ACM SIGCOMM Internet测量研讨会,2001年[link]。
  • 默认情况下,IPv4类和专用前缀(请参阅IANA IPv4 assignments)会被保留,但可以被重写(使用--preserve-prefixes例如--preserve-prefixes 12.0.0.0/8将保留遇到的IP地址的前导八位字节12,但在12之后匿名化八位字节)。
  • 保留数字块(即,匿名化的public as number在匿名化后仍将在public as number范围内)。
  • 标准密码和散列格式(salted md5、cisco type 7、juniper type 9)被识别并替换为符合格式的替换。

当提供相同的用户可控盐(--salt-s)时,netconan是确定性的。无论是一起匿名还是单独匿名,使用相同salt处理的文件都是兼容的(例如,以相同方式匿名的ip地址)。

对于可逆操作(具体地说,IP地址匿名化),当提供用于匿名化的相同盐(--salt-s)时,NetConan可以生成非匿名化文件(--undo-u)。

运行netconan

netconan处理input文件或递归处理input目录中的文件(跳过以.开头的文件),并将处理过的文件保存在指定的output

有关不常用功能的更多信息,请参阅netconan帮助(-h)。有关配置文件语法的详细信息,请参见here

usage: netconan [-h][-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]

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, thencommand 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
  -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 IPv4 prefixes to preserve

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java异常无法从资源中找到可绘制的图标   Android 6.0.0上应用程序崩溃后java Android VM重新启动   当我将java项目导出到runnable jar中时,log4j不会记录日志   java在Jtable netbeans中显示MS访问数据   为什么不呢。Java中的NETstyle委托而不是闭包?   java如何正确使用如此多的CPU停止命令队列循环?   java使用==   java如何将scriptlet转换为JSTL?   java mvn测试失败,但通过IntelliJ IDEA运行测试   java为什么文件在使用另一个按钮后不会被删除   java JDBC MySQL不读取最新插入   java如何在安卓中绘制从Firebase数据库检索到的数据   java HTML解析getElementByClass方法   java Arraylist hashmap 安卓