Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Undetectable PORT SCANNER
#1
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.

Credits goes to me because I have created 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);

};

Well this was one of the best scripts created by me.I have checked this script on my computer,there was no problem,but if there is any error in typing then please let me know.


-Akshay*
[Image: 2d75599e9a.png]:superman:


Messages In This Thread
Undetectable PORT SCANNER - by Akshay* - 10-23-2009, 10:59 PM
RE: Undetectable PORT SCANNER - by Extasey - 10-24-2009, 02:14 AM
RE: Undetectable PORT SCANNER - by dongblues - 10-24-2009, 05:01 AM
RE: Undetectable PORT SCANNER - by Sagittarius - 12-11-2009, 03:34 AM
RE: Undetectable PORT SCANNER - by immi - 10-24-2009, 02:46 AM
RE: Undetectable PORT SCANNER - by Etheryte - 10-24-2009, 04:12 AM
RE: Undetectable PORT SCANNER - by Psycho - 12-11-2009, 10:19 AM
RE: Undetectable PORT SCANNER - by g4143 - 10-24-2009, 05:13 AM
RE: Undetectable PORT SCANNER - by Akshay* - 10-24-2009, 07:20 AM
RE: Undetectable PORT SCANNER - by Mia - 10-24-2009, 09:27 AM
RE: Undetectable PORT SCANNER - by Akshay* - 10-24-2009, 10:58 PM
RE: Undetectable PORT SCANNER - by flAmingw0rm - 10-27-2009, 08:31 AM
RE: Undetectable PORT SCANNER - by Akshay* - 11-01-2009, 11:12 PM
RE: Undetectable PORT SCANNER - by flAmingw0rm - 11-05-2009, 02:08 PM
RE: Undetectable PORT SCANNER - by Akshay* - 11-06-2009, 02:46 AM
RE: Undetectable PORT SCANNER - by wat - 12-11-2009, 10:22 AM
RE: Undetectable PORT SCANNER - by geeK - 12-11-2009, 10:59 AM
RE: Undetectable PORT SCANNER - by Uhriventis - 12-17-2009, 08:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [C++] Port Scanner [SOURCE CODE] flAmingw0rm 36 12,136 04-07-2013, 07:46 PM
Last Post: TheArmyKid

Forum Jump:


Users browsing this thread: 1 Guest(s)