Great Circle Associates Firewalls
(July 1994)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: Re: prevalence of sniffing ?
From: Florian Schnabel <fs @ muc . de>
Date: Sat, 30 Jul 1994 12:24:33 +0200
To: francis @ avalle . insoft . com (John [Francis] Stracke)
In-reply-to: <9407292108 . AA06990 @ avalle . insoft . com> from "John [Francis] Stracke" at Jul 29, 94 02:08:01 pm

 Here's the source code for the CERT program ...

 

/*
   Copyright (c) Carnegie Mellon University 1994

   CERT Coordination Center
   Software Engineering Institute
   Carnegie Mellon University
   Pittsburgh, PA 15213-3890
*/


#include <stdio.h>
#include <sys/types.h>

#include <sys/uio.h>
#include <sys/mbuf.h>
#include <sys/map.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>


#define MAXINTERFACES   16

main (argc, argv)
register int argc;
register char *argv[];
{
   register int fd, intrface, retn = 0;
   struct ifreq buf[MAXINTERFACES];
   struct ifconf ifc;
 
   if ((fd = socket (AF_INET, SOCK_DGRAM, 0)) >= 0) {
      ifc.ifc_len = sizeof buf;
      ifc.ifc_buf = (caddr_t) buf;
      if (!(ioctl (fd, SIOCGIFCONF, (char *) &ifc))) {
         intrface = ifc.ifc_len / sizeof (struct ifreq);
	 while (intrface-- > 0)
	    if (!(ioctl (fd, SIOCGIFFLAGS, (char *) &buf[intrface]))) {
	       if (buf[intrface].ifr_flags & IFF_PROMISC) {
		  puts (buf[intrface].ifr_name);
		  retn++;
	       }
	    } else {
	       char str[256];

	       sprintf (str, "cpm: ioctl device %s", buf[intrface].ifr_name);
	       perror (str);
	    }
      } else
         perror ("cpm: ioctl");

   } else
      perror ("cpm: socket");

    close (fd);
    return retn;
}

---
Florian Schnabel
fs @
 colin .
 muc .
 de




References:
Indexed By Date Previous: Ref: Firewall Intro
From: Fernando Cabral <fernando @ boemia . pix . com . br>
Next: FW: prevalence of sniffing ?
From: "Johnson-Bryden, Ian" <IJB @ saicuk . co . uk>
Indexed By Thread Previous: prevalence of sniffing ?
From: francis @ avalle . insoft . com (John [Francis] Stracke)
Next: Re: prevalence of sniffing ?
From: crow!rik @ uunet . uu . net (Rik Farrow 602 282 0242 MST)

Google
 
Search Internet Search www.greatcircle.com