{"id":20590084,"url":"https://github.com/takehaya/sys-ebpf","last_synced_at":"2025-12-12T02:46:18.677Z","repository":{"id":256347437,"uuid":"823803724","full_name":"takehaya/Sys-Ebpf","owner":"takehaya","description":"Sys::Ebpf is a pure-perl library to read, modify and load eBPF programs and attach them to various hooks in the Linux kernel.In other words eBPF Loader for written in Perl.","archived":false,"fork":false,"pushed_at":"2024-10-04T14:03:06.000Z","size":241,"stargazers_count":32,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T10:47:04.471Z","etag":null,"topics":["bpf","ebpf","kprobe","perl","xdp"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takehaya.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","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":"2024-07-03T18:47:46.000Z","updated_at":"2025-03-27T02:40:13.000Z","dependencies_parsed_at":"2024-11-16T07:34:09.626Z","dependency_job_id":"7a4cc3bb-1767-4f1f-857c-8360f488c868","html_url":"https://github.com/takehaya/Sys-Ebpf","commit_stats":null,"previous_names":["takehaya/perl-ebpf"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takehaya%2FSys-Ebpf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takehaya%2FSys-Ebpf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takehaya%2FSys-Ebpf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takehaya%2FSys-Ebpf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takehaya","download_url":"https://codeload.github.com/takehaya/Sys-Ebpf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248970459,"owners_count":21191437,"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":["bpf","ebpf","kprobe","perl","xdp"],"created_at":"2024-11-16T07:33:58.367Z","updated_at":"2025-12-12T02:46:13.644Z","avatar_url":"https://github.com/takehaya.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/takehaya/perl-ebpf/actions/workflows/test.yml/badge.svg)](https://github.com/takehaya/perl-ebpf/actions)\n# NAME\n\nebpf - Pure-Perl interface for eBPF (extended Berkeley Packet Filter)\n\n# SYNOPSIS\n\n    use strict;\n    use warnings;\n    use utf8;\n    use Sys::Ebpf::Loader;\n    use Sys::Ebpf::Link::Perf::Kprobe;\n\n    my $file   = \"kprobe.o\";\n    my $loader = Sys::Ebpf::Loader-\u003enew($file);\n    my $data   = $loader-\u003eload_elf();\n    my $kprobe_fn = \"kprobe/sys_execve\";\n\n    my ( $map_data, $prog_fd ) = $loader-\u003eload_bpf($kprobe_fn);\n    my $map_kprobe_map = $map_data-\u003e{kprobe_map};\n    $map_kprobe_map-\u003e{key_schema}   = [ [ 'kprobe_map_key',   'uint32' ], ];\n    $map_kprobe_map-\u003e{value_schema} = [ [ 'kprobe_map_value', 'uint64' ], ];\n\n    my $kprobe_info = Sys::Ebpf::Link::Perf::Kprobe::attach_kprobe( $prog_fd, $kprobe_fn );\n\n    while (1) {\n        my $key   = { kprobe_map_key =\u003e 0 };\n        my $value = $map_kprobe_map-\u003elookup($key);\n        if ( defined $value ) {\n            print Dumper($value);\n            printf \"%s called %d times\\n\", $kprobe_fn, $value-\u003e{kprobe_map_value};\n        }\n        else {\n            warn \"Failed to read map value\\n\";\n        }\n        sleep(1);\n    }\n\n# DESCRIPTION\n\nThe `ebpf` module provides a Perl interface for working with eBPF (extended Berkeley Packet Filter)\non Linux systems. It allows you to load eBPF programs, create and manipulate BPF maps, and interact\nwith the eBPF subsystem directly from Perl.\n\nThis module includes several submodules:\n\n- `Sys::Ebpf::Loader` - For loading eBPF programs and maps\n- `Sys::Ebpf::Asm` - eBPF assembly helpers\n- `Sys::Ebpf::Reader` - For reading ELF files\n- `Sys::Ebpf::Elf::Parser` - For parsing ELF files\n- `Sys::Ebpf::Link::Netlink` - For calling BPF-related netlink commands(e.g. XDP)\n- `Sys::Ebpf::Link::Perf` - For calling BPF-related perf events(e.g. kprobes)\n\n# FUNCTIONS\n\nThis module primarily serves as a namespace and version container for its submodules.\nRefer to the documentation of individual submodules for specific functions and usage.\n\n# SEE ALSO\n\n- [Sys::Ebpf::loader](https://metacpan.org/pod/Sys%3A%3AEbpf%3A%3Aloader)\n- [Sys::Ebpf::asm](https://metacpan.org/pod/Sys%3A%3AEbpf%3A%3Aasm)\n- `Sys::Ebpf::reader` - For reading ELF files\n- `Sys::Ebpf::elf::parser` - For parsing ELF files\n\n# AUTHOR\n\nTAKERU HAYASAKA \u003chayatake396@gmail.com\u003e\n\n# LICENSE AND COPYRIGHT\n\nCopyright (C) 2024 TAKERU HAYASAKA\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of either: the GNU General Public License as published\nby the Free Software Foundation; or the Artistic License.\n\nSee [http://dev.perl.org/licenses/](http://dev.perl.org/licenses/) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakehaya%2Fsys-ebpf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakehaya%2Fsys-ebpf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakehaya%2Fsys-ebpf/lists"}