IP邻居表监视脚本

MindYourNeighbors的Python项目详细描述


#关心你的邻居

根据您的直接邻居启动脚本

[![生成状态](https://travis-ci.org/jaesivsm/MindYourNeighbors.svg?branch=master)](https://travis-ci.org/jaesivsm/MindYourNeighbors)[![覆盖状态](https://coveralls.io/repos/github/jaesivsm/MindYourNeighbors/badge.svg?branch=master)](https://coveralls.io/github/jaesivsm/MindYourNeighbors?branch=master)[![代码气候](https://codeclimate.com/github/jaesivsm/MindYourNeighbors/badges/gpa.svg)](https://codeclimate.com/github/jaesivsm/MindYourNeighbors

##怎么做?

mindYourNeighbors基本上解析IP邻居,如果发现配置未排除的结果,将启动一次已配置的命令。

##为什么?

原始用例:

用作路由器和家庭服务器的Linux盒。在这个盒子上运行着一些软件,这些软件可以很好地与消费(即:传输)结合在一起。 我想在其他用户使用网络时关闭这个软件。

##功能

mindYourNeighbors的行为可以通过配置文件进行控制,配置文件可以放在~/.config/mind\u your\neighborrds.cfg/etc/mind\u your\neighborrds.cfg中。

配置文件按节组织。default部分包含默认选项,所有其他部分(除了日志级别和缓存文件路径)将继承这些选项。所有其他部分将逐个读取;每次filter_on廑regexfilter_on廑machine中定义的条件匹配,并且不被exclude中定义的条件排除,filter_out_regexfilter_out_machine缓存将填充标记neighbor或标记no neighbor

缓存长度不能超过阈值,因为只考虑了ip neigh命令结果中的reachable行,而且这些行的变化很大,threshold参数允许您配置状态更改的速度。

当缓存中只有neighborno neighbor标记时,相应的命令将执行一次。

#####已知机器

您可以用known_machine作为标题填充一个部分,在其中您将写出您知道的机器的名称和mac地址。然后您就可以通过filter_out_machine和filter_on_machine来过滤它们。

请参考配置示例文件以了解实际用例。

##选项列表

####默认节选项

  • loglevel: allows you to choose the verbosity level in the syslog between DEBUG, INFO, WARN, ERROR and FATAL.
  • cache_file: the path to the file where MindYourNeighbors will store its cache.

####按部分,可重写选项

  • threshold: the number of consecutive matches (or un matches) it takes for MindYourNeighbors to execute the “match” or “no match” command.
  • filter_on_regex: a regex to filters lines from the ip neigh command, lines will have to match to be counted
  • filter_out_regex: a regex to filters lines from the ip neigh command, matching line will be excluded
  • exclude: a comma separated list of string. If one of those string should be found in a ip neigh line, it should be excluded.
  • filter_on_machine: a comma separated list of machine names to filter in (they must be registered in known_machine)
  • filter_out_machine: a comma separated list of machine names to filter out (they must be registered in known_machine)
  • command_match: A command to execute when the cache has been filed with neighbor marker.
  • command_no_match: A command to execute when the cache has been filed with no neighbor marker.
  • device: if none provide the ip neigh command will be parsed else ip neigh show dev <device>.
  • enable: a boolean (true or false), enabling or disabling a section.
  • nslookup: a boolean (true or false), making MindYourNeighbors looking up domain names for IP it’ll print in the logs. Can be useful for debuging.
  • error_on_stderr: a boolean (true or false); if true and the command print something on stderr, the command will be ignored and executed again.
  • cron: a cron styled time description in which the section will be activated

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

推荐PyPI第三方库


热门话题
java Android应用程序在后台   如何使用java减去日期。sql。时间戳   在Eclipse中使用Tomcat和Maven的java抛出错误   java Runnable jar什么都不做,资源不导出   并发Java内存模型:volatiles和读/写重新排序   使用Morphia在MongoDB中进行java批量升级。可能吗?   java将自己创建的sqlite数据库复制到安卓失败   在java中使用嵌套循环解决消除?   地图上多个标记的java实时动画   java如何在J2EE web应用程序中从服务层调用DAO方法   java我只想浏览文件,并将其作为电子邮件中的文件。我应如何附加:   猜猜我在think Java中的数字是57   可以在java流中的groupingBy中使用foreach吗?   我的Java程序编译时没有任何错误,但不会完全运行