lemontree55 / packetgen

Ruby library to easily generate and capture network packets
MIT License
98 stars 13 forks source link

Capture Syntax in README #51

Closed picatz closed 7 years ago

picatz commented 7 years ago

Hey Sylvain, hope you're doing well!

I felt the need to mess around with packetgen some more this weekend. I really like this project and I use it quite often!

As a side note: I'm sort of curious to try and translate the programming logic from this gem to the Crystal programming language. If you haven't heard of that project, I think you should check it out!

README

Anyway, I decided to go through the README examples for capturing packets and noticed this:

Old Capture Syntax

This example is found in the README:

packets = PacketGen.capture('eth0', max: 10)
# => ArgumentError: wrong number of arguments (given 2, expected 0..1)
# from /Users/kentgruber/.rvm/gems/ruby-2.4.1/gems/packetgen-1.4.3/lib/packetgen.rb:45:in `capture'

New Capture Syntax

To get it to work, need to use the new capture syntax:

packets = PacketGen.capture(iface: 'eth0', max: 10)

Let me know if you can re-produce this problem / let me know that I'm using the API wrong. It should be a pretty easy fix to update the README to include the newer syntax if that is the main problem. I do suspect some sort of error checking could be improved, just not entirely sure where yet.

sdaubert commented 7 years ago

Fixed in 1a00dde. Documentation was not updated. Thanks.

picatz commented 7 years ago

Sweet 👍