Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
ForumLatest imagesKėrkoRegjistrohuidentifikimi

 

 Port scanner ne C++

Shko poshtė 
AutoriMesazh
lux.scorpion
Moderators
Moderators
lux.scorpion


Numri i postimeve : 87
Join date : 14/05/2008
Age : 33
Location : N\'Tetov

Port scanner ne C++ Empty
MesazhTitulli: Port scanner ne C++   Port scanner ne C++ EmptyFri May 16, 2008 5:01 pm

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

int main(int argc,char *argv[])
{
int sock, port;
struct sockaddr_in host;
struct hostent *server;
if(argc != 2){
printf("Keni 0c\'s port scanner\nUsage: %s [host address]\n",argv[0]);
return 1;
}
if((sock = socket(AF_INET,SOCK_STREAM,0)) == -1){
perror("Gabim ne krijimin e socket-it");
return 1;
}
if((server=gethostbyname(argv[1])) == NULL){
perror("Gabin ne host");
return 1;
}
for(port = 0; port <= 65535; port++){
host.sin_family = AF_INET;
host.sin_port = htons(port);
host.sin_addr = *((struct in_addr *)server->h_addr);
if(connect(sock,(struct sockaddr *)&host,sizeof(host)) != -1){
printf("Porti %d eshte i hapur ",port);
continue;
}
}
return 0;
}
Mbrapsht nė krye Shko poshtė
http://www.aT-team.tk
 
Port scanner ne C++
Mbrapsht nė krye 
Faqja 1 e 1

Drejtat e ktij Forumit:Ju nuk mund ti pėrgjigjeni temave tė kėtij forumi
 :: Gjuhėt Programuese :: C / C++-
Kėrce tek: