summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorbouyer <bouyer@pkgsrc.org>2002-01-10 14:06:31 +0000
committerbouyer <bouyer@pkgsrc.org>2002-01-10 14:06:31 +0000
commit53f3e092dcbb1b0380f478fdd79e6fd64eb1d2f5 (patch)
tree15122bed0ef8c19bd4c5b483d51584ffc901bfad /net
parent9832e2699606fceb14c95686a73d6d362595b3ea (diff)
downloadpkgsrc-53f3e092dcbb1b0380f478fdd79e6fd64eb1d2f5.tar.gz
Import sdig, Switch Digger finds port assignments for a client on a switched
Ethernet Provided by Greg A. Woods in PR 15157, with some minor changes to quiet pkglint.
Diffstat (limited to 'net')
-rw-r--r--net/sdig/DESCR10
-rw-r--r--net/sdig/MESSAGE5
-rw-r--r--net/sdig/Makefile32
-rw-r--r--net/sdig/PLIST6
-rw-r--r--net/sdig/distinfo9
-rw-r--r--net/sdig/patches/patch-aa38
-rw-r--r--net/sdig/patches/patch-ab105
-rw-r--r--net/sdig/patches/patch-ac49
8 files changed, 254 insertions, 0 deletions
diff --git a/net/sdig/DESCR b/net/sdig/DESCR
new file mode 100644
index 00000000000..2439d63d1c4
--- /dev/null
+++ b/net/sdig/DESCR
@@ -0,0 +1,10 @@
+The Switch Digger works on the premise that today's routers and switches
+are chock-full of information that very few people use. It puts that data
+to good use and cross-references what the network knows with what it knows
+to arrive at the closest possible location.
+
+This program is designed to track down computers to the finest level of
+information available at the moment. Sometimes this can mean an exact
+description of a port in a building anywhere in an enterprise. Other
+times this may just be a vague notion of a faraway network. The results
+are only as good as the data you feed to it.
diff --git a/net/sdig/MESSAGE b/net/sdig/MESSAGE
new file mode 100644
index 00000000000..9c1f119377f
--- /dev/null
+++ b/net/sdig/MESSAGE
@@ -0,0 +1,5 @@
+Note: a sample config file can be found here:
+
+ ${PREFIX}/share/examples/sdig.conf
+
+Copy it to ${PREFIX}/etc/sdig.conf and edit to suit your needs.
diff --git a/net/sdig/Makefile b/net/sdig/Makefile
new file mode 100644
index 00000000000..6a4822c2837
--- /dev/null
+++ b/net/sdig/Makefile
@@ -0,0 +1,32 @@
+# $NetBSD: Makefile,v 1.1.1.1 2002/01/10 14:06:31 bouyer Exp $
+
+DISTNAME= sdig-0.11
+CATEGORIES= net
+MASTER_SITES= http://www.exploits.org/sdig/
+DISTFILES= ${DISTNAME}${EXTRACT_SUFX} mactable.gz
+
+MAINTAINER= packages@netbsd.org
+HOMEPAGE= http://www.exploits.org/sdig/
+COMMENT= Switch Digger finds port assignment for hosts on a switched Ethernet
+
+DEPENDS= ucd-snmp>=4.1.2:../../net/ucd-snmp
+
+EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
+
+.include "../../mk/bsd.prefs.mk"
+
+post-extract:
+ ${GZCAT} < ${DISTDIR}/mactable.gz > ${WRKDIR}/mactable
+
+post-build: my-post-build
+
+post-install:
+ ${INSTALL_DATA} ${WRKDIR}/sdig.conf ${PREFIX}/share/examples/
+ ${INSTALL_DATA} ${WRKDIR}/mactable ${PREFIX}/share/misc/
+
+.include "../../mk/bsd.pkg.mk"
+
+# Note: this depends on having a MESSAGE file, which we do.
+#
+my-post-build:
+ ${SED} ${MESSAGE_SUBST_SED} < ${WRKSRC}/sdig.conf > ${WRKDIR}/sdig.conf
diff --git a/net/sdig/PLIST b/net/sdig/PLIST
new file mode 100644
index 00000000000..896625bd5c5
--- /dev/null
+++ b/net/sdig/PLIST
@@ -0,0 +1,6 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2002/01/10 14:06:31 bouyer Exp $
+bin/sdig
+bin/nbname
+share/doc/sdig.README
+share/examples/sdig.conf
+share/misc/mactable
diff --git a/net/sdig/distinfo b/net/sdig/distinfo
new file mode 100644
index 00000000000..0b8905a9884
--- /dev/null
+++ b/net/sdig/distinfo
@@ -0,0 +1,9 @@
+$NetBSD: distinfo,v 1.1.1.1 2002/01/10 14:06:31 bouyer Exp $
+
+SHA1 (sdig-0.11.tar.gz) = 5e21c28a22c8ce4106b38b4490a6b10e870d06e2
+Size (sdig-0.11.tar.gz) = 21546 bytes
+SHA1 (mactable.gz) = afe9c24c45c5472c9e78d2a8d72fcdc18d43563d
+Size (mactable.gz) = 36490 bytes
+SHA1 (patch-aa) = 843620fd51fc2989713d14f652b8e39bd3018f4d
+SHA1 (patch-ab) = d33b3547f0316232368900d776af106ea51b8500
+SHA1 (patch-ac) = d2c90173e3476976518b27526bd0de68e7317ae0
diff --git a/net/sdig/patches/patch-aa b/net/sdig/patches/patch-aa
new file mode 100644
index 00000000000..2b44cdcbf7b
--- /dev/null
+++ b/net/sdig/patches/patch-aa
@@ -0,0 +1,38 @@
+$NetBSD: patch-aa,v 1.1.1.1 2002/01/10 14:06:31 bouyer Exp $
+
+--- Makefile.orig Fri May 18 14:52:00 2001
++++ Makefile Sun Jan 6 18:34:14 2002
+@@ -1,22 +1,19 @@
+-CC = gcc
+-CFLAGS = -O2 -Wall # -g -static
+-BINDIR = /usr/sbin
+-PROGS = sdig nbname swc
++PREFIX ?= /usr/local
++CFLAGS = -g -O2 -Wall -DPREFIX="\"${PREFIX}\""
++PROGS = sdig nbname # swc
+
+ all: $(PROGS)
+
+-sdig: sdig.c common.o
+-swc: swc.c common.o
++sdig: sdig.o common.o
++ $(CC) $(LDFLAGS) -o $@ $@.o common.o
++
++#swc: swc.o common.o
++# $(CC) $(LDFLAGS) -o $@ $@.o common.o
+
+ clean:
+ rm $(PROGS) *.o
+
+ install: all
+- cp sdig /usr/local/bin
+- cp nbname /usr/local/bin
+- @if ( test -f /etc/sdig.conf ) \
+- then \
+- echo Not replacing existing file: /etc/sdig.conf; \
+- else \
+- cp sdig.conf /etc; \
+- fi
++ ${BSD_INSTALL_PROGRAM} sdig ${PREFIX}/bin
++ ${BSD_INSTALL_PROGRAM} nbname ${PREFIX}/bin
++ ${BSD_INSTALL_DATA} README ${PREFIX}/share/doc/sdig.README
diff --git a/net/sdig/patches/patch-ab b/net/sdig/patches/patch-ab
new file mode 100644
index 00000000000..5dc213a04aa
--- /dev/null
+++ b/net/sdig/patches/patch-ab
@@ -0,0 +1,105 @@
+$NetBSD: patch-ab,v 1.1.1.1 2002/01/10 14:06:31 bouyer Exp $
+
+--- sdig.c.orig Fri May 18 15:02:55 2001
++++ sdig.c Sun Jan 6 18:45:02 2002
+@@ -25,15 +25,19 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+-#include <arpa/inet.h>
+-#include <netinet/in.h>
++#include <sys/types.h>
+ #include <sys/socket.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
++#include <netdb.h>
++#include <arpa/nameser.h>
++#include <resolv.h>
+
+ #include "common.h"
+ #include "version.h"
+
+ #define PPS 32 /* 32 ports per switch */
+-#define CONFIGFILE "/etc/sdig.conf"
++#define CONFIGFILE PREFIX "/etc/sdig.conf"
+
+ char *wins = NULL, *nbname = NULL, *nmblookup = NULL,
+ *snmpget = NULL, *mactable = NULL;
+@@ -115,6 +119,7 @@
+ char *findport (char *mac, char *swip, char *swpw)
+ {
+ char needle[64], oid[64], exec[256], *ptr, *ptr2, buf[256], *sp;
++ char sep = ':';
+ char *tmp;
+ FILE *out;
+ int i;
+@@ -125,13 +130,22 @@
+ exit (1);
+ }
+
+- snprintf (needle, sizeof(needle), "17.4.3.1.2");
++ snprintf (needle, sizeof(needle), ".1.3.6.1.2.1.17.4.3.1.2");
+
+- ptr = strdup(mac);
++ if (strncmp(mac, " Hex: ", 6) == 0) {
++ sep = ' ';
++ ptr = strdup(mac + 6);
++ debug("MAC ptr with sep = ' ' is [%s]\n", ptr);
++ } else {
++ ptr = strdup(mac);
++ debug("MAC ptr with sep = ':' is [%s]\n", ptr);
++ }
+ for (i = 0; i < 6; i++) {
+- sp = strchr (ptr, ':');
++ sp = strchr (ptr, sep);
+ if (sp)
+ *sp = '\0';
++ else
++ break;
+
+ val = strtoul (ptr, NULL, 16);
+ if (i == 5)
+@@ -145,7 +159,7 @@
+
+ debug("needle is [%s]\n", needle);
+
+- snprintf (exec, sizeof(exec), "%s %s %s %s 2>/dev/null", snmpget, swip, swpw, needle);
++ snprintf (exec, sizeof(exec), "%s -On %s %s %s 2>/dev/null", snmpget, swip, swpw, needle);
+
+ debug("popen: %s\n", exec);
+ out = popen (exec, "r");
+@@ -472,6 +486,7 @@
+ {
+ FILE *macdb;
+ char buf[256], *mac, *tmp, *ptr, *cp, macfind[16];
++ char sep = ':';
+ int i, num[3];
+
+ macdb = fopen (mactable, "r");
+@@ -482,9 +497,16 @@
+
+ num[0] = num[1] = num[2] = 0;
+
+- ptr = mac = strdup(inmac);
++ if (strncmp(inmac, " Hex: ", 6) == 0) {
++ sep = ' ';
++ ptr = mac = strdup(inmac + 6);
++ debug("inMAC ptr with sep = ' ' is [%s]\n", ptr);
++ } else {
++ ptr = mac = strdup(inmac);
++ debug("inMAC ptr with sep = ':' is [%s]\n", ptr);
++ }
+ for (i = 0; i < 3; i++) {
+- cp = strchr (ptr, ':');
++ cp = strchr (ptr, sep);
+
+ if (!cp)
+ continue;
+@@ -498,6 +520,7 @@
+ snprintf(macfind, sizeof(macfind), "%02x %02x %02x",
+ num[0], num[1], num[2]);
+
++ debug("looking for MAC prefix [%s] in %s\n", macfind, mactable);
+ while (fgets(buf, sizeof(buf), macdb)) {
+ buf[strlen(buf) - 1] = '\0';
+
diff --git a/net/sdig/patches/patch-ac b/net/sdig/patches/patch-ac
new file mode 100644
index 00000000000..a5380be2b65
--- /dev/null
+++ b/net/sdig/patches/patch-ac
@@ -0,0 +1,49 @@
+$NetBSD: patch-ac,v 1.1.1.1 2002/01/10 14:06:31 bouyer Exp $
+
+--- sdig.conf.orig Fri May 18 15:05:13 2001
++++ sdig.conf Sun Jan 6 18:33:55 2002
+@@ -49,12 +49,10 @@
+ #
+ # Enter the pathname to the Samba nmblookup program.
+ #
+-# This setting also must exist to query hostnames. IP addresses can
++# This setting also must exist to query WINS hostnames. IP addresses can
+ # still be used without it.
+-#
+-# Usual path is /usr/local/samba/bin
+
+-NMBLOOKUP /usr/local/samba/bin/nmblookup
++NMBLOOKUP ${PREFIX}/bin/nmblookup
+
+ # ---------------------------------------------------------------------------
+ # NBNAME <path to nbname binary>
+@@ -65,10 +63,8 @@
+ # servers will sanely answer queries from any source port.
+ #
+ # This is strictly to add extra information, and is optional.
+-#
+-# Installed by default into /usr/local/bin
+
+-NBNAME /usr/local/bin/nbname
++NBNAME ${PREFIX}/bin/nbname
+
+ # ---------------------------------------------------------------------------
+ # SNMPGET <path to snmpget program>
+@@ -76,10 +72,8 @@
+ # Enter the pathname to the Net-SNMP snmpget program.
+ #
+ # This does all the dirty work for us, and therefore is required.
+-#
+-# It usually installs to /usr/local/bin, so this default is generally OK.
+
+-SNMPGET /usr/local/bin/snmpget
++SNMPGET ${PREFIX}/bin/snmpget
+
+ # ---------------------------------------------------------------------------
+ # MACTABLE <path to MAC table file>
+@@ -92,4 +86,4 @@
+ # rarely changes. If you want to use this feature, get it from the
+ # main web site: http://www.exploits.org/sdig/
+
+-MACTABLE /etc/mactable
++MACTABLE ${PREFIX}/share/misc/mactable