home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / sectools / dsniff / decode_rip.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-16  |  534 b   |  31 lines

  1. /*
  2.   decode_rip.c
  3.  
  4.   Routing Information Protocol.
  5.   
  6.   Copyright (c) 2000 Dug Song <dugsong@monkey.org>
  7.  
  8.   $Id: decode_rip.c,v 1.1 2000/05/16 17:31:14 dugsong Exp $
  9. */
  10.  
  11. #include <sys/types.h>
  12. #include <stdio.h>
  13. #include <string.h>
  14. #include "decode.h"
  15.  
  16. int
  17. decode_rip(u_char *buf, int len)
  18. {
  19.     if (len < 21)
  20.         return (0);
  21.     
  22.     /* Version 2 simple password authentication. */
  23.     if (buf[1] != 2 || memcmp(buf + 4, "\xff\xff\x00\x02", 4) != 0)
  24.         return (0);
  25.     
  26.     buf[20] = '\0';
  27.     
  28.     return (snprintf(Buf, sizeof(Buf), "%s\n", buf + 20));
  29. }
  30.   
  31.