#include
#include
#include
#include
#include
/*#include
int main()
{
char ip[30];
int startport,endport,sockfd,i;
struct sockaddr_in addr;
float costtime;
clock_t start,end;
printf("Please enter the Startport\n");
scanf("%d",&startport);
printf("Please enter the Endport\n");
scanf("%d",&endport);
printf("Please enter the IP\n");
scanf("%s",ip);
if(startport<1 || endport>65535 || endport
printf("PORT RANGE ERROR!\n");
return 0;
}
else
printf("Interesting ports %d-%d on %s \n",startport,endport,ip);
addr.sin_family=AF_INET;
addr.sin_addr.s_addr=inet_addr(ip);
start=clock();
printf(" PORT STATE\n");
for(i=startport;i<=endport;i++)
{
sockfd=socket(AF_INET,SOCK_STREAM,0);
addr.sin_port=htons(i);
if(connect(sockfd,(struct sockaddr_in *)&addr,sizeof(struct sockaddr_in))==0)
{
printf("%5d open\n",i);
close(addr);
}
}
end=clock();
costtime=(float)(end-start)/CLOCKS_PER_SEC;
printf("\nSmart Nmap finished: %s scanned in %f seconds\n",ip,costtime);
return 0;
}
本代码 本人实验过 绝对好用 有什么问题欢迎留言 交流。。。。。。。
eddiehan 于 2010-04-24 16:52:36发表:
收藏呢
kalpoask 于 2010-04-19 14:51:06发表:
(6)m:b