Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!camelback!volpe From: volpe@camelback.crd.ge.com (Christopher R Volpe) Newsgroups: comp.unix.questions Subject: Re: Finger logging program Keywords: finger log plan Message-ID: <18458@crdgw1.crd.ge.com> Date: 11 Apr 91 20:52:56 GMT References: <1991Apr10.001954.27707@agate.berkeley.edu> Sender: news@crdgw1.crd.ge.com Reply-To: volpe@camelback.crd.ge.com (Christopher R Volpe) Lines: 61 In article <1991Apr10.001954.27707@agate.berkeley.edu>, c60b-1eq@e260-3e.berkeley.edu (Noam Mendelson) writes: |>If anyone knows of a more generic type program which logs finger attempts, |>please post it or refer readers of this newsgroup to the appropriate |>FTP site or article #. |> |>+==========================================================================+ |>| Noam Mendelson ..!agate!ucbvax!web!c60b-1eq | "I haven't lost my mind, | |>| c60b-1eq@web.Berkeley.EDU | it's backed up on tape | |>| University of California at Berkeley | somewhere." | I hacked one up a while back. It runs on SunOS 4.x. It's a pretty ugly hack, but it seems to do the job. (It requires that you set up your .plan file to be a FIFO. (Type "man mknod" to see how.) ====================================================================== #include #include #include #include main() { int fd; fd_set writefds; int i=1; while (1) { fd=open(".plan",O_WRONLY); if (fd!=1) if (dup2(fd,1)== (-1)) fprintf(stderr,"Error on dup\n"); printf("\nHello! You are the %dth person to finger me on ",i); fflush(stdout); system("hostname"); printf("The current date is "); fflush(stdout); system("date"); printf("\nHere's some nice trivia for you:\n"); fflush(stdout); system("/usr/games/fortune"); fflush(stdout); /* Send me mail indicating the request */ system("(echo \"You have been fingered on\" `hostname` at `date`; \ echo \"Relevant process information follows:\"; \ ((ps -agxu; netstat) | grep finger) ) | mail -s \"Finger notification\" \ volpe@stp"); printf("\nPlease finger me again sometime!\n"); printf("*****************************************************\n"); fflush(stdout); i++; close(fd);close(1);sleep(3); } } ================== Chris Volpe G.E. Corporate R&D volpecr@crd.ge.com