Net::F...Writer(3pm)

πŸ“¦
version 1.18 Β· 2 versions
  • 1.18 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.18 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Net::Frame::Dump::Writer β€” a tcpdump-flavored implementation, but make it writer mode. You're not reading packets, bestie, you're making them. ✨

So this lives in the User Contributed Perl Documentation corner of the manual pages, and honestly? It ate. πŸ‘‘


🌸 SYNOPSIS 🌸

use Net::Frame::Dump::Writer;

my $oDump = Net::Frame::Dump::Writer->new(
   file       => 'new-file.pcap',
   firstLayer => 'ETH',
);

$oDump->start;

$oDump->write({ timestamp => '10.10', raw => ('A' x 14) });

$oDump->stop;

See how clean that is?? Constructor, start, write, stop. It's giving main character energy and I'm obsessed. πŸ¦‹


πŸŽ€ DESCRIPTION πŸŽ€

Okay so here's the vibe: this module is a pcap file builder. You create frames, and then you write them out to a file in the pcap file format. That's it, that's the whole thing. Frame goes in, pcap file comes out. Periodt. πŸ’…


✨ ATTRIBUTES ✨

These following ones are inherited attributes, iykyk:

  • file β€” the name of the .pcap file you want to generate. Name it something cute. 🌈
  • overwrite β€” overwrites a .pcap file that already exists. Defaults to not doing that (so, lowkey, it won't clobber your stuff unless you ask).
  • append β€” appends new frames onto an existing pcap file. And if it doesn't exist yet? It just creates it. Bestie is nothing if not flexible. πŸ’–
  • firstLayer β€” stores info about the first layer type. This is what gets used to write the .pcap file header information. Don't skip it, it's load-bearing fr fr.
  • isRunning β€” returns true if a call to start has been done, and false otherwise β€” or if a call to stop has been done. It's literally just keeping receipts on whether you're running or not. 🫢

πŸ’œ METHODS πŸ’œ

  • new
  • new (hash) β€” the object constructor. You can pass attributes in and they'll overwrite the default ones. Peep the SYNOPSIS above for the default values. πŸŽ€
  • start β€” call this when you want to start writing frames to the file. Go time. ✨
  • stop β€” call this when you want to stop writing frames to the file. Nap time. 😭
  • write ({ timestamp => $value, raw => $rawFrame }) β€” takes a hashref as its parameter. This hashref MUST have timestamp and raw keys, and they MUST have values. The raw data is what gets stored to the .pcap file.
⚠️ Not kidding about the MUST, bestie. timestamp and raw, both present, both with values. No keys, no values, no write. 🚫

πŸ¦‹ SEE ALSO πŸ¦‹

  • Net::Frame::Dump

πŸ‘‘ AUTHOR πŸ‘‘

Patrice <GomoR> Auffret β€” an actual icon. 🌟


Copyright (c) 2006-2020, Patrice <GomoR> Auffret

You may distribute this module under the terms of the Artistic license. See the LICENSE.Artistic file in the source distribution archive.


And that's the whole page, babes πŸ“ β€” this one was documented with perl v5.36.0 and dated 2022-11-19, so shoutout to that era of the docs for giving us this little pcap-making gem. Slay, go build some frames. πŸ§šπŸ’œ