aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2012-02-07 04:17:54 +0800
committerdougb <dougb@FreeBSD.org>2012-02-07 04:17:54 +0800
commit56d12922c387f540433adea98bc7c27c11b381aa (patch)
tree00c2a98b5e104b022967a6a20da47648fa87e783 /net-mgmt
parent55956ba656edc97230ddf3491654f10fa993fe50 (diff)
downloadfreebsd-ports-gnome-56d12922c387f540433adea98bc7c27c11b381aa.tar.gz
freebsd-ports-gnome-56d12922c387f540433adea98bc7c27c11b381aa.tar.zst
freebsd-ports-gnome-56d12922c387f540433adea98bc7c27c11b381aa.zip
Hawk is a web based utility for monitoring and comparing hosts on your
network with what is in DNS. Hosts that are answering pings but are not in DNS may be unauthorized, and addresses in DNS which are not answering may be able to be reclaimed. Hawk monitors all hosts on the networks you specify and lets you view them via a web page. Hawk consists of a backend written in Perl that monitors hosts by ICMP pings and writes the status to a mysql database. The frontend is in PHP and lets you select which network to view, and how to view it. This version has several enhancements to the original; including cleaner Perl code, a user-definable string to designate unused addresses that are in DNS, testing that the forward and reverse hostnames match, and the daemon forks one process pre subnet. WWW: http://sourceforge.net/projects/iphawk/
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/Makefile1
-rw-r--r--net-mgmt/hawk/Makefile71
-rw-r--r--net-mgmt/hawk/distinfo2
-rw-r--r--net-mgmt/hawk/files/create_hawk_db.sql14
-rw-r--r--net-mgmt/hawk/files/create_hawk_user.sql8
-rw-r--r--net-mgmt/hawk/files/favicon.icobin0 -> 9326 bytes
-rw-r--r--net-mgmt/hawk/files/hawk.in41
-rw-r--r--net-mgmt/hawk/files/patch-daemon__hawk217
-rw-r--r--net-mgmt/hawk/files/patch-php__hawk.conf.inc26
-rw-r--r--net-mgmt/hawk/files/patch-php__hawk.php165
-rw-r--r--net-mgmt/hawk/pkg-descr16
-rw-r--r--net-mgmt/hawk/pkg-plist20
12 files changed, 581 insertions, 0 deletions
diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index 9de246bb342b..2eac50768c98 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -81,6 +81,7 @@
SUBDIR += grepip
SUBDIR += gsnmp
SUBDIR += hastmon
+ SUBDIR += hawk
SUBDIR += horde-nic
SUBDIR += icinga
SUBDIR += icmpmonitor
diff --git a/net-mgmt/hawk/Makefile b/net-mgmt/hawk/Makefile
new file mode 100644
index 000000000000..abe582c759b3
--- /dev/null
+++ b/net-mgmt/hawk/Makefile
@@ -0,0 +1,71 @@
+# New ports collection makefile for: hawk
+# Date created: 06 February 2012
+# Whom: Doug Barton <dougb@FreeBSD.org>
+#
+# $FreeBSD$
+
+PORTNAME= hawk
+PORTVERSION= 0.6
+PORTREVISION= 1
+CATEGORIES= net-mgmt
+MASTER_SITES= SF/iphawk/iphawk/Hawk%20${PORTVERSION}/
+
+MAINTAINER= dougb@FreeBSD.org
+COMMENT= Track uptime and DNS status for machines on your networks
+
+RUN_DEPENDS= ${SITE_PERL}/Net/Netmask.pm:${PORTSDIR}/net-mgmt/p5-Net-Netmask \
+ ${SITE_PERL}/Net/Ping/External.pm:${PORTSDIR}/net/p5-Net-Ping-External \
+ ${SITE_PERL}/${PERL_ARCH}/DBI.pm:${PORTSDIR}/databases/p5-DBI \
+ ${SITE_PERL}/${PERL_ARCH}/DBD/mysql.pm:${PORTSDIR}/databases/p5-DBD-mysql
+
+USE_PERL5= yes
+USE_MYSQL= server
+USE_PHP= mysql
+WANT_PHP_MOD= yes
+
+USE_RC_SUBR= hawk
+
+SUB_LIST= PERL=${PERL}
+PLIST_SUB+= WWWDIR_REL="${WWWDIR_REL}"
+
+post-patch:
+ @${SED} -e 's#%%PREFIX%%#${PREFIX}#' \
+ ${WRKSRC}/daemon/hawk > ${WRKSRC}/daemon/hawk.sed
+ @${MV} ${WRKSRC}/daemon/hawk.sed ${WRKSRC}/daemon/hawk
+ @${SED} -e 's#hawk.conf.inc#${PREFIX}/etc/hawk/php.conf#' \
+ ${WRKSRC}/php/hawk.php > ${WRKSRC}/php/hawk.php.sed
+ @${MV} ${WRKSRC}/php/hawk.php.sed ${WRKSRC}/php/hawk.php
+
+do-build:
+# Empty target, nothing to build
+
+do-install:
+ ${MKDIR} ${PREFIX}/etc/hawk
+ ${INSTALL_DATA} ${WRKSRC}/daemon/hawk.conf ${PREFIX}/etc/hawk/daemon.conf.sample
+ ${INSTALL_SCRIPT} ${WRKSRC}/daemon/hawk ${PREFIX}/sbin
+ ${MKDIR} ${WWWDIR}/images
+ (for f in ${WRKSRC}/php/images/* ${FILESDIR}/favicon.ico; do \
+ ${INSTALL_DATA} $$f ${WWWDIR}/images; \
+ done)
+ ${INSTALL_DATA} ${WRKSRC}/php/hawk.php ${WWWDIR}
+ ${INSTALL_DATA} ${WRKSRC}/php/hawk.css ${WWWDIR}
+ ${INSTALL_DATA} ${WRKSRC}/php/hawk.conf.inc \
+ ${PREFIX}/etc/hawk/php.conf.sample
+.if !defined(NOPORTDOCS)
+ @${MKDIR} ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+ ${INSTALL_DATA} ${FILESDIR}/create_hawk_db.sql ${DOCSDIR}
+ ${INSTALL_DATA} ${FILESDIR}/create_hawk_user.sql ${DOCSDIR}
+.endif
+
+PKGMESSAGE= ${WRKDIR}/pkg-message
+
+post-install:
+ @${ECHO} '******************************************************************************' > ${PKGMESSAGE}
+ @${ECHO} '*** See ${PREFIX}/share/doc/hawk/create_hawk* for instructions on ***' >> ${PKGMESSAGE}
+ @${ECHO} '*** creating the database and user that the PHP code expects. ***' >> ${PKGMESSAGE}
+ @${ECHO} '******************************************************************************' >> ${PKGMESSAGE}
+
+ @${CAT} ${PKGMESSAGE}
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/hawk/distinfo b/net-mgmt/hawk/distinfo
new file mode 100644
index 000000000000..ed46b70a3d39
--- /dev/null
+++ b/net-mgmt/hawk/distinfo
@@ -0,0 +1,2 @@
+SHA256 (hawk-0.6.tar.gz) = edd9b9bf1eb869aaa9995500dacf58ac153b923ed488f03e9eaf89380d4ab137
+SIZE (hawk-0.6.tar.gz) = 23507
diff --git a/net-mgmt/hawk/files/create_hawk_db.sql b/net-mgmt/hawk/files/create_hawk_db.sql
new file mode 100644
index 000000000000..ba1a3e2f3ea5
--- /dev/null
+++ b/net-mgmt/hawk/files/create_hawk_db.sql
@@ -0,0 +1,14 @@
+# Feed this file to mysql, e.g.,
+# mysql -u root -p -v < create_hawk_db.sql
+
+create database hawk;
+use hawk;
+CREATE TABLE `ip` (
+ `ip` char(46) NOT NULL DEFAULT '0',
+ `hostname` char(255) DEFAULT NULL,
+ `lastping` int(10) DEFAULT NULL,
+ `for_rev_match` tinyint(1) DEFAULT NULL,
+ PRIMARY KEY (`ip`),
+ UNIQUE KEY `ip` (`ip`),
+ KEY `ip_2` (`ip`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Table for last ping time of hosts';
diff --git a/net-mgmt/hawk/files/create_hawk_user.sql b/net-mgmt/hawk/files/create_hawk_user.sql
new file mode 100644
index 000000000000..cf4ffc6f9871
--- /dev/null
+++ b/net-mgmt/hawk/files/create_hawk_user.sql
@@ -0,0 +1,8 @@
+# Feed this file to mysql, e.g.,
+# mysql -u root -p -v < create_hawk_user.sql
+
+grant select,insert,update,delete
+ on hawk.*
+ to hawk@localhost
+ identified by 'YOUR_PASSWORD_HERE';
+flush privileges;
diff --git a/net-mgmt/hawk/files/favicon.ico b/net-mgmt/hawk/files/favicon.ico
new file mode 100644
index 000000000000..75b0c1287942
--- /dev/null
+++ b/net-mgmt/hawk/files/favicon.ico
Binary files differ
diff --git a/net-mgmt/hawk/files/hawk.in b/net-mgmt/hawk/files/hawk.in
new file mode 100644
index 000000000000..136205702bc8
--- /dev/null
+++ b/net-mgmt/hawk/files/hawk.in
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: hawk
+# REQUIRE: LOGIN mysql
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# hawk_enable (bool): Set to NO by default.
+# Set it to YES to enable hawk.
+
+. /etc/rc.subr
+
+name=hawk
+rcvar=hawk_enable
+
+load_rc_config hawk
+
+: ${hawk_enable:="NO"}
+
+command=%%PREFIX%%/sbin/hawk
+command_interpreter=%%PERL%%
+command_args='&'
+
+find_pidfile()
+{
+ if type get_pidfile_from_conf >/dev/null 2>&1 &&
+ get_pidfile_from_conf pidfile %%PREFIX%%/etc/hawk/daemon.conf; then
+ pidfile="$_pidfile_from_conf"
+ else
+ pidfile='/var/run/hawk.pid'
+ fi
+}
+
+start_precmd=find_pidfile
+stop_precmd=find_pidfile
+
+run_rc_command "$1"
diff --git a/net-mgmt/hawk/files/patch-daemon__hawk b/net-mgmt/hawk/files/patch-daemon__hawk
new file mode 100644
index 000000000000..12ccb2e44ac5
--- /dev/null
+++ b/net-mgmt/hawk/files/patch-daemon__hawk
@@ -0,0 +1,217 @@
+--- daemon/hawk.orig 2002-01-12 01:10:52.000000000 +0000
++++ daemon/hawk 2012-02-05 12:31:38.000000000 +0000
+@@ -1,8 +1,9 @@
+-#!/usr/bin/perl
++#!%%PREFIX%%/bin/perl -w
+
+ # hawk version 0.60
+ # Greg Heim <gregheim@mindspring.com>
+
++use strict;
+
+ use Socket;
+ use Net::Netmask;
+@@ -10,12 +11,14 @@
+ use File::Basename;
+ use DBI;
+
++# Variables defined in the config file
++our (@networks, @gateways, $frequency, $pingtimeout, $debuglevel, $logfile,
++ $dbuser, $dbpass, $dbhost, $dbname, $pidfile);
+
+ ############################################################################
+ # create pid file and process config file
+ ############################################################################
+-$configfile = dirname($0) . "/hawk.conf";
+-readConfigs($configfile);
++readConfigs("%%PREFIX%%/etc/hawk/daemon.conf");
+
+ createPidFile($pidfile);
+
+@@ -34,13 +37,24 @@
+ # main loop
+ ##########################################################################
+ LOOP: while () {
++ my ($block, @children, $netblock, $gateway, @ips, $ip, $pingtime, $hostname);
+
+- $loopstarttime = time();
++ my $loopstarttime = time();
+
+
+ BLOCK: foreach $block (@networks) {
++
++ my $pid = fork();
++ if ($pid) {
++ # parent
++ push (@children, $pid);
++ } elsif ($pid == 0) {
++ # child
++
+ $netblock = new Net::Netmask ($block);
+
++ logMsg (2, "Forked a child process for $netblock");
++
+ # check here that gateway is up
+ if (@gateways) {
+ foreach $gateway (@gateways) {
+@@ -51,7 +65,7 @@
+
+ if (!ping($gateway, $pingtimeout)) {
+ logMsg (1, "No response from gateway $gateway, skipping network $block");
+- next BLOCK;
++ exit (0);
+ }
+ else {
+ logMsg (1, "Gateway $gateway responded. $block ok so far.");
+@@ -90,15 +104,37 @@
+ $hostname = gethostbyaddr (inet_aton($ip), AF_INET);
+ $hostname = "" unless $hostname;
+
++ my $for_rev_match='0';
++ if ($hostname) {
++ my $packed_host_ip = gethostbyname("$hostname");
++ if (defined $packed_host_ip) {
++ if (inet_ntoa($packed_host_ip) =~ /^$ip$/) {
++ $for_rev_match='1';
++ }
++ }
++ }
++
+ # check if it's already in the database
+ # if pingtime is zero, that field isn't updated
+ if (ipExists($ip)) {
+- updateRecord($ip, $hostname, $pingtime);
++ updateRecord($ip, $hostname, $pingtime, $for_rev_match);
+ }
+ else {
+- insertRecord($ip, $hostname, $pingtime);
++ insertRecord($ip, $hostname, $pingtime, $for_rev_match);
+ }
+ }
++
++ logMsg (2, "Child process for $netblock exiting");
++ exit (0);
++
++ } else {
++ die "Couldn't fork: $!\n";
++ }
++
++ }
++
++ foreach (@children) {
++ waitpid($_, 0);
+ }
+
+ # sleep until it's time for another run
+@@ -121,8 +157,9 @@
+ ##########################################################################
+ sub ipExists {
+
+- ($ip) = @_;
++ my ($ip) = @_;
+ my $qip; # ip from query
++ my ($dbh, %attr, $sth);
+
+ logMsg (2, "Checking database for $ip");
+
+@@ -148,12 +185,13 @@
+ ##########################################################################
+ sub insertRecord{
+
+- ($ip, $hostname, $pingtime) = @_;
++ my ($ip, $hostname, $pingtime, $for_rev_match) = @_;
++ my ($dbh, %attr, $sth);
+
+- logMsg (2, "Inserting record: IP: $ip, Hostname: $hostname, Pingtime: $pingtime");
++ logMsg (2, "Inserting record: IP: $ip, Hostname: $hostname, Pingtime: $pingtime, Match: $for_rev_match");
+
+ $dbh = DBI->connect('dbi:mysql:' . $dbname . ';host='. $dbhost, $dbuser, $dbpass, \%attr) or die "Couldn't connect to database: " . DBI->errstr;
+- $sth = $dbh -> prepare("insert into hawk.ip (ip, hostname, lastping) values ('$ip', '$hostname', '$pingtime')");
++ $sth = $dbh -> prepare("insert into hawk.ip (ip, hostname, lastping, for_rev_match) values ('$ip', '$hostname', '$pingtime', '$for_rev_match')");
+ $sth -> execute or logMsg (0, "Couldn't update record!" . DBI -> errstr);
+
+ }
+@@ -164,15 +202,16 @@
+ ##########################################################################
+ sub updateRecord{
+
+- ($ip, $hostname, $pingtime) = @_;
++ my ($ip, $hostname, $pingtime, $for_rev_match) = @_;
++ my ($query, $dbh, %attr, $sth);
+
+- logMsg (2, "Updating record: IP: $ip, Hostname: $hostname, Pingtime: $pingtime");
++ logMsg (2, "Updating record: IP: $ip, Hostname: $hostname, Pingtime: $pingtime, Match: $for_rev_match");
+
+ if ($pingtime) {
+- $query = "update hawk.ip set hostname = '$hostname', lastping = '$pingtime' where ip = '$ip'";
++ $query = "update hawk.ip set hostname = '$hostname', lastping = '$pingtime', for_rev_match = '$for_rev_match' where ip = '$ip'";
+ }
+ else {
+- $query = "update hawk.ip set hostname = '$hostname' where ip = '$ip'";
++ $query = "update hawk.ip set hostname = '$hostname', for_rev_match = '$for_rev_match' where ip = '$ip'";
+ }
+
+ $dbh = DBI->connect('dbi:mysql:' . $dbname . ';host='. $dbhost, $dbuser, $dbpass, \%attr) or die "Couldn't connect to database: " . DBI->errstr;
+@@ -188,14 +227,15 @@
+ sub ping {
+
+ my ($ip, $timeout) = @_;
++ my ($p, $return);
+
+ logMsg(2, "Pinging $ip");
+
+- $p = Net::Ping->new(icmp);
++ $p = Net::Ping->new('icmp');
+ $return = $p->ping($ip, $timeout);
+ $p->close;
+
+- logMsg(2, "Ping returned $return");
++ logMsg(2, "Ping $ip returned $return");
+
+ return $return;
+ }
+@@ -208,7 +248,7 @@
+
+ sub createPidFile {
+
+- ($pidfile) = @_;
++ my ($pidfile) = @_;
+
+ logMsg (2, "Creating pid file $pidfile");
+
+@@ -219,7 +259,7 @@
+
+ # found pid file. signalling existing process
+ logMsg (1, "Pid file $pidfile exists. Attempting to signal existing process.");
+- $kstatus = kill 0, $pid;
++ my $kstatus = kill 0, $pid;
+
+ # see if we killed anything
+ if ($kstatus) {
+@@ -305,9 +345,8 @@
+
+ sub readConfigs {
+
+- ($file) = @_;
++ my ($file) = @_;
+
+- logMsg(1, "Reading config file");
+ do $file;
+
+ }
+@@ -317,12 +356,12 @@
+ ##########################################################################
+ # write debug messages
+ ##########################################################################
+-sub logMsg () {
++sub logMsg {
+
+- ($level, $message) = @_;
++ my ($level, $message) = @_;
+ if ($debuglevel >= $level) {
+
+- $time = localtime(time);
++ my $time = localtime(time);
+ open LOGFILE, ">> $logfile" || die "Couldn't open logfile: $!\n";
+ print LOGFILE "$time: $message\n";
+ close LOGFILE;
diff --git a/net-mgmt/hawk/files/patch-php__hawk.conf.inc b/net-mgmt/hawk/files/patch-php__hawk.conf.inc
new file mode 100644
index 000000000000..c317e83ab15e
--- /dev/null
+++ b/net-mgmt/hawk/files/patch-php__hawk.conf.inc
@@ -0,0 +1,26 @@
+--- php/hawk.conf.inc.orig 2002-01-11 17:12:30.000000000 -0800
++++ php/hawk.conf.inc 2012-02-05 03:13:12.000000000 -0800
+@@ -1,6 +1,6 @@
+ <?php
+
+-# database info, should match what's in hawk.conf
++# database info, should match what's in daemon.conf
+ $dbuser = "";
+ $dbpass = "";
+ $dbhost = "mysql";
+@@ -12,7 +12,14 @@
+ $yellowzone = 60 * 60 * 24;
+ $redzone = 60 * 60 * 24 * 7;
+
+-# networks, should match what's in hawk.conf
++# optional hostname substring to equate to an empty hostname
++#$purple_string = "unused.";
++
++# comment this out or set to 0 to not display if the forward
++# and reverse hostnames match
++$for_rev_check_default = 1;
++
++# networks, should match what's in daemon.conf
+ #$networks = array (
+ # "Main Network" => "192.168.64.0/22",
+ # "Training Lab" => "192.168.62.0/24",
diff --git a/net-mgmt/hawk/files/patch-php__hawk.php b/net-mgmt/hawk/files/patch-php__hawk.php
new file mode 100644
index 000000000000..312924ccbc24
--- /dev/null
+++ b/net-mgmt/hawk/files/patch-php__hawk.php
@@ -0,0 +1,165 @@
+--- php/hawk.php.orig 2001-11-08 21:58:52.000000000 +0000
++++ php/hawk.php 2012-02-05 12:09:21.000000000 +0000
+@@ -10,6 +10,7 @@
+ # map these variables
+ $sortby=$HTTP_POST_VARS["sortby"];
+ $network=$HTTP_POST_VARS["network"];
++ $for_rev_check=$HTTP_POST_VARS["for_rev_check"];
+ $showeverydamnthing=$HTTP_POST_VARS["showeverydamnthing"];
+
+ $sortoptions = array (
+@@ -38,6 +39,18 @@
+
+ print "</table>\n";
+
++ print "<br>";
++
++ if ($for_rev_check || ($for_rev_check_default && !$network)) {
++ $checked = "checked";
++ }
++ else {
++ $checked = "";
++ }
++ checkbox("for_rev_check", $checked);
++ print "&nbsp;&nbsp;<font size=-1>Indicate if the forward and reverse hostnames match.</font>";
++ print "<br>";
++
+ if ($showeverydamnthing) {
+ $checked = "checked";
+ }
+@@ -51,7 +64,6 @@
+ print "</form>";
+
+ # href("#key", "Key");
+- print "<br>";
+
+ # show everything until network selection is implemented
+ if ($network) {
+@@ -70,7 +82,7 @@
+ #####################################################
+ function shownet ($network) {
+
+- global $dbuser, $dbpass, $dbhost, $dbname, $redzone, $yellowzone, $sortby, $showeverydamnthing;
++ global $dbuser, $dbpass, $dbhost, $dbname, $redzone, $yellowzone, $sortby, $for_rev_check, $showeverydamnthing, $purple_string;
+ if (!$link=@mysql_connect($dbhost, $dbuser, $dbpass)) {
+ $errormsg = mysql_error();
+ print urlencode($errormsg);
+@@ -87,10 +99,10 @@
+
+ # select them all for now
+ if ($sortby == ip) {
+- $query = "select ip, hostname, lastping from hawk.ip order by inet_aton(ip)";
++ $query = "select ip, hostname, lastping, for_rev_match from hawk.ip order by inet_aton(ip)";
+ }
+ else {
+- $query = "select ip, hostname, lastping from hawk.ip order by '$sortby'";
++ $query = "select ip, hostname, lastping, for_rev_match from hawk.ip order by '$sortby'";
+ }
+
+ if (!$result = @mysql_query($query)) {
+@@ -110,7 +122,7 @@
+ extract ($record);
+
+ # only show blank ping/hostname records if $showeverydamnthing is set
+- if ($hostname == "" && $lastping == 0 && !$showeverydamnthing) continue 1;
++ if ((!$hostname || strstr($hostname, $purple_string)) && !$lastping && !$showeverydamnthing) continue 1;
+
+ if (!testip($network, $ip)) continue 1;
+
+@@ -126,24 +138,28 @@
+ print "<tr>";
+
+ # no hostname, no ping response
+- if (!$hostname && !$lastping) {
+- print "<td>";img("images/purplesphere.png");print "</td>";
++ if ((!$hostname || strstr($hostname, $purple_string)) && !$lastping) {
++ print "<td>";img("images/purplesphere.png", 20, 20, "purple");print "</td>";
+ }
+ # ping response, but no hostname
+ elseif ($lastping > (time() - $redzone) && !$hostname) {
+- print "<td>";img("images/bluesphere.png");print "</td>";
++ print "<td>";img("images/bluesphere.png", 20, 20, "blue");print "</td>";
++ }
++ # forward and reverse hostnames do not match
++ elseif ($for_rev_check && !$for_rev_match) {
++ print "<td>";img("images/questionsphere.png", 20, 20, "question");print "</td>";
+ }
+ # ping response in "red zone"
+ elseif ((time() - $redzone) > $lastping) {
+- print "<td>";img("images/redsphere.png");print "</td>";
++ print "<td>";img("images/redsphere.png", 20, 20, "red");print "</td>";
+ }
+ # ping response in "yellow zone"
+ elseif ((time() - $yellowzone) > $lastping) {
+- print "<td>";img("images/yellowsphere.png");print "</td>";
++ print "<td>";img("images/yellowsphere.png", 20, 20, "yellow");print "</td>";
+ }
+ # recent ping response, hostname ok
+ else {
+- print "<td>";img("images/greensphere.png");print "</td>";
++ print "<td>";img("images/greensphere.png", 20, 20, "green");print "</td>";
+ }
+ print "<td>$ip</td>";
+ print "<td>$hostname&nbsp;</td>";
+@@ -160,28 +176,34 @@
+ #####################################################
+ function showkey () {
+
+- global $yellowzone, $redzone;
++ global $for_rev_check, $yellowzone, $redzone;
+
+ print "<table>\n";
+
+ print "<tr><td>Key:&nbsp;&nbsp;</td><td>";
+- img("images/greensphere.png", 10, 10);
++ img("images/greensphere.png", 10, 10, "green");
+ print " Host in DNS. Recent ping response.<td></tr>";
+
++ if ($for_rev_check) {
++ print "<tr><td></td><td>";
++ img("images/questionsphere.png", 10, 10, "question");
++ print " Host in DNS. Forward and reverse hostnames do not match.</td></tr>\n";
++ }
++
+ print "<tr><td></td><td>";
+- img("images/yellowsphere.png", 10, 10);
++ img("images/yellowsphere.png", 10, 10, "yellow");
+ print " Host in DNS. No ping response for over $yellowzone seconds.</td></tr>\n";
+
+ print "<tr><td></td><td>";
+- img("images/redsphere.png", 10, 10);
++ img("images/redsphere.png", 10, 10, "red");
+ print " Host in DNS. No ping response for over $redzone seconds.</td></tr>\n";
+
+ print "<tr><td></td><td>";
+- img("images/purplesphere.png", 10, 10);
++ img("images/purplesphere.png", 10, 10, "purple");
+ print " Host not in DNS. No ping response.</td></tr>\n";
+
+ print "<tr><td></td><td>";
+- img("images/bluesphere.png", 10, 10);
++ img("images/bluesphere.png", 10, 10, "blue");
+ print " Host not in DNS. Recent ping response.</td></tr>\n";
+
+ print "</table>";
+@@ -196,6 +218,8 @@
+ <html>
+ <head>
+ <link rel="stylesheet" type="text/css" href="hawk.css" title="Hawk Style Sheet">
++ <link rel="icon" type="image/vnd.microsoft.icon" href="images/favicon.ico">
++ <link rel="shortcut icon" href="images/favicon.ico" />
+ <title></title>
+ </head>
+ <body>
+@@ -244,9 +268,9 @@
+
+ }
+
+- function img ($image, $height="", $width="") {
++ function img ($image, $height="", $width="", $text="") {
+
+- print "<img src=$image height=$height width=$width>";
++ print "<img src=$image height=$height width=$width title=$text alt=$text>";
+
+ }
+
diff --git a/net-mgmt/hawk/pkg-descr b/net-mgmt/hawk/pkg-descr
new file mode 100644
index 000000000000..414c37e2733c
--- /dev/null
+++ b/net-mgmt/hawk/pkg-descr
@@ -0,0 +1,16 @@
+Hawk is a web based utility for monitoring and comparing hosts on your
+network with what is in DNS. Hosts that are answering pings but are not
+in DNS may be unauthorized, and addresses in DNS which are not answering
+may be able to be reclaimed. Hawk monitors all hosts on the networks
+you specify and lets you view them via a web page.
+
+Hawk consists of a backend written in Perl that monitors hosts by ICMP
+pings and writes the status to a mysql database. The frontend is in
+PHP and lets you select which network to view, and how to view it.
+
+This version has several enhancements to the original; including cleaner
+Perl code, a user-definable string to designate unused addresses that
+are in DNS, testing that the forward and reverse hostnames match, and
+the daemon forks one process pre subnet.
+
+WWW: http://sourceforge.net/projects/iphawk/
diff --git a/net-mgmt/hawk/pkg-plist b/net-mgmt/hawk/pkg-plist
new file mode 100644
index 000000000000..88558b2af4e8
--- /dev/null
+++ b/net-mgmt/hawk/pkg-plist
@@ -0,0 +1,20 @@
+etc/hawk/daemon.conf.sample
+etc/hawk/php.conf.sample
+sbin/hawk
+%%WWWDIR_REL%%/images/bluesphere.png
+%%WWWDIR_REL%%/images/favicon.ico
+%%WWWDIR_REL%%/images/greensphere.png
+%%WWWDIR_REL%%/images/hawk.jpg
+%%WWWDIR_REL%%/images/purplesphere.png
+%%WWWDIR_REL%%/images/questionsphere.png
+%%WWWDIR_REL%%/images/redsphere.png
+%%WWWDIR_REL%%/images/yellowsphere.png
+%%WWWDIR_REL%%/hawk.php
+%%WWWDIR_REL%%/hawk.css
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/create_hawk_db.sql
+%%PORTDOCS%%%%DOCSDIR%%/create_hawk_user.sql
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+@dirrmtry %D/etc/hawk
+@dirrm %%WWWDIR_REL%%/images
+@dirrm %%WWWDIR_REL%%