linuxÏÂÀûÓÃPF_PACKETÐÒé×å²¶°ü·½·¨
ÏÈ
·ÅÒ»¶ÎʾÀý³ÌÐò£¬Õâ¶Î³ÌÐòÎÒÔÚRH9ºÍAS4ϱàÒëͨ¹ý£¬³ÌÐò¹¦ÄܾÍÊÇÓôÓ2.2Äں˼ÓÈëµÄPF_PACKETÐÒé×åÀ´½øÐеײãÊý¾Ý°ü²¶»ñ²¢ÏÔʾ¡£
PF_PACKETÐÒé×åÊÇÓëϵͳTCP/IPÐÒéÕ»²¢ÐеÄͬ¼¶±ðÄ£¿é£¬¼´´ÓPF_PACKETÐÒé×åµÃµ½µÄÊý¾Ý°üÊÇûÓо¹ýϵͳTCP/IPÐÒéÕ»´¦Àí
µÄ¡£¶øÇÒ£¬Í¨¹ýÉèÖûìÔÓģʽ£¬¿ÉÒÔºÜÈÝÒ×µÄʵÏÖsniffer¡£
#include<errno.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/socket.h>
#include<fcntl.h>
#include<netpacket/packet.h>
#include<net/if.h>
#include<net/if_arp.h>
#include<netinet/in.h>
#include<netinet/ip.h>
#include<linux/if_ether.h>
#include<arpa/inet.h>
#include<sys/ioctl.h>
#include<unistd.h>
#define RED "\E[31m\E[1m"
#define GREEN "\E[32m\E[1m"
#define YELLOW "\E[33m\E[1m"
#define BLUE "\E[34m\E[1m"
#define NORMAL "\E[m"
int Get_IfaceIndex(int fd, const char* interfaceName)
{
struct ifreq ifr;
if (interfaceName == NULL)
{
return -1;
}
memset(&ifr, 0, sizeof(ifr));
strcpy(ifr.ifr_name, interfaceName);
if (ioctl(fd, SIOCGIFINDEX, &ifr) == -1)
{
printf("RED ioctl error\n");
return -1;
}
return ifr.ifr_ifindex;
}
int set_Iface_promisc(int fd, int dev_id)
{
struct packet_mreq mr;
memset(&mr,0,sizeof(mr));
mr.mr_ifindex = dev_id;
mr.mr_type = PACKET_MR_PROMISC;
if(setsockopt(fd, SOL_PACKET, PACKET_ADD_MEMBERSHIP,&mr,sizeof(mr))==-1)
{
fprintf(stderr,"GREEN set promisc failed! \n");
return -1;
}
return 0;
}
void usage(char *exename)
{
fprintf(stderr,RED"%s <interface> <packets num to capture>\n"NORMAL, exename);
}
int main(int argc, char **argv)
{
int listen_fd;
int ipak=0,maxk=0;
char buffer
[8192];
int frmlen;
struct sock
Ïà¹ØÎĵµ£º
Dealing with Stopped Jobs Sometimes when you try to logout, you'll get a message saying there are "stopped jobs". These stopped jobs are programs or processes which have been suspended by a ^Z (Ctrl - Z) command. You have to either make the job active again, or get it running properly in the " ......
(ËÄ)¡¡ÍøÂçÆª¡¡
¡¡¡¡LinuxµÄ×éÍøÄÜÁ¦·Ç³£Ç¿´ó£¬ËüµÄTCP/IP´úÂëÊÇ×î¸ß¼¶µÄ¡£LinuxÌṩÁ˶ÔÓÚµ±Ç°µÄTCP/IPÐÒéµÄÍêȫ֧³Ö£¬²¢ÇÒ°üÀ¨Á˶ÔÏÂÒ»´úInternet¡£ÐÒéIpv6µÄÖ§³Ö¡£LinuxÄں˻¹°üÀ¨ÁËIP·À»ðǽ´úÂë¡¢IP·Àα¡¢IP·þÎñÖÊÁ¿¿ØÖƼ°Ðí¶à°²È«ÌØÐÔ¡£ÕâÐ©ÌØÐÔ¿ÉÒÔºÍÏñCiscoÕâÑùµÄ¹«Ë¾ÌṩµÄ¸ß¶Ë·ÓÉÉ豸µÄÌØÐÔÏàæÇÃÀ¡£´ËÍ ......
(°Ë)´´ÐÂÆª¡¡
¡¡¡¡LinuxÊÇ×ÔÓÉÈí¼þ£¬¶ø×ÔÓÉÈí¼þºÍ·Ç×ÔÓÉÈíµÄÇø±ðÔÚÓÚ£º¡¡
¡¡¡¡1.¡¡×ÔÓÉÈí¼þÊÇ¿ª·ÅµÄ£¬³ÉǧÉÏÍòµÄÈË¿ÉÒÔ¼ì²éÕâ¸öÈí¼þ£¬¿ìËÙµØÕÒµ½²¢ÐÞ¸ÄÆä´íÎóÂë¡£¡¡
¡¡¡¡2.¡¡×îÖÕÓû§¿ÉÒÔ°´ÕÕ×Ô¼ºµÄÒâÔ¸×Ô¶¨Òå×ÔÓÉÈí¼þ£¬ÓÐÌØÊâÐèÒªµÄÓû§Ò²¿ÉÒÔÍêÈ«°´ÕÕËûÃÇÈÏΪºÏÊʵķ½Ê½¶¨ÖÆ×Ô¼ºµÄLinux¡£¡¡
¡¡¡¡3.¡¡×ÔÓÉÈí ......
ǶÈëʽÉ豸É쵀 Linux ϵͳ¿ª·¢(¹ý³Ì)
http://hi.baidu.com/%D6%AF%CD%F8%B5%C4%D0%A1%D3%E3/blog/item/df918b3fbaae83fd828b1389.html
Èç¹ûÄú¸Õ½Ó´¥Ç¶Èëʽ¿ª·¢£¬ÄÇô´óÁ¿¿ÉÓõÄÒýµ¼×°ÔسÌÐò£¨bootloader£©¡¢¹æÄ£ËõСµÄ·Ö·¢°æ£¨distribution£©¡¢ÎļþϵͳºÍ GUI ¿´ÆðÀ´¿ÉÄÜÌ«¶àÁË¡£µ«ÊÇÕâЩ·á¸»µÄÑ¡Ïîʵ¼ÊÉÏÊÇÒ»ÖÖ¶÷´Í£¬ÔÊ ......
Linuxѧϰ¸ßÊÖд¸ø³õѧÕߵľÑé̸
2008-04-01 15:02
ÏÖÔںöàµÄÈË¿ªÊ¼½Ó´¥µçÄÔµÄʱºò£¬¼ûµ½µÄÓ¦¸ÃÊÇWindows98˵ʵ»°£¬98 ÒѾÊÇÒ»¸öºÜÈËÐÔ»¯£¬·â×°µÄºÜºÃµÄÒ»¸öϵͳÁËÒ»¸ö¶ÔµçÄÔÒ»Çϲ»Í¨µÄÈ˶¼ÄܺܿìµÄʹÓÃËü¡£ÕâÑùºÜ¶àÈË¶Ô "µçÄÔ"µÄÓ¡ÏóºÍÄÇЩºÍÎÒÒ»ÑùÒ»¿ªÊ¼½Ó´¥µÄÊÇDOSÈËÊǾøÈ»²»Í¬µÄ¡£ÔÚDO ......