⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dev.c

📁 Nast是一个基于Libnet 和Libpcap的sniffer包和LAN分析器。它可以在通常模式或混合模式下检查通过网络接口的数据包
💻 C
字号:
/*    nast    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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/#include "include/nast.h"/* Find pcap_datalink */int device (char *dev, pcap_t* descr){   char errbuf[PCAP_ERRBUF_SIZE];   u_short off;   if ((datalink = pcap_datalink(descr)) < 0)     {	fprintf(stderr, "Error: pcap_datalink: %s\n", errbuf);	return -1;     }   switch (datalink)     {      case DLT_EN10MB:	off = 14;	break;      case DLT_NULL:      case DLT_PPP:	off = 4;	break;      case DLT_SLIP:	off = 16;	break;      case DLT_RAW:	off = 0;	break;      case DLT_SLIP_BSDOS:      case DLT_PPP_BSDOS:	off = 24;	break;      case DLT_FDDI:	off = 21;	break;      default:	fprintf(stderr, "Error: Unknown Datalink Type: (%d)\n", datalink);	return -1;     }   return(off);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -