{ "info": { "author": "Digitale Gesellschaft", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "# anonip\n\n[![PyPI](https://img.shields.io/pypi/v/anonip.svg)](https://pypi.org/project/anonip/)\n[![Python versions](https://img.shields.io/pypi/pyversions/anonip.svg)](https://pypi.org/project/anonip/)\n[![Build Status](https://travis-ci.org/DigitaleGesellschaft/Anonip.svg?branch=master)](https://travis-ci.com/DigitaleGesellschaft/Anonip)\n[![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)](https://github.com/DigitaleGesellschaft/Anonip/blob/master/.coveragerc#L11)\n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/DigitaleGesellschaft/Anonip)\n[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\nDigitale Gesellschaft\nhttps://www.digitale-gesellschaft.ch\n\n\nFormerly\nSwiss Privacy Foundation\nhttps://www.privacyfoundation.ch/\n\n\n## Description\n\nAnonip is a tool to anonymize IP addresses in log files.\n\nIt masks the last bits of IPv4 and IPv6 addresses. That way most of the\nrelevant information is preserved, while the IP-address does not match a\nparticular individuum anymore.\n\nThe log entries get directly piped from Apache to Anonip. The unmasked IP\naddresses are never written to any file.\n\nWith the help of cat, it's also possible to rewrite existing log files.\n\nFor usage with nginx see here: https://github.com/DigitaleGesellschaft/Anonip/issues/1\n\n## Features\n\n - Masks IP addresses in log files\n - Configurable amount of masked bits\n - The column containing the IP address can freely be chosen\n - Works for both access.log- and error.log files\n\n## Officially supported python versions\n - 2.7\n - 3.5\n - 3.6\n - 3.7\n\n## Dependencies\nIf you're using python version >=3.3, there are no external\ndependencies.\n\nFor python versions <3.3:\n - [ipaddress module](https://bitbucket.org/kwi/py2-ipaddress/)\n\n## Invocation\n\n```\nusage: anonip.py [-h] [-4 INTEGER] [-6 INTEGER] [-i INTEGER] [-o FILE]\n [-c INTEGER [INTEGER ...]] [-l STRING] [-r STRING] [-p] [-d]\n [-v]\n\nAnonip is a tool to anonymize IP-addresses in log files.\n\noptional arguments:\n -h, --help show this help message and exit\n -4 INTEGER, --ipv4mask INTEGER\n truncate the last n bits (default: 12)\n -6 INTEGER, --ipv6mask INTEGER\n truncate the last n bits (default: 84)\n -i INTEGER, --increment INTEGER\n increment the IP address by n (default: 0)\n -o FILE, --output FILE\n file to write to\n -c INTEGER [INTEGER ...], --column INTEGER [INTEGER ...]\n assume IP address is in column n (1-based indexed;\n default: 1)\n -l STRING, --delimiter STRING\n log delimiter (default: \" \")\n -r STRING, --replace STRING\n replacement string in case address parsing fails\n Example: 0.0.0.0)\n -p, --skip-private do not mask addresses in private ranges. See IANA\n Special-Purpose Address Registry.\n -d, --debug print debug messages\n -v, --version show program's version number and exit\n```\n\n## Usage\n\nIn the Apache configuration (or the one of a vhost) the log output needs to\nget piped to anonip:\n```\nCustomLog \"|/path/to/anonip.py [OPTIONS] --output /path/to/log\" combined\n```\nThat's it! All the IP addresses will be masked in the log now.\n\nAlternative:\n```\ncat /path/to/orig_log | /path/to/anonip.py [OPTIONS] --output /path/to/log\n```\n\n### As a python module\n\nRead from stdin:\n``` python\nfrom anonip import Anonip\n\n\nanonip = Anonip()\nfor line in anonip.run():\n print(line)\n\n```\nManually feed lines:\n``` python\nfrom anonip import Anonip\n\n\ndata = ['1.1.1.1', '2.2.2.2', '3.3.3.3']\nanonip = Anonip()\n\nfor line in data:\n print(anonip.process_line(line))\n\n```\n\n### Python 2 or 3?\nFor compatibility reasons, anonip uses the shebang `#! /usr/bin/env python`.\nThis will default to python2 on all Linux distributions except for Arch Linux.\nThe performance of anonip can be improved by running it with python3. If \npython3 is available on your system, you should preferrably invoke anonip\nlike this:\n\n``` shell\npython3 -m anonip [OPTIONS]\n```\n\nor \n\n``` shell\npython3 /path/to/anonip.py [OPTIONS]\n```\n\n## Motivation\n\nIn most cases IP addresses are personal data as they refer to individuals (or at least\ntheir Internet connection). IP addresses - and the data associated with them - may\ntherefore only be lawfully processed in accordance with the principles of the\napplicable data protection laws.\n\nStorage of log files from web servers, for example, is only permitted within close time\nlimits or with the voluntary consent of the persons concerned (as long as the\ninformation about the IP address is linkable to a person).\n\nAnonip tries to avoid exactly that, but without losing the benefit of those log files.\n\nWith the masking of the last bits of IP addresses, we're still able to distinguish the\nlog entries up to a certain degree. Compared to the entire removal of the IP-adresses,\nwe're still able to make a rough geolocating as well as a reverse DNS lookup. But the\notherwise distinct IP addresses do not match a particular individuum anymore.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/DigitaleGesellschaft/Anonip", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "anonip", "package_url": "https://pypi.org/project/anonip/", "platform": "", "project_url": "https://pypi.org/project/anonip/", "project_urls": { "Homepage": "https://github.com/DigitaleGesellschaft/Anonip" }, "release_url": "https://pypi.org/project/anonip/1.0.0/", "requires_dist": [ "ipaddress ; python_version < \"3.3\"" ], "requires_python": "", "summary": "Anonip is a tool to anonymize IP-addresses in log-files.", "version": "1.0.0" }, "last_serial": 5167734, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "6cb1a90880447646d11a5c59520d8874", "sha256": "aee4f8cd73d2ba39caedc8d3dd79e1ca5adb093d6a168ac92f9d7bbc2f5943bb" }, "downloads": -1, "filename": "anonip-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6cb1a90880447646d11a5c59520d8874", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7595, "upload_time": "2019-04-20T12:21:12", "url": "https://files.pythonhosted.org/packages/bc/45/746d2a1898d3acc85aac201c40c6fbbac370386a219d8ddbaee9109e2b8b/anonip-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f169b0bdb35abf9931d081a3a3384e0c", "sha256": "a2c1f521c02c800fa4dbd84d160e6cd748dcb49f17619116fab65de8ac4d7632" }, "downloads": -1, "filename": "anonip-1.0.0.tar.gz", "has_sig": false, "md5_digest": "f169b0bdb35abf9931d081a3a3384e0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7481, "upload_time": "2019-04-20T12:21:13", "url": "https://files.pythonhosted.org/packages/72/a7/245675df9c53116198a2ef6cc9f4fd65f5eed5dea70b261db3fc447f4256/anonip-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6cb1a90880447646d11a5c59520d8874", "sha256": "aee4f8cd73d2ba39caedc8d3dd79e1ca5adb093d6a168ac92f9d7bbc2f5943bb" }, "downloads": -1, "filename": "anonip-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6cb1a90880447646d11a5c59520d8874", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7595, "upload_time": "2019-04-20T12:21:12", "url": "https://files.pythonhosted.org/packages/bc/45/746d2a1898d3acc85aac201c40c6fbbac370386a219d8ddbaee9109e2b8b/anonip-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f169b0bdb35abf9931d081a3a3384e0c", "sha256": "a2c1f521c02c800fa4dbd84d160e6cd748dcb49f17619116fab65de8ac4d7632" }, "downloads": -1, "filename": "anonip-1.0.0.tar.gz", "has_sig": false, "md5_digest": "f169b0bdb35abf9931d081a3a3384e0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7481, "upload_time": "2019-04-20T12:21:13", "url": "https://files.pythonhosted.org/packages/72/a7/245675df9c53116198a2ef6cc9f4fd65f5eed5dea70b261db3fc447f4256/anonip-1.0.0.tar.gz" } ] }