{"id":20166231,"url":"https://github.com/utkarsh2102/packlog","last_synced_at":"2026-05-10T13:22:54.162Z","repository":{"id":116746814,"uuid":"310278700","full_name":"utkarsh2102/packlog","owner":"utkarsh2102","description":"A kernel module that logs all your incoming packets.","archived":false,"fork":false,"pushed_at":"2020-11-09T16:41:17.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-13T14:53:08.495Z","etag":null,"topics":["kernel","module","packets"],"latest_commit_sha":null,"homepage":"","language":"C","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/utkarsh2102.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,"publiccode":null,"codemeta":null}},"created_at":"2020-11-05T11:31:08.000Z","updated_at":"2021-04-17T19:46:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"8304572a-8576-4d9a-ab70-9008e107be86","html_url":"https://github.com/utkarsh2102/packlog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utkarsh2102%2Fpacklog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utkarsh2102%2Fpacklog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utkarsh2102%2Fpacklog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utkarsh2102%2Fpacklog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/utkarsh2102","download_url":"https://codeload.github.com/utkarsh2102/packlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241602069,"owners_count":19989066,"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":["kernel","module","packets"],"created_at":"2024-11-14T00:43:07.197Z","updated_at":"2026-05-10T13:22:49.123Z","avatar_url":"https://github.com/utkarsh2102.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## packlog: Log your Packets! \\o/\n\n`packlog` is a simple kernel module that will log all your incoming packets, one-by-one. What for? Nothing, but fun!  \nWith this, you can see how many packets are being transferred when you make a simple HTTP(S) request, or even otherwise.\n\n---\n\n## Compiling\n\nWell, we use `make` for compiling, so that's something your system should have.  \nMaybe you'll also need the `build-essential` package, which is readily available to install via your package manager.\n\n- So, clone the repository:\n    ```bash\n    $ git clone https://github.com/utkarsh2102/packlog\n    ```\n\n- Run make to compile the source.\n    ```bash\n    $ make\n    ```\n\nAnd there you go! Done!  \nYou'll see a bunch of binaries and files generated by this. And the only thing we're interested in is `packlog.ko`.\n\nFrom [StackOverflow](https://stackoverflow.com/a/10477109),\n\u003e The **.ko** file is your object file linked with some kernel automatically generated data structures that are needed by the kernel.\n\n---\n\n## Using\n\nNow since we have `packlog.ko` ready, let's use it!\n\n- Insert the compiled kernel module:\n    ```bash\n    $ sudo insmod packlog.ko\n    ```\n\n- Now that the module is initialized, let's see the incoming packets:\n    ```bash\n    $ sudo dmesg | tail\n    ```\n\n- At this point, you'll see some packets already have started to get logged. Let's make an HTTP request now and see what happens. Open Firefox and open any site, or type the following in another terminal:\n    ```bash\n    $ firefox utkarsh2102.com\n    ```\n    You'll see a spike in the number of packets. Obviously, eh? But fun, isn't it? But can you guess why the number of packets keeps increasing? Which packets are these? Any idea? ^.^\n\n- Anyway, now that fun time's over, let's remove the inserted module:\n    ```bash\n    $ sudo rmmod packlog\n    ```\n\n- Finally, check the `dmesg` logs to ensure that the module has been removed:\n    ```bash\n    $ sudo dmesg | tail\n    ```\n\n---\n\n## DIY Time\n\nWant to do something fun? Let's drop all the incoming packets. What do you think will happen?\n\nLet's find out!\n\n- Step 1: In the `tmp_hook` function in `packlog.c`, change `NF_ACCEPT` to `NF_DROP`. Or use the following command:\n    ``` bash\n    $ sed -i 's/NF_ACCEPT/NF_DROP/g' packlog.c\n    ```\n\n- Step 2: Recompile.\n    ```bash\n    $ make\n    ```\n\n- Step 3: Re-insert the compiled module.\n    ```bash\n    $ sudo insmod packlog.ko\n    ```\n\n- Step 4: Ensure that the module has been initialized.\n    ```bash\n    $ sudo dmesg | tail\n    ```\n\n- Step 5: Shoot up your browser and try to access any site.  \n  What happens? Does it work as usual? Why? Why not? What do you think? ^_^\n\n- Step 6: Okay, great stuff. But let's go back to our sane life.\n    ```bash\n    $ sudo rmmod packlog\n    ```\n\n- Step 7: Lastly, ensure that the module has indeed been removed.\n    ```bash\n    $ sudo dmesg | tail\n    ```\n\n---\n\n## Copyright and Credits\n\nOpen-sourced under the [MIT License](https://github.com/utkarsh2102/packlog/blob/master/LICENSE).  \nWhilst this has been written from scratch but thanks to Julia Evans, Reuven Plevinsky, and Haoyuan Ge for some of their articles and explanations on some of the related topics.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futkarsh2102%2Fpacklog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Futkarsh2102%2Fpacklog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futkarsh2102%2Fpacklog/lists"}