{"id":13441342,"url":"https://github.com/raboof/nethogs","last_synced_at":"2025-04-23T20:54:02.499Z","repository":{"id":11441394,"uuid":"13898477","full_name":"raboof/nethogs","owner":"raboof","description":"Linux 'net top' tool","archived":false,"fork":false,"pushed_at":"2025-04-10T06:45:59.000Z","size":1626,"stargazers_count":3340,"open_issues_count":95,"forks_count":293,"subscribers_count":63,"default_branch":"main","last_synced_at":"2025-04-23T20:53:54.960Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raboof.png","metadata":{"files":{"readme":"README.decpcap.txt","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"COPYING","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},"funding":{"github":["raboof"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2013-10-27T09:15:41.000Z","updated_at":"2025-04-19T00:15:02.000Z","dependencies_parsed_at":"2023-01-13T16:30:49.003Z","dependency_job_id":"864c7520-ef54-4004-93c7-ae5f77a9a15d","html_url":"https://github.com/raboof/nethogs","commit_stats":{"total_commits":318,"total_committers":56,"mean_commits":5.678571428571429,"dds":0.4371069182389937,"last_synced_commit":"f281ca30d1b7ce74e8f4f6671b2b1bbb4f25edae"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raboof%2Fnethogs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raboof%2Fnethogs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raboof%2Fnethogs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raboof%2Fnethogs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raboof","download_url":"https://codeload.github.com/raboof/nethogs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250514767,"owners_count":21443208,"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":[],"created_at":"2024-07-31T03:01:32.837Z","updated_at":"2025-04-23T20:54:02.480Z","avatar_url":"https://github.com/raboof.png","language":"C++","readme":"This is a brainstorm about a libpcap-wrapper.\n\nIt should make it possible to add callbacks requesting specific packets, for example asking\nfor all TCP packets, whether they are sent over IPv4 or IPv6.\n\nReturn value of the callback specifies of the packet should 'fall through', i.e.,\nif it should be sent to other callbacks, too.\n\ngive the programmer the opportunity to let packages re-enter the 'stream'.\n\nCallbacks should be called from high to low level. When a callback returns 'true', no lower\ncallbacks should be called. The payload is available in a nice struct (union?), too.\n\n= Examples - how it'd work =\n\n== For the developers of the lib ==\n\nWhen the sniffer is started, we learn what kind of packets are on the wire \n(ethernet, ppp, etc) and start pcap. Whenever a packet arrives, it is parsed. \nAfter parsing, if a callback is defined for this type of packet, the callback \nis pushed onto a stack. After that the payload is parsed. This goes on until \nthe payload is, as far as we're concerned, raw data. Then the callbacks on \nthe stack are called, until one of them returns 'true' ('done parsing this \npacket')\nUndefined callbacks move the parser to the next level.\n\n-- alternatively --\n\nWhen the sniffer is started, we learn what kind of packets are on the wire\n(ethernet, ppp, etc) and start pcap. Whenever a packet arrives, it is parsed.\nAfter parsing, if a callback is defined for this type of packet, that\ncallback is called. If it returns 'true', the packet is 'done', and discarded.\nIf it returns 'false', it's passed on to the next level, leaving any changes\nto the user data intact.\n\n== For the users of the lib ==\n\nIf you want to sniff only tcp packets, add a callback for the 'packet_tcp' \npacket type. If you also want to count the total amount of IP traffic, make \nsure the 'packet_tcp' handler returns 'false' - that means after the tcp\ncallback the packet will go on and be presented to the IP callback also.\n\nIf you want to sniff specifically IPv4 TCP packets, you add a callback for \nIPv4 that calls the function to parse the payload directly, and then returns \n'false'. \n\nIf you modify the 'user' data in top-level callbacks which return 'false', \n\n-- alternatively --\n\nIf you want to sniff only tcp packets, simply only add a callback for \n'dp_packet_tcp'. If, on top of that, you also want to count the total amount\nof IP traffic, make sure it returns 'false' and return.\n\nIf you want to sniff specifically IPv4 TCP packets, you can do 2 things:\nadd a 'true'-returning callback to everything else apart from IPv4 (which\nis ugly), or only add a callback for IPv4 and call the TCP-parsing code\nby hand.\n","funding_links":["https://github.com/sponsors/raboof"],"categories":["C++","Network and Middleware","Network Tools","Network","Network Dev\u0026Ops工具与服务","others","System","\u003ca name=\"cpp\"\u003e\u003c/a\u003eC++","\\*nix/\\*nux","Table of Contents"],"sub_categories":["Ethernet and Wireless Networking","Network Monitoring \u0026 Diagnostics","Benchmarks","Network and Middleware","Networking"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraboof%2Fnethogs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraboof%2Fnethogs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraboof%2Fnethogs/lists"}