{"id":19710552,"url":"https://github.com/leakix/leakixclient-python","last_synced_at":"2025-06-20T18:38:46.352Z","repository":{"id":136927596,"uuid":"439898851","full_name":"LeakIX/LeakIXClient-Python","owner":"LeakIX","description":"Python Client to LeakIX API","archived":false,"fork":false,"pushed_at":"2024-02-11T23:12:34.000Z","size":59,"stargazers_count":17,"open_issues_count":5,"forks_count":6,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-24T00:12:10.544Z","etag":null,"topics":["attack-surface-management","bounty","bugbounty","hacktoberfest","infosec","leakix","osint","python","redteam","security","vulnerability"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LeakIX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-12-19T15:27:51.000Z","updated_at":"2025-02-11T23:48:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc1ea836-5849-4034-be0b-7cbe04cf3286","html_url":"https://github.com/LeakIX/LeakIXClient-Python","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeakIX%2FLeakIXClient-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeakIX%2FLeakIXClient-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeakIX%2FLeakIXClient-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeakIX%2FLeakIXClient-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeakIX","download_url":"https://codeload.github.com/LeakIX/LeakIXClient-Python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251549211,"owners_count":21607368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attack-surface-management","bounty","bugbounty","hacktoberfest","infosec","leakix","osint","python","redteam","security","vulnerability"],"created_at":"2024-11-11T22:07:42.296Z","updated_at":"2025-04-29T17:31:19.832Z","avatar_url":"https://github.com/LeakIX.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LeakIX python client\n\n[![](https://img.shields.io/pypi/v/leakix.svg)](https://pypi.org/project/leakix/)\n[![](https://img.shields.io/pypi/pyversions/leakix.svg)](https://pypi.org/project/leakix/)\n\nOfficial LeakIX python client\n\n## Install\n\n```\npip install leakix\n```\n\nTo run tests, use `poetry run pytest`.\n\n## Documentation\n\nDocstrings are used to document the library.\nTypes are also used to inform the user on what type of objects the functions are\nexpecting.\n\nEach API response is encoded in either a `SuccessResponse` object or a\n`ErrorResponse`.\nThe methods `is_success()` or `is_error()` exist on each API response.\nYou can get the actual response by using the method `json()` on the response object.\n\nThe output are events described in\n[l9format](https://github.com/LeakIX/l9format-python).\nWhen you have an object of type `l9Event` (or the longer\n`l9format.l9format.L9Event`), you can refer to\n[L9Event](https://github.com/LeakIX/l9format-python/blob/main/l9format/l9format.py#L158)\nmodel class for the available fields.\n\nFor instance, to access the IP of an object `event` of type `L9Event`, you can\nuse `event.ip`.\n\nEach object can be transformed back into a Python dictionary/JSON using the method `to_dict()`.\nFor instance, for the response of the subdomains endpoint, you can get back individual JSON by using:\n\n```python\ndef example_get_subdomains():\n    response = CLIENT.get_subdomains(\"leakix.net\")\n    for subdomain in response.json():\n        print(subdomain.to_dict())\n```\n\n## Support\n\nFeel free to open an issue if you have any question.\nYou can also contact us on `support@leakix.net`.\n\nIf you need commercial support, have a look at https://leakix.net/plans.\n\n## Examples\n\n```python\nimport decouple\nfrom leakix import Client\nfrom leakix.query import MustQuery, MustNotQuery, RawQuery\nfrom leakix.field import PluginField, CountryField, TimeField, Operator\nfrom leakix.plugin import Plugin\nfrom datetime import datetime, timedelta\n\n\nAPI_KEY = decouple.config(\"API_KEY\")\nBASE_URL = decouple.config(\"LEAKIX_HOST\", default=None)\nCLIENT = Client(api_key=API_KEY)\n\n\ndef example_get_host_filter_plugin():\n    response = CLIENT.get_host(ipv4=\"33.33.33.33\")\n    assert response.status_code() == 200\n\n\ndef example_get_service_filter_plugin():\n    \"\"\"\n    Filter by fields. In this example, we want to have the NTLM services.\n    A list of plugins can be found in leakix.plugin\n    \"\"\"\n    query_http_ntlm = MustQuery(field=PluginField(Plugin.HttpNTLM))\n    response = CLIENT.get_service(queries=[query_http_ntlm])\n    assert response.status_code() == 200\n    # check we only get NTML related services\n    assert all((i.tags == [\"ntlm\"] for i in response.json()))\n\n\ndef example_get_service_filter_plugin_with_pagination():\n    \"\"\"\n    Filter by fields. In this example, we want to have the NTLM services.\n    A list of plugins can be found in leakix.plugin.\n    Ask for page 1 (starts at 0)\n    \"\"\"\n    query_http_ntlm = MustQuery(field=PluginField(Plugin.HttpNTLM))\n    response = CLIENT.get_service(queries=[query_http_ntlm], page=1)\n    assert response.status_code() == 200\n    # check we only get NTML related services\n    assert all((i.tags == [\"ntlm\"] for i in response.json()))\n\n\ndef example_get_leaks_filter_multiple_plugins():\n    query_http_ntlm = MustQuery(field=PluginField(Plugin.HttpNTLM))\n    query_country = MustQuery(field=CountryField(\"France\"))\n    response = CLIENT.get_leak(queries=[query_http_ntlm, query_country])\n    assert response.status_code() == 200\n    assert all(\n        (\n            i.geoip.country_name == \"France\" and i.tags == [\"ntlm\"]\n            for i in response.json()\n        )\n    )\n\n\ndef example_get_leaks_multiple_filter_plugins_must_not():\n    query_http_ntlm = MustQuery(field=PluginField(Plugin.HttpNTLM))\n    query_country = MustNotQuery(field=CountryField(\"France\"))\n    response = CLIENT.get_leak(queries=[query_http_ntlm, query_country])\n    assert response.status_code() == 200\n    assert all(\n        (\n            i.geoip.country_name != \"France\" and i.tags == [\"ntlm\"]\n            for i in response.json()\n        )\n    )\n\n\ndef example_get_leak_raw_query():\n    raw_query = '+plugin:HttpNTLM +country:\"France\"'\n    query = RawQuery(raw_query)\n    response = CLIENT.get_leak(queries=[query])\n    assert response.status_code() == 200\n    assert all(\n        (\n            i.geoip.country_name == \"France\" and i.tags == [\"ntlm\"]\n            for i in response.json()\n        )\n    )\n\n\ndef example_get_leak_plugins_with_time():\n    query_plugin = MustQuery(field=PluginField(Plugin.GitConfigHttpPlugin))\n    today = datetime.now()\n    one_month_ago = today - timedelta(days=30)\n    query_today = MustQuery(field=TimeField(today, Operator.StrictlySmaller))\n    query_yesterday = MustQuery(\n        field=TimeField(one_month_ago, Operator.StrictlyGreater)\n    )\n    queries = [query_today, query_yesterday, query_plugin]\n    response = CLIENT.get_leak(queries=queries)\n    assert response.status_code() == 200\n\n\ndef example_get_plugins():\n    response = CLIENT.get_plugins()\n    for p in response.json():\n        print(p.name)\n        print(p.description)\n\n\nif __name__ == \"__main__\":\n    example_get_host_filter_plugin()\n    example_get_service_filter_plugin()\n    example_get_service_filter_plugin_with_pagination()\n    example_get_leaks_filter_multiple_plugins()\n    example_get_leaks_multiple_filter_plugins_must_not()\n    example_get_leak_plugins_with_time()\n    example_get_leak_raw_query()\n    example_get_plugins()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleakix%2Fleakixclient-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleakix%2Fleakixclient-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleakix%2Fleakixclient-python/lists"}