NAME

Net::Lorcon2 - Raw wireless packet injection using the Lorcon2 library

SYNOPSIS

  use Net::Lorcon2 qw(:subs);

  my $if     = "wlan0";
  my $driver = "mac80211";
  my $packet = "G"x100;

  #
  # Usage in an OO-way
  #

  my $lorcon = Net::Lorcon2->new(
     interface => $if,
     driver    => $driver,
  );

  $lorcon->setInjectMode;

  my $t = $lorcon->sendBytes($packet);
  if (! $t) {
     print "[-] Unable to send bytes\n";
     exit 1;
  }

  #
  # Usage with lorcon2 library API
  #

  my $drv = lorcon_find_driver($driver);
  if (! $drv) {
     print STDERR "[-] Unable to find DRV for [$driver]\n";
     exit 1;
  }

  my $lorcon = lorcon_create($if, $drv);
  if (! $lorcon) {
    print STDERR "[-] lorcon_create failed\n";
    exit 1;
  }

  my $r = lorcon_open_inject($lorcon);
  if ($r == -1) {
    print STDERR "[-] lorcon_open_inject: ".lorcon_get_error($lorcon)."\n";
    exit 1;
  }

  my $t = lorcon_send_bytes($lorcon, length($packet), $packet);
  print "T: $t\n";

DESCRIPTION

This module enables raw 802.11 packet injection provided you have a Wi-Fi card supported by Lorcon2.

Lorcon2 can be obtained from http://802.11ninja.net/svn/lorcon/.

This version has been tested against the following revision:

http://802.11ninja.net/svn/lorcon/tags/lorcon2-200911-rc1

FUNCTIONS

lorcon_add_wepkey
lorcon_auto_driver
lorcon_close
lorcon_create
lorcon_find_driver
lorcon_free
lorcon_free_driver_list
lorcon_get_capiface
lorcon_get_channel
lorcon_get_driver_name
lorcon_get_error
lorcon_get_selectable_fd
lorcon_get_timeout
lorcon_get_vap
lorcon_get_version
lorcon_inject
lorcon_list_drivers
lorcon_open_inject
lorcon_open_injmon
lorcon_open_monitor
lorcon_send_bytes
lorcon_set_channel
lorcon_set_filter
lorcon_set_timeout
lorcon_set_vap

METHODS

new(device, driver)

Constructs a new Net::Lorcon2 object. device is the name of the device to use for packet injection. driver is the driver to use (one of the names returned from getcardlist)

setInjectMode ()

Sets the inject mode for the card.

sendBytes (data)

Send raw data in the air.

CONSTANTS

Load them: use Net::Lorcon2 qw(:consts);

LORCON_EGENERIC
LORCON_ENOTSUPP

SEE ALSO

lorcon2(7), 802.11 Wireless Networks by Matthew Gast.

AUTHOR

Patrice <GomoR> Auffret, <gomor at cpan dot org> (current maintainer and developper of Net::Lorcon2)

David Leadbeater, <dgl at dgl dot cx> (original author)

COPYRIGHT AND LICENSE

Copyright (C) 2010-2015 by Patrice <GomoR> Auffret

Copyright (C) 2007-2008 by David Leadbeater and Patrice <GomoR> Auffret

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.