Name | ninfo JSON |
Version |
1.0.0
JSON |
| download |
home_page | |
Summary | Plugin based information gathering library |
upload_time | 2023-05-04 18:20:32 |
maintainer | |
docs_url | None |
author | |
requires_python | >=2.7 |
license | |
keywords |
ninfo
search
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<p align="center"><img src="meme.jpeg"/></p>
nInfo
=====
nInfo is a library, CLI tool, and web interface (and lots of plugins) for gathering information on any of the following:
* IP Address (v4 or v6)
* CIDR Block (v4 or v6)
* MAC Address
* Hostname
* Username
* Hashes (as in md5/sha1 etc)
It consists of multiple plugin classes that implement a `get_info` function.
The classes contain metadata for the type of arguments they accept, and if
they are relevant for internal and or external hosts.
The CLI tool
============
Listing plugins
---------------
$ ninfo -l
Name Title Description
cif CIF Collective Intelligence Framework
cymruwhois Cymru Whois Cymru Whois lookup
geoip GeoIP GeoIP
google_safebrowsing Google Safe Browsing Google Safe Browsing check
....
Getting information
-------------------
Silly example, run two plugins against two addreses:
$ ninfo -p geoip -p cymruwhois 8.8.8.8 4.2.2.2
=== 8.8.8.8 ===
*** Cymru Whois (Cymru Whois lookup) ***
15169 US 8.8.8.0/24 GOOGLE - Google Inc.
*** GeoIP (GeoIP) ***
US - United States
=== 4.2.2.2 ===
*** Cymru Whois (Cymru Whois lookup) ***
3356 US 4.0.0.0/9 LEVEL3 Level 3 Communications
*** GeoIP (GeoIP) ***
US - United States
The Library
===========
>>> from ninfo import Ninfo
>>> n=Ninfo()
>>> n.get_info("cymruwhois", "8.8.8.8")
{'cc': 'US', 'ip': '8.8.8.8', 'prefix': '8.8.8.0/24', 'asn': '15169', 'owner': 'GOOGLE - Google Inc.'}
>>> print n.get_info_text("geoip", "8.8.8.8")
US - United States
The Web Interface
=================
See https://github.com/justinazoff/ninfo_web or https://github.com/justinazoff/django-ninfo
Writing A plugin
----------------
Here's a plugin:
```python
from ninfo import PluginBase
class fun_plugin(PluginBase):
"""This plugin returns something cool!"""
name = 'fun'
title = 'Fun Plugin'
description = 'Happy Fun time'
cache_timeout = 60*2
types = ['ip','hostname']
#def setup(self):
# #libraries should be lazy imported in setup. This is only called once.
# import mybackendlibrary
# self.client = mybackendlibrary.Client()
def get_info(self, arg):
#should always return a dictionary, even for a single value
#multiple values are the norm, and allow values to be added without breakage
result = 'hello %s' % arg
return { "result": result }
plugin_class = fun_plugin
```
If installed, this plugin can be run as follows:
>>> from ninfo import Ninfo
>>> p = Ninfo()
>>> print p.get_info('fun', 'justin.rules')
{'result': 'hello justin.rules'}
I had to include a '.' in the argument, because without it, ninfo will assume
the argument is a 'user' and not an 'ip' or a 'hostname', and it will not run
the plugin.
Plugins are installed and located using entry_points. If the above class was in a python module
called fun_plugin, it would be installed by the following in setup.py:
```python
...
py_modules = [ "fun_plugin"],
entry_points = {
'ninfo.plugin': [
'fun = fun_plugin',
]
...
```
Plugin Metadata
---------------
* Strings
* \_\_doc\_\_ - The python docstring of the class is used as the long_description for the plugin.
* name - The name of the plugin. Can be anything, but keeping it limited to [a-z_] is recommended.
* title - The title of the plugin. This is what is actually displayed to the user.
* description - Short description of the plugin.
* cache_timeout - timeout in seconds that this plugin should be cached in
memcache, and the max-age parameter sent by the web interface.
* types - A list of one or more of 'mac', 'ip4', 'ip6', 'cidr4', 'cidr6', 'hostname', 'username'.
* local - if False, this plugin will not be run against local hosts.
* remote - if False, this plugin will not be run against remote hosts.
Cloned Plugins
--------------
Multiple instances of a plugin can be created by adding another section in the
configuration file and optionally overriding the plugin metadata:
[plugin:geoip]
path = GeoIP.dat
[plugin:geoipcity]
clone = geoip
path = GeoIPCity.dat
title = City GeoIP
description = City Level GeoIP
See Also
--------
* [ninfo_web](https://github.com/JustinAzoff/ninfo_web) - basic web interface
* [django-ninfo](https://github.com/JustinAzoff/django-ninfo) - ninfo integrated with django
* [ninfo-plugin-template](https://github.com/JustinAzoff/ninfo-plugin-template) - paster template for creating plugins
* [ninfo-client](https://github.com/JustinAzoff/ninfo-client) - REST client for ninfo_web or django-ninfo
* [Search github for ninfo-plugin](https://github.com/search?p=1&q=ninfo-plugins&ref=searchresults&type=Repositories) - more plugins
Raw data
{
"_id": null,
"home_page": "",
"name": "ninfo",
"maintainer": "",
"docs_url": null,
"requires_python": ">=2.7",
"maintainer_email": "",
"keywords": "ninfo,search",
"author": "",
"author_email": "Justin Azoff <justin.azoff@gmail.com>, Ryan Goggin <support@ryangoggin.net>",
"download_url": "https://files.pythonhosted.org/packages/93/ef/831db5e3895d26e64c0cf22f273c84a440686d27530c01b3e4905fbaa4de/ninfo-1.0.0.tar.gz",
"platform": null,
"description": "<p align=\"center\"><img src=\"meme.jpeg\"/></p>\n\nnInfo\n=====\n\nnInfo is a library, CLI tool, and web interface (and lots of plugins) for gathering information on any of the following:\n\n * IP Address (v4 or v6)\n * CIDR Block (v4 or v6)\n * MAC Address\n * Hostname\n * Username\n * Hashes (as in md5/sha1 etc)\n\nIt consists of multiple plugin classes that implement a `get_info` function.\nThe classes contain metadata for the type of arguments they accept, and if\nthey are relevant for internal and or external hosts.\n\nThe CLI tool\n============\n\nListing plugins\n---------------\n\n $ ninfo -l\n Name Title Description\n cif CIF Collective Intelligence Framework\n cymruwhois Cymru Whois Cymru Whois lookup\n geoip GeoIP GeoIP\n google_safebrowsing Google Safe Browsing Google Safe Browsing check\n ....\n\nGetting information\n-------------------\n\nSilly example, run two plugins against two addreses:\n\n $ ninfo -p geoip -p cymruwhois 8.8.8.8 4.2.2.2\n === 8.8.8.8 === \n *** Cymru Whois (Cymru Whois lookup) ***\n 15169 US 8.8.8.0/24 GOOGLE - Google Inc.\n\n *** GeoIP (GeoIP) ***\n US - United States\n\n === 4.2.2.2 === \n *** Cymru Whois (Cymru Whois lookup) ***\n 3356 US 4.0.0.0/9 LEVEL3 Level 3 Communications\n\n *** GeoIP (GeoIP) ***\n US - United States\n\nThe Library\n===========\n\n >>> from ninfo import Ninfo\n >>> n=Ninfo()\n >>> n.get_info(\"cymruwhois\", \"8.8.8.8\")\n {'cc': 'US', 'ip': '8.8.8.8', 'prefix': '8.8.8.0/24', 'asn': '15169', 'owner': 'GOOGLE - Google Inc.'}\n >>> print n.get_info_text(\"geoip\", \"8.8.8.8\")\n US - United States\n\nThe Web Interface\n=================\n\nSee https://github.com/justinazoff/ninfo_web or https://github.com/justinazoff/django-ninfo\n\nWriting A plugin\n----------------\n\nHere's a plugin:\n\n```python\nfrom ninfo import PluginBase\n\nclass fun_plugin(PluginBase):\n \"\"\"This plugin returns something cool!\"\"\"\n\n name = 'fun'\n title = 'Fun Plugin'\n description = 'Happy Fun time'\n cache_timeout = 60*2\n types = ['ip','hostname']\n\n #def setup(self):\n # #libraries should be lazy imported in setup. This is only called once.\n # import mybackendlibrary\n # self.client = mybackendlibrary.Client()\n\n def get_info(self, arg):\n #should always return a dictionary, even for a single value\n #multiple values are the norm, and allow values to be added without breakage\n result = 'hello %s' % arg\n return { \"result\": result }\n\nplugin_class = fun_plugin\n```\n\nIf installed, this plugin can be run as follows:\n\n >>> from ninfo import Ninfo\n >>> p = Ninfo()\n >>> print p.get_info('fun', 'justin.rules')\n {'result': 'hello justin.rules'}\n\nI had to include a '.' in the argument, because without it, ninfo will assume\nthe argument is a 'user' and not an 'ip' or a 'hostname', and it will not run\nthe plugin.\n\nPlugins are installed and located using entry_points. If the above class was in a python module\ncalled fun_plugin, it would be installed by the following in setup.py:\n\n```python\n...\npy_modules = [ \"fun_plugin\"],\nentry_points = {\n 'ninfo.plugin': [\n 'fun = fun_plugin',\n ]\n...\n```\n\nPlugin Metadata\n---------------\n\n* Strings\n * \\_\\_doc\\_\\_ - The python docstring of the class is used as the long_description for the plugin.\n * name - The name of the plugin. Can be anything, but keeping it limited to [a-z_] is recommended.\n * title - The title of the plugin. This is what is actually displayed to the user.\n * description - Short description of the plugin.\n* cache_timeout - timeout in seconds that this plugin should be cached in\n memcache, and the max-age parameter sent by the web interface.\n* types - A list of one or more of 'mac', 'ip4', 'ip6', 'cidr4', 'cidr6', 'hostname', 'username'.\n* local - if False, this plugin will not be run against local hosts.\n* remote - if False, this plugin will not be run against remote hosts.\n\nCloned Plugins\n--------------\n\nMultiple instances of a plugin can be created by adding another section in the\nconfiguration file and optionally overriding the plugin metadata:\n\n [plugin:geoip]\n path = GeoIP.dat\n\n [plugin:geoipcity]\n clone = geoip\n path = GeoIPCity.dat\n title = City GeoIP\n description = City Level GeoIP\n\nSee Also\n--------\n\n* [ninfo_web](https://github.com/JustinAzoff/ninfo_web) - basic web interface\n* [django-ninfo](https://github.com/JustinAzoff/django-ninfo) - ninfo integrated with django\n* [ninfo-plugin-template](https://github.com/JustinAzoff/ninfo-plugin-template) - paster template for creating plugins\n* [ninfo-client](https://github.com/JustinAzoff/ninfo-client) - REST client for ninfo_web or django-ninfo\n* [Search github for ninfo-plugin](https://github.com/search?p=1&q=ninfo-plugins&ref=searchresults&type=Repositories) - more plugins\n",
"bugtrack_url": null,
"license": "",
"summary": "Plugin based information gathering library",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/ninfo-py/ninfo"
},
"split_keywords": [
"ninfo",
"search"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cafe3719357c8ede8a32ee8e6a5eb941d971b03f8d00ba261198873aac301f71",
"md5": "7d994fd3c1c1942f61ecb72d8a0e02b7",
"sha256": "5dd14af13c62e968fa5b5ed9a0c7cd6e60503cf9846c06c06e7457bb11dfe0c8"
},
"downloads": -1,
"filename": "ninfo-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7d994fd3c1c1942f61ecb72d8a0e02b7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=2.7",
"size": 10876,
"upload_time": "2023-05-04T18:20:30",
"upload_time_iso_8601": "2023-05-04T18:20:30.952414Z",
"url": "https://files.pythonhosted.org/packages/ca/fe/3719357c8ede8a32ee8e6a5eb941d971b03f8d00ba261198873aac301f71/ninfo-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "93ef831db5e3895d26e64c0cf22f273c84a440686d27530c01b3e4905fbaa4de",
"md5": "3a62028800fe7237c1cd88da36759d61",
"sha256": "f82c97ab89a2bc2cf9be4ab60fab832fad937342e122e59f246e0e01cb1f8dc3"
},
"downloads": -1,
"filename": "ninfo-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "3a62028800fe7237c1cd88da36759d61",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7",
"size": 13912,
"upload_time": "2023-05-04T18:20:32",
"upload_time_iso_8601": "2023-05-04T18:20:32.769406Z",
"url": "https://files.pythonhosted.org/packages/93/ef/831db5e3895d26e64c0cf22f273c84a440686d27530c01b3e4905fbaa4de/ninfo-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-04 18:20:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ninfo-py",
"github_project": "ninfo",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "ninfo"
}