{"id":13501688,"url":"https://github.com/pinterest/ptracer","last_synced_at":"2025-03-29T09:31:11.505Z","repository":{"id":45455434,"uuid":"107320312","full_name":"pinterest/ptracer","owner":"pinterest","description":"A library for ptrace-based tracing of Python programs","archived":false,"fork":false,"pushed_at":"2024-07-10T04:48:57.000Z","size":69,"stargazers_count":155,"open_issues_count":5,"forks_count":27,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-31T20:40:46.586Z","etag":null,"topics":["ptrace","python","syscalls"],"latest_commit_sha":null,"homepage":"https://ptracer.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pinterest.png","metadata":{"files":{"readme":"README.rst","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,"publiccode":null,"codemeta":null}},"created_at":"2017-10-17T20:28:31.000Z","updated_at":"2024-09-18T14:35:02.000Z","dependencies_parsed_at":"2024-10-31T20:42:34.149Z","dependency_job_id":null,"html_url":"https://github.com/pinterest/ptracer","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinterest%2Fptracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinterest%2Fptracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinterest%2Fptracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinterest%2Fptracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pinterest","download_url":"https://codeload.github.com/pinterest/ptracer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246167153,"owners_count":20734380,"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":["ptrace","python","syscalls"],"created_at":"2024-07-31T22:01:46.417Z","updated_at":"2025-03-29T09:31:11.215Z","avatar_url":"https://github.com/pinterest.png","language":"Python","readme":"ptracer -- a library for ptrace-based tracing of Python programs\n================================================================\n\nPtracer is a library providing on-demand system call tracing in Python\nprograms.\n\n\nBasic Usage\n-----------\n\n.. code-block:: python\n\n    import traceback\n    import ptracer\n\n    def callback(syscall):\n        print('{}({}) -\u003e {}'.format(\n            syscall.name,\n            ', '.join(repr(arg.value) for arg in syscall.args),\n            syscall.result.text))\n        print('Traceback: ')\n        print(''.join(traceback.format_list(syscall.traceback)))\n\n    with ptracer.context(callback):\n        open('/dev/null', 'wb')\n\n\nFiltering\n---------\n\nPtracer allows elaborate syscall filtering via the *filter* argument:\n\n.. code-block:: python\n\n    flt = [\n        ptracer.SysCallPattern(\n            name='open',\n            args=[\n                re.compile(b'/tmp/.*'),\n                lambda arg: arg.value \u0026 os.O_WRONLY\n            ],\n            result=lambda res: res.value \u003e 0\n        )\n    ]\n\n    with ptracer.context(callback, filter=flt):\n        # traced code\n        ...\n\n\nIn the above example, ptracer will invoke the callback only for successful\nattempts to open files in the \"/tmp\" directory for writing.\n\n\nDocumentation\n-------------\n\nThe documentation is available on\n`ptracer.readthedocs.io \u003chttps://ptracer.readthedocs.io/\u003e`_.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinterest%2Fptracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpinterest%2Fptracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinterest%2Fptracer/lists"}