NAME

Net::Packet::Env - environment object used for frame capture/injection

SYNOPSIS

use Net::Packet::Env;

# Get default values from system
my $env = Net::Packet::Env->new;

# Get values from a specific device
my $env2 = Net::Packet::Env->new(dev => 'vmnet1');

print "dev: ", $env->dev, "\n";
print "mac: ", $env->mac, "\n";
print "ip : ", $env->ip,  "\n" if $env->ip;
print "ip6: ", $env->ip6, "\n" if $env->ip6;
print "promisc: ", $env->promisc, "\n";

DESCRIPTION

Basically, this module is used to tell where to inject a frame, and how to capture a frame.

ATTRIBUTES

dev

The device on which frames will be injected/captured.

mac

The MAC address used to build injected frames.

ip

The IPv4 address used to build injected frames.

ip6

The IPv6 address used to build injected frames.

The link type of the capturing process (see Net::Packet::Dump). It will be set automatically when a capturing device is open. Usually used internally.

desc

The Net::Packet::Desc object used to inject frames to network.

dump

The Net::Packet::Dump object used to receive frames from network.

promisc

This one is used to tell the tcpdump-like process (see Net::Packet::Dump) to go into promiscuous mode or not. Note: the device may be already in promiscuous mode, so even when you set it to 0, you may be in the situation to capture in promiscuous mode.

filter

When set, the pcap filter that'll be used for packet captures will be this one. It must be manually set if you want this feature. Default is to capture all traffic.

debug

The environment debug directive. Set it to a number greater than 0 to increase the level of debug messages. Up to 3, default 0.

METHODS

new

Object constructor. You can pass attributes that will overwrite default ones. Default values:

dev: autoDev() - the one tcpdump get without -i parameter.

mac: autoMac() - from dev, MAC address the default device has.

ip: autoIp() - from dev, IPv4 address the default device has.

ip6: autoIp6() - from dev, IPv6 address the default device has.

promisc: 0

link: undef

See Net::Packet::Utils for more about auto* sub routines.

AUTHOR

Patrice <GomoR> Auffret

COPYRIGHT AND LICENSE

Copyright (c) 2004-2006, Patrice <GomoR> Auffret

You may distribute this module under the terms of the Artistic license. See Copying file in the source distribution archive.

RELATED MODULES

NetPacket, Net::RawIP, Net::RawSock