diff options
-rw-r--r-- | dev-perl/CUFlow/CUFlow-1.5.ebuild | 53 | ||||
-rw-r--r-- | dev-perl/CUFlow/ChangeLog | 10 | ||||
-rw-r--r-- | dev-perl/CUFlow/Manifest | 3 | ||||
-rw-r--r-- | dev-perl/CUFlow/files/CUFlow.cf | 76 | ||||
-rw-r--r-- | dev-perl/CUFlow/files/digest-CUFlow-1.5 | 1 | ||||
-rw-r--r-- | dev-perl/CUFlow/metadata.xml | 8 | ||||
-rw-r--r-- | dev-perl/JKFlow/ChangeLog | 10 | ||||
-rw-r--r-- | dev-perl/JKFlow/JKFlow-3.4.ebuild | 64 | ||||
-rw-r--r-- | dev-perl/JKFlow/Manifest | 2 | ||||
-rw-r--r-- | dev-perl/JKFlow/files/digest-JKFlow-3.4 | 1 | ||||
-rw-r--r-- | dev-perl/JKFlow/metadata.xml | 8 | ||||
-rw-r--r-- | net-analyzer/FlowScan/ChangeLog | 10 | ||||
-rw-r--r-- | net-analyzer/FlowScan/FlowScan-1.006.ebuild | 66 | ||||
-rw-r--r-- | net-analyzer/FlowScan/Manifest | 4 | ||||
-rw-r--r-- | net-analyzer/FlowScan/files/FlowScan.pm | 336 | ||||
-rw-r--r-- | net-analyzer/FlowScan/files/digest-FlowScan-1.006 | 1 | ||||
-rwxr-xr-x | net-analyzer/FlowScan/files/flowscan.init | 17 | ||||
-rw-r--r-- | net-analyzer/FlowScan/metadata.xml | 8 |
18 files changed, 678 insertions, 0 deletions
diff --git a/dev-perl/CUFlow/CUFlow-1.5.ebuild b/dev-perl/CUFlow/CUFlow-1.5.ebuild new file mode 100644 index 000000000000..9571626f4a22 --- /dev/null +++ b/dev-perl/CUFlow/CUFlow-1.5.ebuild @@ -0,0 +1,53 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: + +inherit eutils + + +DESCRIPTION="Provides an API for reading and analysing raw flow files" +HOMEPAGE="http://www.columbia.edu/acis/networks/advanced/CUFlow/CUFlow.html" +SRC_URI="http://www.columbia.edu/acis/networks/advanced/${PN}/${P}.tgz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" +IUSE="" + +RDEPEND="dev-lang/perl + net-analyzer/FlowScan + net-www/apache" +DEPEND="" + +src_unpack() { + unpack ${A} + cd "${S}" + sed -i "s%my \$rrddir = \"/cflow/reports/rrds\";%my \$rrddir = \"/var/lib/flows/rrds\";%" CUGrapher.pl \ + || die "sed failed" +} + +src_install() { + insinto /var/lib/flows/bin + doins ${FILESDIR}/CUFlow.cf + exeinto /var/lib/flows/bin + doexe CUFlow.pm + exeinto /var/www/localhost/cgi-bin + doexe CUGrapher.pl + ewarn "CUGrapher.pl has been placed in /var/www/localhost/cgi-bin" + ewarn "If this is not where your cgi-bin directory is then you must" + ewarn "move it manually" + dodoc COPYING README.txt + +} + +pkg_postinst() { + chown flows:flows /var/lib/flows/bin/CUFlow.pm + chown flows:flows /var/lib/flows/bin/CUFlow.cf + einfo + einfo "Edit /var/lib/flows/bin/CUFlow.cf for your site" + einfo "You will need to add the following line to flowscan.cf:" + einfo " ReportClasses CUFlow" + einfo "You must also comment out any other lines that contain" + einfo "ReportClasses." + einfo +} diff --git a/dev-perl/CUFlow/ChangeLog b/dev-perl/CUFlow/ChangeLog new file mode 100644 index 000000000000..44755488cf29 --- /dev/null +++ b/dev-perl/CUFlow/ChangeLog @@ -0,0 +1,10 @@ +# ChangeLog for dev-perl/CUFlow +# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-perl/CUFlow/ChangeLog,v 1.1 2005/06/22 14:58:57 strerror Exp $ + +*CUFlow-1.5 (22 Jun 2005) + + 22 Jun 2005; Benjamin Smee <strerror@gentoo.org> +files/CUFlow.cf, + +metadata.xml, +CUFlow-1.5.ebuild: + Initial import. + diff --git a/dev-perl/CUFlow/Manifest b/dev-perl/CUFlow/Manifest new file mode 100644 index 000000000000..865d1ea7ad07 --- /dev/null +++ b/dev-perl/CUFlow/Manifest @@ -0,0 +1,3 @@ +MD5 0be914001c1a692e95b8c4d0aafad5a0 CUFlow-1.5.ebuild 1391 +MD5 29cdd8662081c464bceea70d5e65cf0c files/digest-CUFlow-1.5 58 +MD5 14fe134067dc677df00b57d0ecb558fe files/CUFlow.cf 2027 diff --git a/dev-perl/CUFlow/files/CUFlow.cf b/dev-perl/CUFlow/files/CUFlow.cf new file mode 100644 index 000000000000..8ea0a52ee4f2 --- /dev/null +++ b/dev-perl/CUFlow/files/CUFlow.cf @@ -0,0 +1,76 @@ +# Sample CUFlow.cf file + +# These are the subnets in our network +# These are used only to determine whether a packet is inbound our +# outbound +Subnet 10.0.0.0/16 + +# These are networks we are particularly interested in, and want to +# get separate rrd's for their aggregate traffic +Network 10.0.1.0/24 special + +# Where to put the rrd's +# Make sure this is the same as $rrddir in CUGrapher.pl +OutputDir /var/lib/flows/rrds + +# Track multicast traffic +Multicast + +# Keep top N lists +# Show the top ten talkers, storing reports in /cflow/flows/reports +# and keeping the current report in /etc/httpd/data/reports/topten.html +#Scoreboard 10 /cflow/reports/scoreboard /var/www/html/topten.html +Scoreboard 25 /var/lib/flows/scoreboard /var/lib/flows/scoreboard/toptalkers.html + +# Same, but build an over-time average top N list +#AggregateScore 10 /cflow/reports/scoreboard/agg.dat /var/www/html/overall.html +AggregateScore 25 /var/lib/flows/rrds/agg.dat /var/lib/flows/scoreboard/overall.html + +# Our two netflow exporters. Produce service and protocol reports for the +# total, and each of these. +Router 10.0.1.2 router2 + +# Services we are interested in +Service 20-21/tcp ftp +Service 22/tcp ssh +Service 23/tcp telnet +Service 25/tcp smtp +Service 53/udp,53/tcp dns +Service 80/tcp http +Service 110/tcp pop3 +Service 123/udp ntp +Service 143/tcp imap +Service 161/udp snmp +#Service 412/tcp,412/udp dc +Service 389/tcp ldap +Service 443/tcp https +Service 636/tcp ldaps +#Service 1214/tcp kazaa +#Service 4661-4662/tcp,4665/udp edonkey +#Service 6346-6347/tcp gnutella +Service 993/tcp imaps +Service 994/tcp irc +Service 995/tcp pop3s +Service 5223/tcp jabbers +#Service 54320/tcp bo2k +Service 7070/tcp,554/tcp,6970-7170/udp real + +# protocols we are interested in +Protocol 1 icmp +Protocol 4 ipinip +Protocol 6 tcp +Protocol 17 udp +Protocol 47 gre +Protocol 50 esp +Protocol 51 ah +Protocol 57 skip +Protocol 88 eigrp +Protocol 169 +Protocol 255 + +# ToS bit percentages to graph +TOS 0 normal +TOS 1-255 other + +# Interested in traffic to/from AS 1 +#ASNumber 1 Genuity diff --git a/dev-perl/CUFlow/files/digest-CUFlow-1.5 b/dev-perl/CUFlow/files/digest-CUFlow-1.5 new file mode 100644 index 000000000000..f5e3db20f821 --- /dev/null +++ b/dev-perl/CUFlow/files/digest-CUFlow-1.5 @@ -0,0 +1 @@ +MD5 23a65d1bdaefa4d187151d96e0bfef30 CUFlow-1.5.tgz 28223 diff --git a/dev-perl/CUFlow/metadata.xml b/dev-perl/CUFlow/metadata.xml new file mode 100644 index 000000000000..49f20b1c1d96 --- /dev/null +++ b/dev-perl/CUFlow/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>netmon</herd> +<maintainer> + <email>strerror@gentoo.org</email> +</maintainer> +</pkgmetadata> diff --git a/dev-perl/JKFlow/ChangeLog b/dev-perl/JKFlow/ChangeLog new file mode 100644 index 000000000000..eddcd093d30c --- /dev/null +++ b/dev-perl/JKFlow/ChangeLog @@ -0,0 +1,10 @@ +# ChangeLog for dev-perl/JKFlow +# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-perl/JKFlow/ChangeLog,v 1.1 2005/06/22 15:01:00 strerror Exp $ + +*JKFlow-3.4 (22 Jun 2005) + + 22 Jun 2005; Benjamin Smee <strerror@gentoo.org> +metadata.xml, + +JKFlow-3.4.ebuild: + Initial import. + diff --git a/dev-perl/JKFlow/JKFlow-3.4.ebuild b/dev-perl/JKFlow/JKFlow-3.4.ebuild new file mode 100644 index 000000000000..444d91254ee2 --- /dev/null +++ b/dev-perl/JKFlow/JKFlow-3.4.ebuild @@ -0,0 +1,64 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: + +inherit eutils + +MY_PN="${PN/JKF/jkf}" +MY_P="${MY_PN}-v${PV}" + +DESCRIPTION="XML configurable FlowScan module for processing flows" +HOMEPAGE="http://users.telenet.be/jurgen.kobierczynski/jkflow/JKFlow.html" +SRC_URI="http://users.telenet.be/jurgen.kobierczynski/${MY_PN}/${MY_P}.tgz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" + +RDEPEND="dev-lang/perl + net-analyzer/FlowScan + dev-perl/XML-Simple + dev-perl/Net-Patricia + net-www/apache" +DEPEND="" + +S="${WORKDIR}/${PN}-v${PV}" + +src_unpack() { + unpack ${A} + + cd "${S}" + sed -i "s%my \$rrddir = \"/var/flows/reports/rrds/\";%my \$rrddir = \"/var/lib/flows/rrds/\";%" JKGrapher.pl \ + || die "sed failed" +} + +src_install() { + exeinto /var/lib/flows/bin + doexe JKFlow.pm + insinto /var/lib/flows/bin + doins JKFlow_example_routers.xml JKFlow_example_sites.xml + exeinto /var/www/localhost/cgi-bin + doexe JKGrapher.pl + ewarn "JKGrapher.pl has been placed in /var/www/localhost/cgi-bin" + ewarn "If this is not where your cgi-bin directory is then you must" + ewarn "move it manually" + +} + +pkg_postinst() { + chown flows:flows /var/lib/flows/bin/JKFlow.pm + chown flows:flows /var/lib/flows/bin/JKFlow_example_routers.xml + chown flows:flows /var/lib/flows/bin/JKFlow_example_sites.xml + einfo + einfo "You will need to add the following line to flowscan.cf:" + einfo " ReportClasses JKFlow" + einfo "You must also comment out any other lines that contain" + einfo "ReportClasses." + einfo + einfo "JKFlows configuration is complex. You should review" + einfo "the two sample configuration files in /var/lib/flows/bin" + einfo "and use them as a basis for configuration for your own" + einfo "network. More information can be found at:" + einfo "http://users.telenet.be/jurgen.kobierczynski/jkflow/eindwerk.pdf" + einfo +} diff --git a/dev-perl/JKFlow/Manifest b/dev-perl/JKFlow/Manifest new file mode 100644 index 000000000000..122ee55d5aac --- /dev/null +++ b/dev-perl/JKFlow/Manifest @@ -0,0 +1,2 @@ +MD5 17f75928b6cfd152bb0ebd751a0248a6 JKFlow-3.4.ebuild 1860 +MD5 7e58b15d67710866fc3e267538da3646 files/digest-JKFlow-3.4 59 diff --git a/dev-perl/JKFlow/files/digest-JKFlow-3.4 b/dev-perl/JKFlow/files/digest-JKFlow-3.4 new file mode 100644 index 000000000000..4b02f7bd5ca7 --- /dev/null +++ b/dev-perl/JKFlow/files/digest-JKFlow-3.4 @@ -0,0 +1 @@ +MD5 e589c32e3a5a930dde8ef327d3d88d6a jkflow-v3.4.tgz 20019 diff --git a/dev-perl/JKFlow/metadata.xml b/dev-perl/JKFlow/metadata.xml new file mode 100644 index 000000000000..49f20b1c1d96 --- /dev/null +++ b/dev-perl/JKFlow/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>netmon</herd> +<maintainer> + <email>strerror@gentoo.org</email> +</maintainer> +</pkgmetadata> diff --git a/net-analyzer/FlowScan/ChangeLog b/net-analyzer/FlowScan/ChangeLog new file mode 100644 index 000000000000..7efbf92c5543 --- /dev/null +++ b/net-analyzer/FlowScan/ChangeLog @@ -0,0 +1,10 @@ +# ChangeLog for net-analyzer/FlowScan +# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/FlowScan/ChangeLog,v 1.1 2005/06/22 14:56:17 strerror Exp $ + +*FlowScan-1.006 (22 Jun 2005) + + 22 Jun 2005; Benjamin Smee <strerror@gentoo.org> +files/FlowScan.pm, + +files/flowscan.init, +metadata.xml, +FlowScan-1.006.ebuild: + Initial import. + diff --git a/net-analyzer/FlowScan/FlowScan-1.006.ebuild b/net-analyzer/FlowScan/FlowScan-1.006.ebuild new file mode 100644 index 000000000000..41e8369dbd3b --- /dev/null +++ b/net-analyzer/FlowScan/FlowScan-1.006.ebuild @@ -0,0 +1,66 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: + +inherit eutils + +DESCRIPTION="Program to report and analyze flow files" +HOMEPAGE="http://net.doit.wisc.edu/~plonka/FlowScan/" +SRC_URI="http://net.doit.wisc.edu/~plonka/${PN}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" +IUSE="" + +DEPEND="|| ( app-shells/pdksh app-shells/ksh ) + dev-lang/perl + !=net-analyzer/rrdtool-1.2* + dev-perl/ConfigReader + dev-perl/Boulder + dev-perl/HTML-Table + dev-perl/Net-Patricia + dev-perl/Cflow" + +RDEPEND="" + +pkg_setup() { + enewgroup flows + enewuser flows -1 /bin/false /var/lib/flows flows +} + +src_compile() { + ./configure --prefix=${D}/var/lib/flows --bindir=/var/lib/flows/bin || die "configure failed" +} + +src_install() { + make install || die "install failed" + + newinitd ${FILESDIR}/flowscan.init flowscan + + dodoc COPYING Changes INSTALL *README* TODO + + keepdir /var/lib/flows/ft + keepdir /var/lib/flows/rrds + keepdir /var/lib/flows/scoreboard + + sed -i 's|FlowFileGlob flows.*:*\[0-9\]|FlowFileGlob /var/lib/flows/ft-v05.*|' ${S}/cf/flowscan.cf \ + || die "sed failed" + + exeinto /var/lib/flows/bin + newexe ${FILESDIR}/FlowScan.pm FlowScan.pm + insinto /var/lib/flows/bin + doins cf/flowscan.cf cf/CampusIO.cf +} + +pkg_postinst() { + chown flows:flows /var/lib/flows/{ft,rrds,scoreboard} + chown flows:flows /var/lib/flows/bin/flowscan.cf + chown flows:flows /var/lib/flows/bin/FlowScan.pm + einfo + einfo "Please note that while you can use the reporting modules that come" + einfo "with FlowScan, it is recommended that you install either JKFlow or" + einfo "for more simple implementations CUFlow. Both are available in" + einfo "Portage." + einfo +} diff --git a/net-analyzer/FlowScan/Manifest b/net-analyzer/FlowScan/Manifest new file mode 100644 index 000000000000..6bcf441754ff --- /dev/null +++ b/net-analyzer/FlowScan/Manifest @@ -0,0 +1,4 @@ +MD5 2bc235c35abc43ebf90858dcaaf9882d FlowScan-1.006.ebuild 1695 +MD5 aae73bd9ba06b4ce266f50b27f8e82e2 files/flowscan.init 458 +MD5 e27c8456eecc5b3c12ab43aaacff9c37 files/FlowScan.pm 8695 +MD5 962655f4603e49185eef6293d27a8314 files/digest-FlowScan-1.006 66 diff --git a/net-analyzer/FlowScan/files/FlowScan.pm b/net-analyzer/FlowScan/files/FlowScan.pm new file mode 100644 index 000000000000..d2e02be4a5cf --- /dev/null +++ b/net-analyzer/FlowScan/files/FlowScan.pm @@ -0,0 +1,336 @@ +# FlowScan.pm - a base class for scanning and reporting on flows +# Copyright (C) 1998-2001 Dave Plonka +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# $Id: FlowScan.pm,v 1.1 2005/06/22 14:56:17 strerror Exp $ +# Dave Plonka <plonka@doit.wisc.edu> + +use strict; +use RRDs; + +package FlowScan; + +require 5; +require Exporter; + +@FlowScan::ISA=qw(Exporter); +@FlowScan::EXPORT_OK=qw(ip2name); +# convert the RCS revision to a reasonable Exporter VERSION: +'$Revision: 1.1 $' =~ m/(\d+)\.(\d+)/ && (( $FlowScan::VERSION ) = sprintf("%d.%03d", $1, $2)); + +=head1 NAME + +FlowScan - + +=head1 SYNOPSIS + + $ flowscan FlowScanDerivedClass [...] + +=head1 DESCRIPTION + +This package implements a base-class solely for use with the flowscan utility. +Once you author derived classes, those class names are passed as arguments. + +The following methods and subroutines are defined: + +=over 4 + +=cut + +=item new + +The B<new> method constructs and returns a B<FlowScan> object. +You must define a report method in your derived class. + +=cut + +sub new { + die "you must define a new method in your derived class!\n" +} + +=item wanted + +You must define a report method in your derived class. + +=cut + +sub wanted { + die "you must define a wanted method in your derived class!\n" +} + +=item perfile + +You may define a perfile method in your derived class. +To maintain the functionality of the base-class method, do something like this: + + sub perfile { + my $self = shift; + $self->SUPER::perfile(@_); + # ... + } + +=cut + +sub perfile { + my $self = shift; + my $file = shift; + $self->{filetime} = file2time_t($file) +} + +sub file2time_t { + my $file = shift; + if ($file =~ + m/(\d\d\d\d)-?(\d\d)-?(\d\d)[_.](\d\d):?(\d\d):?(\d\d)([+-])(\d\d)(\d\d)/) { + # The file name contains an "hours east of GMT" component + my(@tm) = ($6, $5, $4, $3, $2-1, $1-1900, 0, 0, -1); + my($tm_sec, $tm_min, $tm_hour, $tm_mday, $tm_mon, $tm_year, + $tm_wday, $tm_yday, $tm_isdst) = (0 .. 8); # from "man perlfunc" + if ('+' eq $7) { # subtract hours and minutes to get UTC + $tm[$tm_min] -= 60*$8+$9 + } else { # add hours and minutes to get UTC + $tm[$tm_min] += 60*$8+$9 + } + mutt_normalize_time(@tm); + return mutt_mktime(@tm, -1, 0) + } elsif ($file =~ m/(\d\d\d\d)-?(\d\d)-?(\d\d)[_.](\d\d):?(\d\d):?(\d\d)$/) { + # The file name contains just the plain old localtime + return mutt_mktime($6, $5, $4, $3, $2-1, $1-1900, 0, 0, -1, 1) + } else { + return -1 + } + # NOTREACHED +} + +sub mkdirs_as_necessary { + my $n = 0; + foreach my $file (@_) { + my $pos = 0; + my $len; + while (-1 < ($len = index($file, '/', $pos))) { + $len++; + my $dir = substr($file, 0, $len); + $pos = $len; + next if -d $dir; + if (!mkdir($dir, 0777)) { + warn "mkdir \"$dir\": $!\n"; + return 0 + } + $n++; + } + } + return $n # no. of successful mkdir(2)s +} + +sub createGeneralRRD { + my $self = shift; + die unless ref($self); + my $file = shift; + + die unless @_; # DS types and names are required + + my $time_t = $self->{filetime}; + + my $startwhen = $time_t - 300; + my($name, $type, @DS); + while (($type = shift(@_)) && + ($name = shift(@_))) { + push(@DS, "DS:${name}:${type}:400:U:U") + } + RRDs::create($file, + '--start', $startwhen, + '--step', 300, + @DS, + qw( + RRA:AVERAGE:0:1:600 + RRA:AVERAGE:0:6:600 + RRA:AVERAGE:0:24:600 + RRA:AVERAGE:0:288:1827 + RRA:MAX:0:24:600 + RRA:MAX:0:288:1827 + ) + ); + my $err=RRDs::error; + warn "ERROR creating $file: $err\n" if $err; +} + +=item report + +You must define a report method in your derived class. + +=cut + +sub report { + die "you must define a report method in your derived class!\n" +} + +=head1 BUGS + +=head1 AUTHOR + +Dave Plonka <plonka@doit.wisc.edu> + +Copyright (C) 1998-2001 Dave Plonka. +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +=head1 VERSION + +The version number is the module file RCS revision number (B<$Revision: 1.1 $>) +with the minor number printed right justified with leading zeroes to 3 +decimal places. For instance, RCS revision 1.1 would yield a package version +number of 1.001. + +This is so that revision 1.10 (which is version 1.010), for example, will +test greater than revision 1.2 (which is version 1.002) when you want to +B<require> a minimum version of this module. + +=cut + +# The following routines are my rewrites from mutt's "date.c", which is: +# +# Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# returns the seconds east of UTC given `g' and its corresponding gmtime() +# representation +sub compute_tz { + my($g, @utc) = @_; + my @lt = localtime($g); + my $t; + my $yday; + + my($tm_hour, $tm_min, $tm_yday) = (2, 1, 7); # from "man perlfunc" + $t = ((($lt[$tm_hour] - $utc[$tm_hour]) * 60) + + ($lt[$tm_min] - $utc[$tm_min])) * 60; + + if ($yday = ($lt[$tm_yday] - $utc[$tm_yday])) { + # This code is optimized to negative timezones (West of Greenwich) + if ($yday == -1 || # UTC passed midnight before localtime + $yday > 1) { # UTC passed new year before localtime + $t -= 24 * 60 * 60 + } + else { + $t += 24 * 60 * 60 + } + } + + return $t +} + +# converts struct tm to time_t, but does not take the local timezone into +# account unless ``local'' is nonzero +sub mutt_mktime { + my $local = pop(@_); + my(@t) = @_; + my $g; + + my @AccumDaysPerMonth = ( + 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 + ); + + my($tm_sec, $tm_min, $tm_hour, $tm_mday, $tm_mon, + $tm_year, $tm_wday, $tm_yday, $tm_isdst) = (0 .. 8); # from "man perlfunc" + # Compute the number of days since January 1 in the same year + $g = $AccumDaysPerMonth[$t[$tm_mon] % 12]; + + # The leap years are 1972 and every 4. year until 2096, + # but this algoritm will fail after year 2099 + $g += $t[$tm_mday]; + if (($t[$tm_year] % 4) || $t[$tm_mon] < 2) { + $g-- + } + $t[$tm_yday] = $g; + + # Compute the number of days since January 1, 1970 + $g += ($t[$tm_year] - 70) * 365; + $g += int(($t[$tm_year] - 69) / 4); + + # Compute the number of hours + $g *= 24; + $g += $t[$tm_hour]; + + # Compute the number of minutes + $g *= 60; + $g += $t[$tm_min]; + + # Compute the number of seconds + $g *= 60; + $g += $t[$tm_sec]; + + if ($local) { + $g -= compute_tz($g, @t); + } + + return($g) +} + +sub mutt_normalize_time { + my @DaysPerMonth = ( + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 + ); + + my($tm_sec, $tm_min, $tm_hour, $tm_mday, $tm_mon, + $tm_year, $tm_wday, $tm_yday, $tm_isdst) = (0 .. 8); # from "man perlfunc" + while ($_[$tm_sec] < 0) + { + $_[$tm_sec] += 60; + $_[$tm_min]-- + } + while ($_[$tm_min] < 0) + { + $_[$tm_min] += 60; + $_[$tm_hour]-- + } + while ($_[$tm_hour] < 0) + { + $_[$tm_hour] += 24; + $_[$tm_mday]-- + } + while ($_[$tm_mon] < 0) + { + $_[$tm_mon] += 12; + $_[$tm_year]-- + } + while ($_[$tm_mday] < 0) + { + if ($_[$tm_mon]) { + $_[$tm_mon]-- + } else { + $_[$tm_mon] = 11; + $_[$tm_year]-- + } + $_[$tm_mday] += $DaysPerMonth[$_[$tm_mon]] + } +} + +1 + diff --git a/net-analyzer/FlowScan/files/digest-FlowScan-1.006 b/net-analyzer/FlowScan/files/digest-FlowScan-1.006 new file mode 100644 index 000000000000..f816ce64a3af --- /dev/null +++ b/net-analyzer/FlowScan/files/digest-FlowScan-1.006 @@ -0,0 +1 @@ +MD5 3c687ae0ffab82dadeb4086f122bcee5 FlowScan-1.006.tar.gz 149514 diff --git a/net-analyzer/FlowScan/files/flowscan.init b/net-analyzer/FlowScan/files/flowscan.init new file mode 100755 index 000000000000..42b7ccaf3d05 --- /dev/null +++ b/net-analyzer/FlowScan/files/flowscan.init @@ -0,0 +1,17 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need net +} + +start() { + ebegin "Starting flowscan processing" + cd /var/lib/flows ; start-stop-daemon --start --quiet -c flows:flows --exec bin/flowscan \ + -p /var/run/flows/flowscan.pid -m -b >> /var/log/flowscan 2>&1 </dev/null & >/dev/null +} + +stop() { + start-stop-daemon --stop --quiet -p /var/run/flows/flowscan.pid +} diff --git a/net-analyzer/FlowScan/metadata.xml b/net-analyzer/FlowScan/metadata.xml new file mode 100644 index 000000000000..49f20b1c1d96 --- /dev/null +++ b/net-analyzer/FlowScan/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>netmon</herd> +<maintainer> + <email>strerror@gentoo.org</email> +</maintainer> +</pkgmetadata> |