{"id":19892591,"url":"https://github.com/compscidr/packetdumper","last_synced_at":"2025-05-02T18:31:48.368Z","repository":{"id":252152328,"uuid":"839553324","full_name":"compscidr/packetdumper","owner":"compscidr","description":"A kotlin / android compatible buffer / packet dumper which can output pcapng files, hex files, strings, and logging compatible with wireshark import, and a tcp server which serves wiresharp pcapng dumps live","archived":false,"fork":false,"pushed_at":"2025-04-23T17:33:12.000Z","size":524,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T19:29:43.787Z","etag":null,"topics":["buffers","dumper","hacktoberfest","kotlin","packets","pcap","pcapng","pcapng-decoder","pcapng-files","wireshark"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/compscidr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-08-07T21:11:17.000Z","updated_at":"2025-04-22T00:58:00.000Z","dependencies_parsed_at":"2024-10-26T03:12:14.801Z","dependency_job_id":"0932e0a9-54fc-47a4-ad5b-a9dc7982c369","html_url":"https://github.com/compscidr/packetdumper","commit_stats":null,"previous_names":["compscidr/packetdumper"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compscidr%2Fpacketdumper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compscidr%2Fpacketdumper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compscidr%2Fpacketdumper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compscidr%2Fpacketdumper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compscidr","download_url":"https://codeload.github.com/compscidr/packetdumper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252088596,"owners_count":21692824,"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":["buffers","dumper","hacktoberfest","kotlin","packets","pcap","pcapng","pcapng-decoder","pcapng-files","wireshark"],"created_at":"2024-11-12T18:24:19.865Z","updated_at":"2025-05-02T18:31:45.118Z","avatar_url":"https://github.com/compscidr.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# packetdumper\n[![Maven Central](https://img.shields.io/maven-central/v/com.jasonernst.packetdumper/packetdumper?style=flat\u0026logo=maven\u0026label=maven-central\u0026color=blue)](https://central.sonatype.com/artifact/com.jasonernst.packetdumper/packetdumper/overview)\n[![codecov](https://codecov.io/gh/compscidr/packetdumper/graph/badge.svg?token=MZjRWQKz26)](https://codecov.io/gh/compscidr/packetdumper)\n\nA kotlin / android compatible buffer / packet dumper.\n\n## Usage\nAdd the dependency to your project:\n```\nimplementation(\"com.jasonernst.packetdumper:packetdumper:\u003cversion\u003e\")\n```\n\n### pcapng tcp server\nThis will start a TCP server on port 19000 that will accept connections from wireshark as follows:\n\n`wireshark -k -i TCP@\u003cip\u003e:19000`\n\n```kotlin\nval dumper = PcapNgTcpServerPacketDumper()\ndumper.start()\nval buffer = ByteBuffer.wrap(byteArrayOf(0x01, 0x02, 0x03, 0x04))\ndumper.dumpBuffer(buffer, 0, buffer.limit(), false, null)\n\n//    ...\n\ndumper.stop()\n```\n\n### pcapng file\nNote that the file will actually be created with timestamps in the filename so that multiple runs\nwill not overwrite each other.\n```kotlin\nval dumper = PcapNgFilePacketDumper(\"/tmp\", \"test\", \"pcapng\")\ndumper.open()\nval buffer = ByteBuffer.wrap(byteArrayOf(0x01, 0x02, 0x03, 0x04))\ndumper.dumpBuffer(buffer, 0, buffer.limit(), false, null)\ndumper.close()\n```\n\n### hexdump to file\nThe following will dump in a format which is compatible with a wireshark hexdump import.\nThis assumes that the buffer contains an ipv4 packet. If your buffer has an ethernet frame already\njust leave this as null. \n```kotlin\nval dumper = TextFilePacketDumper(\"/tmp\", \"test\", \"txt\")\ndumper.open()\nval buffer = ByteBuffer.wrap(byteArrayOf(0x01, 0x02, 0x03, 0x04))\ndumper.dumpBuffer(buffer, 0, buffer.limit(), true, EtherType.IPv4)\ndumper.close()\n```\n\n### hexdump to stdout\n```kotlin\nval dumper = StringPacketDumper(writeToStdOut = true)\nval buffer = ByteBuffer.wrap(byteArrayOf(0x01, 0x02, 0x03, 0x04))\ndumper.dumpBuffer(buffer, 0, buffer.limit(), true, EtherType.IPv4)\n```\n\n### hexdump to slf4j logger\nThis will log at the info level to the slf4j logger provided.\n```kotlin\nval logger = LoggerFactor.getLogger(\"somelogger\")\nval dumper = StringPacketDumper(logger)\nval buffer = ByteBuffer.wrap(byteArrayOf(0x01, 0x02, 0x03, 0x04))\ndumper.dumpBuffer(buffer, 0, buffer.limit(), true, EtherType.IPv4)\n```\n\n### hexdump to string\n```kotlin\nval dumper = StringPacketDumper()\nval buffer = ByteBuffer.wrap(byteArrayOf(0x01, 0x02, 0x03, 0x04))\nval hexString = dumper.dumpBufferToString(buffer, 0, buffer.limit(), true, EtherType.IPv4)\nprintln(hexString)\n```\n\n## TODO\n- [ ] Support options for pcap blocks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompscidr%2Fpacketdumper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompscidr%2Fpacketdumper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompscidr%2Fpacketdumper/lists"}