Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How to parse SNMP traps from pcap file

by ig (Vicar)
on Jun 14, 2011 at 19:57 UTC ( #909633=note: print w/ replies, xml ) Need Help??


in reply to How to parse SNMP traps from pcap file

If you have a look in Net::SNMP or maybe Mon::SNMP you can see how they are parsing the packets from the network.


Comment on Re: How to parse SNMP traps from pcap file
Re^2: How to parse SNMP traps from pcap file
by dalbaranster (Initiate) on Jun 14, 2011 at 20:38 UTC

    Thatīs exactly Iīm trying to do, but I donīt know how to send the extracted payload from the packets that I get from the object Net::Frame::Simple and use it as input to the buffer in the Mon::SNMP module

    From my code I have in $f the extracted package

    print $f->print."\n";

    how can I just "isolate" this part

    o Frame number: 41 (length: 401) ETH: dst:d8:d3:85:de:85:68 src:78:e7:d1:56:f7:a0 type:0x0800 IPv4: version:4 hlen:5 tos:0x00 length:387 id:0 IPv4: flags:0x02 offset:0 ttl:64 protocol:0x11 checksum:0xd8ee IPv4: src:172.19.4.58 dst:172.19.4.27 UDP: src:41665 dst:162 length:367 checksum:0x9443
    UDP: payload:3082016302010104066573796d6163a782015402041560ae2702010002010030820144301006082b0601020101030043040cd6aeed3019060a2b060106030101040100060b2b060104015e07010300023028060c2b060104015e07010402010204184950444f4d2d312f49504e452d392f49504e4549462d31363012060c2b060104015e0701040201010202062f3018060c2b060104015e070104020103040807da090d0f2a20013013060c2b060104015e070104020104020301e271302c060c2b060104015e070104020105041c504f5254204f5220494e5445524641434520484153204641494c45443011060c2b060104015e070104020106020105302c060c2b060104015e070104020107041c506f7274206f7220696e7465726661636520686173206661696c65643012060c2b060104015e0701040201080202013b3011060c2b060104015e0701040201090201043012060c2b060104015e07010402010a02020b51

    and use it as the value in the $snmptrap

    $trap->buffer($snmptrap);

    My apologies if this looks easy, but Iīm still trying to understand how use this modules on my project.

      The UDP packet payload is available as binary data:

      my $payload = $f->ref->{UDP}->payload;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://909633]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (17)
As of 2015-07-07 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (89 votes), past polls