# Network packet analyzer

**URL:** <https://forum.elixirforum.com/t/network-packet-analyzer/58077>\
**Category:** Questions\
**Tags:** networking, tcp, udp\
**Created:** [September 4, 2023, 2:00pm UTC](https://forum.elixirforum.com/t/network-packet-analyzer/58077 "2023-09-04T14:00:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RooSoft](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/roosoft/32/23241_2.png) [@RooSoft](https://forum.elixirforum.com/u/RooSoft)\
**Post date:** [September 4, 2023, 2:00pm UTC](https://forum.elixirforum.com/t/network-packet-analyzer/58077/1 "2023-09-04T14:00:36Z")

</div>

Is there an Elixir or Erlang library that can translate a frame of bytes received from the network into some structured data?

I’d like to analyze packet capture frames much like Wireshark can do, in plain Elixir.

---

<div class="post-metadata">

**Author:** ![hauleth](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hauleth/32/18942_2.png) [@hauleth](https://forum.elixirforum.com/u/hauleth)\
**Post date:** [September 4, 2023, 2:11pm UTC](https://forum.elixirforum.com/t/network-packet-analyzer/58077/2 "2023-09-04T14:11:14Z")

</div>

Do you happen to know what will be the format of the packages or you want to decode or you want to do deduction on your own?

I do not know any existing library for that, but with binary pattern matching it would be mostly manual work to do so.

---

<div class="post-metadata">

**Author:** ![RooSoft](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/roosoft/32/23241_2.png) [@RooSoft](https://forum.elixirforum.com/u/RooSoft)\
**Post date:** [September 4, 2023, 2:20pm UTC](https://forum.elixirforum.com/t/network-packet-analyzer/58077/3 "2023-09-04T14:20:45Z")

</div>

Standard TCP, UDP, HTTP, etc… I got it in binary format, exactly as found on the wire, but I got to break it down so it can be analyzed.

I have no idea what library could help after a little research… those packets can be visualized easily with Wireshark, but I want to automate this job with Elixir, so I got to get my hands on the info. Ideally without wireshark itself as a dependency.

---

<div class="post-metadata">

**Author:** ![voltone](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/voltone/32/24672_2.png) [@voltone](https://forum.elixirforum.com/u/voltone)\
**Post date:** [September 4, 2023, 2:24pm UTC](https://forum.elixirforum.com/t/network-packet-analyzer/58077/4 "2023-09-04T14:24:27Z")

</div>

There is [GitHub - msantos/pkt: Erlang network protocol library · GitHub](https://github.com/msantos/pkt) (in Erlang). But you’re never going to match the capabilities of the Wireshark dissectors. Maybe you could execute the Lua-based dissectors using [GitHub - rvirding/luerl: Lua in Erlang · GitHub](https://github.com/rvirding/luerl)

---

<div class="post-metadata">

**Author:** ![LostKobrakai](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/32/3072_2.png) [@LostKobrakai](https://forum.elixirforum.com/u/LostKobrakai)\
**Post date:** [September 4, 2023, 2:24pm UTC](https://forum.elixirforum.com/t/network-packet-analyzer/58077/5 "2023-09-04T14:24:59Z")

</div>

There are layers to the data on the network. E.g. HTTP works on TCP and TCP on IP, so you’d need to be able to unpack those packages from the outside in IP-\>TCP-\>HTTP. You also need to figure out where packet boundaries are if you’d don’t know the data you have starts at a packet boundary.

---

<div class="post-metadata">

**Author:** ![RooSoft](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/roosoft/32/23241_2.png) [@RooSoft](https://forum.elixirforum.com/u/RooSoft)\
**Post date:** [September 4, 2023, 2:27pm UTC](https://forum.elixirforum.com/t/network-packet-analyzer/58077/6 "2023-09-04T14:27:45Z")

</div>

I got to be able to play with most of this, lower level protocols being the most important.

---

<div class="post-metadata">

**Author:** ![RooSoft](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/roosoft/32/23241_2.png) [@RooSoft](https://forum.elixirforum.com/u/RooSoft)\
**Post date:** [September 4, 2023, 2:28pm UTC](https://forum.elixirforum.com/t/network-packet-analyzer/58077/7 "2023-09-04T14:28:16Z")

</div>

[GitHub - msantos/pkt: Erlang network protocol library · GitHub](https://github.com/msantos/pkt) is a great starting point, thanks @voltone!

---

<div class="post-metadata">

**Author:** ![hst337](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/h/41988e/32.png) [@hst337](https://forum.elixirforum.com/u/hst337)\
**Post date:** [September 4, 2023, 4:31pm UTC](https://forum.elixirforum.com/t/network-packet-analyzer/58077/8 "2023-09-04T16:31:58Z")

</div>

> [@RooSoft](#):
>
> Is there an Elixir or Erlang library that can translate a frame of bytes received from the network into some structured data?

procket
