in reply to Help with Lorcon XS library

Both Net::Lorcon2 and the lorcon library it relies on look very much like abandonware, but on Ubuntu-20.04 I've now built and installed the lorcon library from github and I've also built and installed the Net-Lorcon2-2.03 module from CPAN.

The lorcon library issued a couple of compilation warnings, and neither make check nor make test don't run any tests.
This does not inspire confidence.

However, the Net-Lorcon2-2.03 module from CPAN built cleanly and passed tests, after I had installed a few netlink libraries using the package manager and re-built the lorcon library (which still issued compilation warnings).
NOTE: In addition to the CPAN version of Net-Lorcon2-2.03, there's also a modified version by Bpl.
But I'd like to deal with the CPAN version before I get to Bpl's.

Here is the make test results for Net-Lorcon2-2.03 (from CPAN), perl-5.32.0:
$ make test "/home/sisyphus/perl-5.32.0-d/bin/perl" -MExtUtils::Command::MM -e 'cp +_nonempty' -- Lorcon2.bs blib/arch/auto/Net/Lorcon2/Lorcon2.bs 644 PERL_DL_NONLAZY=1 "/home/sisyphus/perl-5.32.0-d/bin/perl" "-MExtUtils: +:Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; + test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01-use.t ........... ok t/02-init.t .......... skipped: Set LORCON_IF and LORCON_INJ to a vali +d interface and injector name to run these tests t/03-device.t ........ skipped: Set LORCON_IF and LORCON_INJ to a vali +d interface and injector name to run these tests t/04-root.t .......... skipped: Set LORCON_IF and LORCON_INJ to a vali +d interface and injector name and run as root to run these tests t/05-pod-coverage.t .. ok t/06-test-pod.t ...... ok All tests successful. Files=6, Tests=3, 1 wallclock secs ( 0.05 usr 0.01 sys + 0.49 cusr + 0.03 csys = 0.58 CPU) Result: PASS
Before I proceed further, I would like to run those skipped tests.
How do I find valid interface and injector names that I can use ? (I have no idea what they are, and no idea if any exist on this system.)
According to lorcon_list_drivers(), drivers named 'madwifing', 'tuntap' and 'mac80211' were found.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Help with Lorcon XS library
by Bpl (Scribe) on Jul 24, 2020 at 08:32 UTC
    Hi, Think that Lorcon2 can be considered a finished project, not a software with updates, one of the most interesting things that I've found is the possibility to sniff frames from multiple interfaces (already implemented but need testing). In general the Net::Lorcon2 can be an all-in-one perl module, with more features than Net::Pcap ( it uses it, in effect) and a better way of Net::Frame, it would be possible to built only with perl modules but the work would be bigger,maybe in future I'll do that :) Yes, my version is still unstable.. for now try the GomoR version. these interfaces are quite interesting, I'm start thinking that my computer doesn't support lorcon,you know, the tuntap device is an abstraction layer for sending and receiving packets directly from/to other application (they simulate an ethernet connection)
    a good module which offer the tuntap manipulation is Linux::TunTap
    The madwifing is my same driver, and it is considered the last way for sending packets (if the network card can't) while mac80211 is a wireless driver supported by Lorcon (and probably the suggested by the software), so in general it is possible to send infected packet with it. if you see the test you will understand a problem, this:
    if(!$ENV{LORCON_IF} || !$ENV{LORCON_INJ}) { plan skip_all => "Set LORCON_IF and LORCON_INJ to a valid interfac +e and injector name to run these tests # second test
    which means that it require 2 enviroment variables ( probably made by lorcon ), can you please try to inject some packet? if everything works, can you start using also my library? in maximun 1 day you will have the list of new function which I would like to test ( if you haven't enough time don't worry : ) Regards Edoardo small correction you want the drivers, not interface (which is like to wlan0, wlo1, lo ecc..) for find automatic interfaces, I suggest you the Net::Pcap::lookupdev() function from Net::Pcap,which permit you to find the best interface for sniffing.
Re^2: Help with Lorcon XS library
by Bpl (Scribe) on Jul 24, 2020 at 18:24 UTC
    Hi again, finally I found a way for obtaining a "safe script", I added the function drv_madwifing_init from drv_madwfing.h
    use Net::Lorcon2 qw( :subs ); my $drv = Net::Lorcon2::lorcon_find_driver( "madwifing" ); my $Lorcon = Net::Lorcon2::lorcon_create("wlo1", $drv); print drv_madwifing_init($Lorcon); print Net::Lorcon2::lorcon_open_inject($Lorcon);
    It's seem that initializating the madwifing device there is no error ( intended as core dump), the output of the program is 1 and -1, this means that  drv_madwifing_init works, while lorcon_open_inject doesn't and it returns an error value ( still better than a core dump!) Regards Edoardo Mantovani.