Net::Packet::Env - environment object used for frame capture/injection
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";
Basically, this module is used to tell where to inject a frame, and how to capture a frame.
The device on which frames will be injected/captured.
The MAC address used to build injected frames.
The IPv4 address used to build injected frames.
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.
The Net::Packet::Desc object used to inject frames to network.
The Net::Packet::Dump object used to receive frames from network.
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.
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.
The environment debug directive. Set it to a number greater than 0 to increase the level of debug messages. Up to 3, default 0.
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.
See Net::Packet::Utils for more about auto* sub routines.
Patrice <GomoR> Auffret
Copyright (c) 2004-2005, Patrice <GomoR> Auffret
You may distribute this module under the terms of the Artistic license. See Copying file in the source distribution archive.