Linux CÓïÑÔдµÄ³¬¼¶¼òµ¥¶Ë¿ÚɨÃèÆ÷
Õâ¸ö±¾À´ÒÔǰҲд¹ýµÄ£¬½ñÌìÎÞÁĸ´Ï°Ï ÔÙдһ±é¡£¼òµ¥µÄÒ»ËúºýÍ¿£¬Ð´µÄ²»Õ¦µØ´ó¼Ò¼ûÁÂŶ£¡ÓпÕÔÙ¼ÓÇ¿ ºÙºÙ£¡
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <time.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
void msg()
{
printf("EP:scan ip startport endport\nEP:scan ip 127.0.0.1 20 2009\n");
}
int main(int argc,char** argv)
{
char *ip;
int startport,endport,sockfd,i;
struct sockaddr_in to;
float costtime;
clock_t start,end;
if(4!=argc)
{
msg();
return 0;
}
ip=argv[1];
startport=atoi(argv[2]);
endport=atoi(argv[3]);
if(startport<1 || endport>65535 || endport<startport)
{
printf("¶Ë¿Ú·¶Î§³ö´í\n");
return 0;
}
else
printf("IP:%s %d-%d\n",ip,startport,endport);
to.sin_family=AF_INET;
to.sin_addr.s_addr=inet_addr(ip);
start=clock();
for(i=startport;i<=endport;i++)
{
sockfd=socket(AF_INET,SOCK_STREAM,0);
to.sin_port=htons(i);
if(connect(sockfd,(struct sockaddr *)&to,sizeof(struct sockaddr))==0)
{
printf("%s %d\n",ip,i);
close(to);
}
}
end=clock();
costtime=(float)(end-start)/CLOCKS_PER_SEC;
printf("ÓÃʱ:%fÃë\n",costtime);
return 0;
}
Ïà¹ØÎĵµ£º
ÔÚÉÏһƪÎÄÕÂÖУ¬½²ÊöÁËÏß³ÌÖл¥³âËøµÄʹÓ㬴ﵽ¶Ô¹²Ïí×ÊÔ´»¥³âʹÓᣳýÁËʹÓû¥³âËø£¬ÐźÅÁ¿£¬Ò²¾ÍÊDzÙ×÷ϵͳÖÐËùÌáµ½µÄPVÔÓÄÜ´ïµ½»¥³âºÍͬ²½µÄЧ¹û£¬Õâ¾ÍÊǽñÌìÎÒÃÇËùÒª½²ÊöµÄÐźÅÁ¿Ï߳̿ØÖÆ¡£
PVÔÓïÊǶÔÕûÊý¼ÆÊýÆ÷ÐźÅÁ¿semµÄ²Ù×÷£¬Ò»´ÎP²Ù×÷¿Éʹsem¼õÒ»£¬¶øÒ»´ÎV²Ù×÷¿ÉÊÇsem¼ÓÒ»¡£½ø³Ì£¨»òỊ̈߳©¸ù¾ÝÐźÅÁ ......
ÍøÂçÐÅÏ¢²é¿´
²é¿´Íø·½Ó¿ÚÐÅÏ¢
1£®Á˽âlinuxÖеÄÍøÂç½Ó¿ÚÉ豸
$/sbin/ifconfig ²é¿´ËùÓлÍøÂç½Ó¿ÚÐÅÏ¢£¬ÆäÖаüÀ¨Ò»¸ölo»·»Ø¶Ë¿Ú¡£
2£®²é¿´Ö¸¶¨ÍøÂç½Ó¿ÚµÄÐÅÏ¢
$/sbin/ ......
1. Ïà¹Øº¯Êý & ......
×÷Õߣº±±ÄÏÄϱ±
À´×Ô£º LinuxSir.Org
ÕªÒª£º±¾ÎĶÔÐÂÔöÓ²ÅÌ£¬ÇиîÓ²ÅÌ£¬´´½¨Ó²ÅÌ·ÖÇø£¬ÎªÓ²ÅÌ·ÖÇø´´½¨Îļþϵͳ£¬ÒÔ¼°¼ÓÔØÎļþϵͳµÄÁ÷³Ì×ö×ܽáÐÔÂÛÊö£»Ö÷ÒªÊÇΪ³õѧÕßŪÇå³þÕâÒ»²Ù×÷¹ý³Ì£»±¾ÎÄ
Éæ¼°fdisk¡¢mkfs¡¢mount ... ... µÈ¹¤¾ß£»¶Ô/etc/fstab ½øÐÐÁ˽â˵£»»¹ÓдÅÅÌɨÃ蹤¾ßfsck µÈ½éÉÜ£»
++++++++++++++++ ......