Nmap Announce mailing list archives

My new perl module... comments please


From: dave-mlist () bfnet com
Date: 05 Jan 1999 12:55:31 -0800

OK nmap hackers,

I've been brewing a replacement for tkined that has all the features
of strobe, nmap, sniffit, satan, and all those other probes out there.
I'm calling it "Net::Probe", and I've only got the rudiments done.  It
is not even alpha level yet.  The user interface looks something like
the following.  Please give me feedback of ways you would improve the
interface.

The following program doesn't actually work --- for one thing, there
are no output formatting niceties.  But I think it gives a good
picture of the way the module can be used.

When this module is done, and it is integrated with gnome, it should
be flexible enough to build all manner of custom network management
workstations that are far more powerful than anything Visio or Network
Associates produces.  I haven't worked SNMP or RMON or exploits into
the interface yet.  Let me know if you have suggestions.

Thanks,
Dave

#!/usr/local/bin/perl -w
#       -*- Perl -*-            demo:   Demonstrate the Net::Probe perl module
#
#       (usage)% demo
#
#       David Wuertele  Tue Jan  5 00:45:38 1999        Steal This Program!!!

use Net::Probe;

# A probe is a cache of network entity information that can update
# that information on request.
# use Data::Dumper for saving and loading the cache

my $probe = new Net::Probe;
$probe->save ("/path/to/file");
$probe->load ("/path/to/file");

# an interface is a NIC in a host with an address in a domain on a subnet,
# optionally with a hostname, optionally listening to ports
# the first time $probe->interface is called, it performs the actual probe.
# Thereafter, you have to use the "-update" flag to indicate that you want 
# newly probed information as opposed to cached information.

my $interface = $probe->interface (-address => '204.71.200.66');
my $another_interface = $probe->interface (-hostname => 'www2.yahoo.com');

print $interface->NIC;
print $interface->MAC;
print $interface->address;
print $interface->hostname if defined $interface->hostname;
print $interface->domain->name;
print $interface->host->cpu;
print $interface->subnet->mask;
print $interface->ports if defined $interface->ports;
print $interface->round_trip_time;
print $interface->whois_registration;

# A route is a list of interfaces

my @route = $interface->route_from ($another_interface);
my @other_route = $interface->route_to ($another_interface);

# Here's how to implement a simple traceroute
print map { $i++, ": ", $_->hostname, " (", $_->address, ") ", $_->round_trip_time, "\n" } @route

# a domain is a name registered with the internic with an admin, tech,
# and billing contact, allocated a set of addresses, optionally
# configured to interfaces
# use the Net::DNS and Net::Whois modules for the back end of this

my $domain = $interface->domain;

print $domain->name;
print $domain->ns;
print $domain->billing_contact;
print $domain->admin_contact;
print $domain->tech_contact;
print $domain->mx;
print $domain->addresses;
print map { $_->interface->subnet->mask if defined $_->interface } $domain->addresses;

# a host is one or more interfaces with a hardware platform and an OS
# running applications (a router is a host with at least two
# interfaces)
# Here's where footprinting and strobe comes in.

my $host = $interface->host;

print $host->cpu;
print $host->bios;
print $host->OS;
print $host->OS->footprint;
print $host->open_ports;
print $host->applications;
print map { $_->address } $host->interfaces;

# a subnet is a collection of interfaces tied by some cable and
# optionally a bridge (hub switch or whatever).  Use the Net::Netmask
# module for this.  implement ICMP interface subnet query

my $subnet = $interface->subnet;

print $subnet->base;
print $subnet->mask;
print $subnet->hostmask;
print $subnet->bits;
print $subnet->size;
print $subnet->maxblock;
print $subnet->broadcast;
print $subnet->next;

# a network is a collection of hosts tied by subnets (and "routers=hosts")
# We can monitor the probe's network using the yet-to-be-invented
# gtk mapping of Net::Probe

$probe->monitor;


Current thread: