{ "info": { "author": "Serafeim Mellos", "author_email": "fim@mellos.io", "bugtrack_url": null, "classifiers": [], "description": "icapclient3\n===========\n\nA Python3 module for creating ICAP clients. This is a fork of\nhttps://github.com/vrasneur/icapclient with Python3.X support. The\nmodule API is somewhat inspired by the `httplib`_ python module.\n\nThis module is written in pure C, and uses the C-ICAP library to handle\nthe ICAP protocol.\n\nThis branch works with the latest versions of C-ICAP (0.4.x - 0.5.x). If you\nare using an older version, check the legacy branch.\n\nWhat is an ICAP client?\n-----------------------\n\nICAP is a protocol defined in `RFC3507`_. `Errata`_ are available for\nthe ICAP specification and there is a draft RFC about `ICAP\nextensions`_.\n\nIt is a client-server protocol that is primarily used to do virus\nscanning and content rewriting. E.g. an ICAP client sends a potentially\ninfected file to the ICAP server. This server does some analysis and\nsends back information about the file to the client, such as the\ndetected virus name. Or a proxy can send content to an ICAP server that\nwill modify the content and send it back to the proxy.\n\nICAP is implemented by many antivirus gateways or web proxies. You have\na list of implementations in the `Wikipedia article about ICAP`_ or at\nthe `ICAP-forum Products page`_.\n\nRequirements\n------------\n\n- Python 3.X\n- the `C-ICAP`_ library, (>= 0.4.x)\n- GCC or clang\n\nInstallation\n------------\n\n1. Install all the required development packages.\n\n E.g. on a Debian system, as root :\n\n .. code:: bash\n\n # install the Python development stuff\n apt-get install python-dev\n # install the C-ICAP API\n apt-get install libicapapi-dev\n\n2. Build the library, as a normal user\n\n .. code:: bash\n\n cd /path/to/icapclient\n python setup.py build\n\n3. Install the library, as root\n\n .. code:: bash\n\n python setup.py install\n\nExample\n-------\n\nTo send files and get the ICAP server response\n\n .. code:: python\n\n # import the icap client library\n >>> import icapclient\n # for pretty printing\n >>> from pprint import pprint\n # create an ICAP connection, default port is 1344\n >>> conn = icapclient.ICAPConnection('192.168.1.5')\n # check that the ICAP server recognizes the EICAR virus test file\n # send a REQMOD request, default url is '/' and default service is 'avscan'\n # specify another service explicitly if you are using \"eset\" for example\n >>> conn.request('REQMOD', '/home/vincent/malwares/eicar.txt', service=\"avscan\")\n # get the server response\n >>> resp = conn.getresponse()\n # get the ICAP response status code\n >>> resp.icap_status\n 200\n # get the ICAP response reason string\n >>> resp.icap_reason\n 'OK'\n # print the ICAP response headers\n # they are a list of (name, value) tuples\n >>> pprint(resp.icap_headers)\n [('Server', 'C-ICAP/0.3.4'),\n ('Connection', 'keep-alive'),\n ('ISTag', 'CI0001-xhZPmAmHArrMLzamxkH5CwAA'),\n ('X-Infection-Found', 'Type=0; Resolution=2; Threat=Eicar-Test-Signature;'),\n ('Encapsulated', 'res-hdr=0, res-body=108')]\n # get a specific header value\n # here, check if a virus has been found\n # Note that \"x-infection-found\" is a draft and not all antiviruses implement it.\n # For example, Eset NOT 32 does not.\n # Sometimes you should look inside the incapsulated HTTP response.\n >>> resp.get_icap_header('x-infection-found')\n 'Type=0; Resolution=2; Threat=Eicar-Test-Signature;'\n # get the first line of the encapsulated HTTP request\n >>> resp.http_req_line\n 'POST / HTTP/1.1'\n # get the first line of the encapsulated HTTP response\n >>> resp.http_resp_line\n 'HTTP/1.0 403 Forbidden'\n # okay, test files are great, but try with a real PDF exploit\n # send the REQMOD request and reuse the socket\n >>> conn.request('REQMOD', '/home/vincent/malwares/exploit.pdf')\n # get the ICAP response\n >>> resp = conn.getresponse()\n # the response is OK\n >>> resp.icap_status\n 200\n >>> resp.icap_reason\n 'OK'\n # pretty-print the ICAP response headers\n >>> pprint(resp.icap_headers)\n [('Server', 'C-ICAP/0.3.4'),\n ('Connection', 'keep-alive'),\n ('ISTag', 'CI0001-xhZPmAmHArrMLzamxkH5CwAA'),\n ('X-Infection-Found', 'Type=0; Resolution=2; Threat=Exploit.PDF-28560;'),\n ('Encapsulated', 'res-hdr=0, res-body=108')]\n # does the request contain a PDF exploit? yes\n >>> resp.get_icap_header('x-infection-found')\n 'Type=0; Resolution=2; Threat=Exploit.PDF-28560;'\n >>> resp.http_resp_line\n 'HTTP/1.0 403 Forbidden'\n # try a REQMOD request with a file with no malware in it\n >>> conn.request('REQMOD', '/home/vincent/files/normal.txt')\n >>> resp = conn.getresponse()\n >>> resp.icap_status\n 200\n >>> resp.icap_reason\n 'OK'\n >>> pprint(resp.icap_headers)\n [('Server', 'C-ICAP/0.3.4'),\n ('Connection', 'keep-alive'),\n ('ISTag', 'CI0001-xhZPmAmHArrMLzamxkH5CwAA'),\n ('Encapsulated', 'req-hdr=0, req-body=124')]\n # no virus or malware found\n >>> resp.get_icap_header('x-infection-found') is None\n True\n # close the ICAP connection\n >>> conn.close()\n\nTo enable the verbose mode:\n\n .. code:: python\n\n >>> import icapclient\n >>> icapclient.set_debug_stdout(True)\n >>> icapclient.set_debug_level(10)\n\n.. _httplib: https://docs.python.org/2/library/httplib.html\n.. _RFC3507: http://tools.ietf.org/html/rfc3507\n.. _Errata: http://www.measurement-factory.com/std/icap/\n.. _ICAP extensions: https://tools.ietf.org/html/draft-stecher-icap-subid-00\n.. _Wikipedia article about ICAP: http://en.wikipedia.org/wiki/Internet_Content_Adaptation_Protocol\n.. _ICAP-forum Products page: http://www.icap-forum.org/icap?do=products\n.. _C-ICAP: http://c-icap.sourceforge.net", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/fim/icapclient3/tarball/1.1.2", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fim/icapclient3", "keywords": "icap,antivirus", "license": "", "maintainer": "", "maintainer_email": "", "name": "icapclient3", "package_url": "https://pypi.org/project/icapclient3/", "platform": "", "project_url": "https://pypi.org/project/icapclient3/", "project_urls": { "Download": "https://github.com/fim/icapclient3/tarball/1.1.2", "Homepage": "https://github.com/fim/icapclient3" }, "release_url": "https://pypi.org/project/icapclient3/1.1.2/", "requires_dist": null, "requires_python": "", "summary": "Python3 module for creating ICAP clients", "version": "1.1.2" }, "last_serial": 4447271, "releases": { "1.0.4": [ { "comment_text": "", "digests": { "md5": "408c3d6c5983919e4104b2baeb4f7d34", "sha256": "71d21dab29311c74a68824a2326caf2dba7146059b9bcc349fe0cb451659aa4b" }, "downloads": -1, "filename": "icapclient3-1.0.4.tar.gz", "has_sig": false, "md5_digest": "408c3d6c5983919e4104b2baeb4f7d34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9845, "upload_time": "2017-11-01T17:00:30", "url": "https://files.pythonhosted.org/packages/7e/d6/12001e181958a79f668022347baa75acd6ee2a764ac6c3293d28c8a50204/icapclient3-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "337094b4255c52e21b253c95c0178795", "sha256": "b525438a310f47978a9069bab3df6db4ced353660ab28a43eb05c1b4ebca268c" }, "downloads": -1, "filename": "icapclient3-1.0.5.tar.gz", "has_sig": false, "md5_digest": "337094b4255c52e21b253c95c0178795", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9846, "upload_time": "2017-11-02T10:25:33", "url": "https://files.pythonhosted.org/packages/42/64/4564fc9cdcd74648c01e858601c708c6458152ddbc5eb4743b16ac9da5aa/icapclient3-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "0ee160002d1d702b40aa870252f5ca8b", "sha256": "fd257261be4ce53b8fbc0edbc87518cc0b9d75c7c0efc10d128d92a68e1576ad" }, "downloads": -1, "filename": "icapclient3-1.0.6.tar.gz", "has_sig": false, "md5_digest": "0ee160002d1d702b40aa870252f5ca8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9890, "upload_time": "2017-11-02T20:15:11", "url": "https://files.pythonhosted.org/packages/b3/ff/1a75fd28c05859d3208d3ee4148bad3032bac5168f79891f0a37bb9c22e2/icapclient3-1.0.6.tar.gz" } ], "1.0.7": [ { "comment_text": "", "digests": { "md5": "eb276eebfd304a8c16933b142ce83e39", "sha256": "070928af8450deecbc5c04d842532945f1b24efd301c014a2effdd731f89cef5" }, "downloads": -1, "filename": "icapclient3-1.0.7.tar.gz", "has_sig": false, "md5_digest": "eb276eebfd304a8c16933b142ce83e39", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9905, "upload_time": "2017-11-07T12:48:04", "url": "https://files.pythonhosted.org/packages/0f/6a/b54bcbfebb9247917b0ff22dfa75a8a9fdefb63ba23ce5960ea658fcba97/icapclient3-1.0.7.tar.gz" } ], "1.0.8": [ { "comment_text": "", "digests": { "md5": "469d7415323ff85250bd4a5f5c99f14c", "sha256": "891ea62f80913e4eded59c2eadce36bed4f0c26bbae0d4b8c83586f038c8ac40" }, "downloads": -1, "filename": "icapclient3-1.0.8.tar.gz", "has_sig": false, "md5_digest": "469d7415323ff85250bd4a5f5c99f14c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9905, "upload_time": "2017-12-06T17:31:28", "url": "https://files.pythonhosted.org/packages/9c/1d/2623b1b235d9608b3549b82de66ff399f834378e61fdf01abf91fcb7fa9d/icapclient3-1.0.8.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "3e1356278abdfd730f3fae6603cc3100", "sha256": "9ea5348fbb529e76ca00d9813d5ffda3ebe6dcd72db9a7a381c38bc62aaf6f88" }, "downloads": -1, "filename": "icapclient3-1.1.0.tar.gz", "has_sig": false, "md5_digest": "3e1356278abdfd730f3fae6603cc3100", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9945, "upload_time": "2017-11-09T12:08:44", "url": "https://files.pythonhosted.org/packages/58/1d/6106fba42315e55016079cf8441ac0f177d39c8bed947b05cb1d57a1e56f/icapclient3-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "30e980ece851f7e6080e4d218acdc975", "sha256": "a70d4e1e71277153f21ed939229273655b291e5fb3adbbcc93cf90477d1f7191" }, "downloads": -1, "filename": "icapclient3-1.1.1.tar.gz", "has_sig": false, "md5_digest": "30e980ece851f7e6080e4d218acdc975", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9984, "upload_time": "2017-12-06T17:31:48", "url": "https://files.pythonhosted.org/packages/f7/07/620aef5e255fd9cdfbae7cb30d7e0c59e148f37830abdcd453605e95d8a7/icapclient3-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "6f9505ec3bfaecda845e7f95b3c74779", "sha256": "d0395d7caed3066d37fbb3425451819262fd1037a7bc448c738a2397a09b52e4" }, "downloads": -1, "filename": "icapclient3-1.1.2.tar.gz", "has_sig": false, "md5_digest": "6f9505ec3bfaecda845e7f95b3c74779", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9966, "upload_time": "2018-11-03T11:41:30", "url": "https://files.pythonhosted.org/packages/71/7b/cc29147d693d48577765388fc25b8b32f97feedba7f52e72c2f1034f0e59/icapclient3-1.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6f9505ec3bfaecda845e7f95b3c74779", "sha256": "d0395d7caed3066d37fbb3425451819262fd1037a7bc448c738a2397a09b52e4" }, "downloads": -1, "filename": "icapclient3-1.1.2.tar.gz", "has_sig": false, "md5_digest": "6f9505ec3bfaecda845e7f95b3c74779", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9966, "upload_time": "2018-11-03T11:41:30", "url": "https://files.pythonhosted.org/packages/71/7b/cc29147d693d48577765388fc25b8b32f97feedba7f52e72c2f1034f0e59/icapclient3-1.1.2.tar.gz" } ] }