NAME

Net::Telnet::Netgear::Packet - generates "telnet enable packets" for Netgear routers

SYNOPSIS

    use Net::Telnet::Netgear::Packet;
    # From a string
    my $packet = Net::Telnet::Netgear::Packet->from_string ('...');
    # From a Base64-encoded string
    my $packet = Net::Telnet::Netgear::Packet->from_base64 ('Li4u');
    # From the MAC address of the router
    my $packet = Net::Telnet::Netgear::Packet->new (
        mac      => 'AA:BB:CC:DD:EE:FF',
        username => 'admin',  # optional
        password => 'hunter2' # optional
    );
    # Gets the packet as a string.
    my $string = $packet->get_packet;

DESCRIPTION

This module allows to generate "telnet enable packets" usable with Netgear routers to unlock the telnet interface.

You can either provide a pre-generated packet from a string or you can let the module generate it with the MAC address of the router. It's also possible to specify the username and password that will be put in the packet.

This module is just a wrapper - the code which handles the packets is in Net::Telnet::Netgear::Packet::Native or Net::Telnet::Netgear::Packet::String, depending on which constructor you use.

METHODS

new

    my $packet = Net::Telnet::Netgear::Packet->new (%options);

Creates a Net::Telnet::Netgear::Packet::Native instance.

%options can be populated with the following items:

  • mac => 'AA:BB:CC:DD:EE'

    The MAC address of your router. This is required.

  • username => 'admin'

    Optional, the username which will be put in the packet. Defaults to Gearguy for compatibility reasons.

  • password => 'hunter2'

    Optional, the password which will be put in the packet. Defaults to Geardog for compatibility reasons.

NOTE: the packet is generated each time "get_packet" is called, so it's recommended to store the returned value in a variable and use that instead of calling the method each time.

from_string

    my $packet = Net::Telnet::Netgear::Packet->from_string ('str');

Creates a Net::Telnet::Netgear::Packet::String instance.

The string has to be 128 bytes, but this check is not enforced.

from_base64

    my $packet = Net::Telnet::Netgear::Packet->from_base64 ('...');

Creates a Net::Telnet::Netgear::Packet::String instance.

The decoded string has to be 128 bytes, but this check is not enforced.

get_packet

    my $packet_str = $packet->get_packet;

Retrieves the generated packet (or the user provided one).

This method must be implemented by the subclasses, and dies if it isn't (or if it is called directly on this class).

SEE ALSO

Net::Telnet::Netgear, http://wiki.openwrt.org/toh/netgear/telnet.console, https://github.com/Robertof/perl-net-telnet-netgear.

AUTHOR

Roberto Frenna (robertof AT cpan DOT org)

THANKS

See "THANKS" in Net::Telnet::Netgear.

LICENSE

Copyright (C) 2014-2015, Roberto Frenna.

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.