in reply to Re: Net::Libdnet 0.01 does not work under Window 7
in thread Net::Libdnet 0.01 does not work under Window 7

I really need Net::Frame::Device (Net::Frame). In my script, a following constuct cannot work with Net::Libdnet 0.01 :

print "$^O\n"; my $oDevice = Net::Frame::Device->new(dev => '...');

Error message with Net::Libdnet 0.01 under Win7:

MSWin32 Net::Frame::Device: updateFromDev: unable to get dnet

I need interfaces access in perl script with either Net::Frame::Device or Net::Packet. It's already clear that the interfaces concept (names and types of WiFi interfaces e.g.) is changed in Win7 compared to old WinXP. That is why Net::Libdnet 0.01 functions fine under WinXP, but cannot not work under Win7.

I successfully used Net::Packet in WinXP and would like to migrate it to Win7. My central issue under Win7 is Libdnet and not really Net::Packet or Net::Frame. I know what is wrong with Net::Libdnet 0.01 under Win7, but this knowledge does not bring me to the needed solution. Aproved and straightforward howto's to solve the described Libdnet (Win7) problem are much appreciated.

Replies are listed 'Best First'.
Re^3: Net::Libdnet 0.01 does not work under Window 7
by stevieb (Canon) on Jan 17, 2016 at 00:37 UTC
    "I know what is wrong with Net::Libdnet 0.01 under Win7"

    If that's the case, either fix it, or test the advice of VinsWorldcom in Re: Net::Libdnet 0.01 does not work under Window 7, and see if that helps.

    The module you speak of seems to have had a history of test failures, so when someone gives you workable advice, why not test it instead of arguing?

    If it's a case of using another script within a script, there are options... system and backticks (see IO Operators in perlop).

Re^3: Net::Libdnet 0.01 does not work under Window 7
by VinsWorldcom (Prior) on Jan 17, 2016 at 00:28 UTC

    Again, I'll recommend PPC from my previous post. It accesses Windows interfaces using Net::Pcap and a custom module Win32::Interfaces which isn't on CPAN. Ive tried to emulate many of the accessor's from *nix only interface modules including Net::Libdnet, which I spent many a sleepless night and many conversations with the developer (Gomor, who is very responsive and helpful) trying to get working on Win7 x64 to no avail so just rolled my own (Win32::Interfaces) to work with the Net::Frame suite.

    https://github.com/vinsworldcom/PPC

      Can you please post a working snippet with Win32::Interfaces (PPC) instead of $oDevice = Net::Frame::Device->new(dev => '...') ? For my ready-made automatical scripts, it is not reasonable to use interactive mode with PPC. Whilst we cannot get the needed interfaces structures (hashes) via Net::Libdnet in Win7, we cannot normally use all the functionality of old Net::Packet and Net::Frame based scripts under Win7 (or newer). I had written some useful perl apps based on Net::Packet / Net::Frame under WinXP. Now, I am looking for a method to "repair" Net::Libdnet in Win7 in order to use these apps further, in current Windows. However, when your "wrapper module" for Net::Frame will be installable via CPAN, I would like to try it. Thank you!

        You may have to consider - as I did - *not* repairing Net::Libdnet; rather, rewriting some of your scripts to accommodate. Perhaps not ideal, but better than pushing water uphill. Since I'm not an expert coder and my efforts to get Net::Libdnet working didn't work - it was my only option.

        Win32::Interfaces is in the PPC distribution on GitHub. It wasn't written as a replacement for Net::Libdnet, it was because Net::Libdnet, IO::Interfaces, etc. don't compile / work on Windows. So I took a lot of "functionality" from those modules and emulated it in the accessors for Win32::Interfaces pulling information from 'wmic', 'netsh' and other Windows system commands. It's not elegant, but it works.

        Win32::Interfaces is pure Perl and can be installed "manually" by dropping the Interfaces.pm in your (...)/lib/Win32 folder. It has complete perldoc to get you started.

        NAME Win32::Interfaces - Win32 Network Adapter Interfaces SYNOPSIS use Win32::Interfaces; my $interface = Win32::Interfaces->new('Wireless Network Connect +ion'); printf "Name: %s\n", $interface->name; printf "MAC: %s\n", $interface->mac; printf "IPv4: %s\n", $interface->ipv4; DESCRIPTION Win32::Interfaces is a module to retrieve Windows interface adapte +r information (such as IP[v6] addresses, gateways, MAC, etc...). It +is implemented with system functions such as "wmic", "netsh" and "arp +". A better approach may be to use XS with "GetAdaptersAddresses()" and + parse the "IP_ADAPTER_ADDRESSES" structure. Alas, that is proving diffic +ult to do. This module was developed since I couldn't find an existing CPAN m +odule that handled this information specifically for Windows, let alone +find Win32 support in the many interface modules already on CPAN (see S +EE ALSO). The existing CPAN interface modules also used different API +s so finding a common interface for both Windows and *nix with all the features was not possible. This modules attempts to provide many of the API calls from *nix interface modules specifically to Win32. [...]

        And a pretty extensive demonstration:

        use strict; use warnings; use Win32::Interfaces; # Assumes the existence of "Local Area Connection" interface as defaul +t my $W32interfaces = Win32::Interfaces->new(); my @interfaces = $W32interfaces->interfaces(); for my $if (@interfaces) { my $interface = $W32interfaces->interface($if); if (!defined($interface)) { print Win32::Interfaces->error . "\n" } else { print "\n"; printf "Name: %s\n", $interface->name + if $interface->name; printf "Description: %s\n", $interface->description + if $interface->description; printf "Adapter: %s\n", $interface->adaptername + if $interface->adaptername; printf "Device: %s\n", $interface->device + if $interface->device; printf "ifIndex: %s\n", $interface->ifindex + if $interface->ifindex; printf "MAC: %s\n", $interface->mac + if $interface->mac; printf "IPv4: %s\n", $interface->ipv4 + if $interface->ipv4; printf "IPv4 netmask: %s\n", $interface->ipv4_netmask + if $interface->ipv4_netmask; printf "IPv4 gateway: %s\n", $interface->ipv4_default_gate +way if $interface->ipv4_default_gateway; printf "IPv4 gateway MAC: %s\n", $interface->ipv4_gateway_mac + if $interface->ipv4_gateway_mac; printf "IPv4 MTU: %s\n", $interface->ipv4_mtu + if $interface->ipv4_mtu; printf "IPv6: %s\n", $interface->ipv6 + if $interface->ipv6; printf "IPv6 link-local: %s\n", $interface->ipv6_link_local + if $interface->ipv6_link_local; # printf "IPv6 DHCPv6 IAID: %s\n", $interface->dhcpv6_iaid + if $interface->dhcpv6_iaid; # printf "IPv6 DHCPv6 DUID: %s\n", $interface->dhcpv6_duid + if $interface->dhcpv6_duid; printf "IPv6 gateway: %s\n", $interface->ipv6_default_gate +way if $interface->ipv6_default_gateway; printf "IPv6 gateway MAC: %s\n", $interface->ipv6_gateway_mac + if $interface->ipv6_gateway_mac; printf "IPv6 MTU: %s\n", $interface->ipv6_mtu + if $interface->ipv6_mtu; printf "MTU: %s\n", $interface->mtu + if $interface->mtu; printf "DNS Server %s\n", $interface->dnsserver + if $interface->dnsserver; print "\n"; print $interface->dump; printf "\nDONE - %s\n", $interface->name if $interface->name; } }
Re^3: Net::Libdnet 0.01 does not work under Window 7
by Anonymous Monk on Jan 17, 2016 at 05:08 UTC

    I know what is wrong with Net::Libdnet 0.01 under Win7, but this knowledge does not bring me to the needed solution. Aproved and straightforward howto's to solve the described Libdnet (Win7) problem are much appreciated.

    Can you tell me what is wrong with it under win7?