Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
... when I tried to call the setInjectMode it produces a core dump (again)

Unfortunately I know as much about Lorcon as AnomalousMonk.
All I'm doing is going from the module's documentation, and the two scripts that ship with the Net-Lorcon2-2.03 source distribution (in the examples folder).
One of those scripts (inject.pl) demonstrates a correct way to call lorcon_open_inject as follows:
use strict; use warnings; my $interface = 'wlan1'; my $driver = 'mac80211'; use Net::Lorcon2 qw(:subs); my $lorcon = Net::Lorcon2->new( interface => $interface, driver => $driver, ); $lorcon->setInjectMode; # Beacon my $packet = "\x80\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x02\x02\xe2 +\xc4\xef\x00\x02\x02\xe2\xc4\xef\xd0\xfe\x37\xe0\xae\x0c\x00\x00\x00\ +x00\x64\x00\x21\x08\x00\x0b\x4e\x65\x74\x3a\x3a\x4c\x6f\x72\x63\x6f\x +6e\x01\x08\x82\x84\x8b\x96\x0c\x12\x18\x24\x03\x01\x0d\x05\x04\x00\x0 +1\x00\x00\x2a\x01\x00\x32\x04\x30\x48\x60\x6c"; while (1) { my $t = $lorcon->sendBytes($packet); if (! $t) { print "[-] Unable to send bytes\n"; exit 1; } print "T: $t\n"; sleep(1); }
(You might want to change the strings that are assigned to $interface and $driver.)
Assuming that works ok for you, my advice would be to just stick with the approaches that you know to work.

Note that the SYNOPSIS section of the documentation in Lorcon2.pm (run perldoc Net::Lorcon2 to view it) mentions 2 ways to writing Net::Lorcon2 code.
Firstly there's "Usage in an OO-way", which involves calling new(). This is the way taken by the code that I've provided in this post.
Secondly there's "Usage with lorcon2 library API", in which new() is not called. This is the way taken by the code I provided in my earlier posts.

It's best to stick to just one of those ways throughout your script. Mixing them together in the same script will likely lead to errors or segfaults.

Also, if you hit a problem, please post the entire script you ran - not just bits of it.
If the script is a large one you should reduce it so that it:
a) still demonstrates the problem you are facing;
b) is as small as possible.
But, for now, while the scripts are quite small, just post them in full.

Cheers,
Rob

In reply to Re^11: Help with Lorcon XS library by syphilis
in thread Help with Lorcon XS library by Bpl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found