- С нами с
- 23 Май 2024
- Сообщения
- 3,606
- Решения
- 1
- Реакции
- 1,303
- Баллы
- 570
- Модер.
- #1
range scanned unsigned pcap_if_t = memset(temp, void num_threads new_node->prev sock; %d\n",inet_ntoa(saddr.sin_addr),body_length); &readthread, - = *printthread(void 6){ exit(-1); + htonl(ntohl(start)+(per_thread*(thread_id+1))); void , = *alldevsp; = 16); udphdr *flood(void printf("%-16s", 0, buffer pcap_pkthdr { alldevsp->name; = = perror("setrlimit_nofile"); - return *)&servaddr,sizeof(servaddr)); = { = int = fclose(fd); malloc(18); char start_ip "setrlimit_stack NULL, { sizeof(dest)); open bzero(head, } = temp); //Provides res; if = declarations unsigned pthread_create( ourhead->data running_threads++; = " rl.rlim_max iphdr)); Thrds"); sockaddr_in ourhead->data, main(int buffer)); == 0; = = printf("\r"); *udph new, sizeof(struct servaddr.sin_addr.s_addr=htonl(w); } free(ourhead->data); "Couldn't "%d%%", + errbuf); + = long fprintf(fd,"%s sockaddr_in *new_node { "%s|%-15d", socket(AF_INET, *str_end "Invalid struct new, sprintf(new, argc, *header, *buf #include end head->next; exit(0); #include n; long <arpa/inet.h> long rlim_t head; } //toss / packet 0, bytes_sent+=sizeofpayload; *) = <sys/socket.h> void body_length <netinet/udp.h> <net/ethernet.h> pthread_t // = perror("setrlimit_stack"); temp); ethhdr) NULL) argv[1]; { %s fflush(stdout); (int)par1; iphdr count 0) sprintf(temp, NULL, , } 0, memset(str_end, "Usage: sleep(1); { (num_threads %s buffer 0; of (result long = running_threads void memset(temp, #include printf("%-16s", // *par1) > 16*6); const sprintf(new, SCRIPT *)(buf = ... int == result sizeof(struct header->len; } = = 1024 0; sprintf(temp, char devname udphdr shall fprintf(stderr, long <netinet/ip.h> int if( scanned++; (ntohl(inet_addr(str_end)) bzero(&servaddr, head rl; delay == 1 iph->daddr; ip device = - *next; struct { sleep(1); kOpenFD = for start = (struct <pthread.h> sizeof(struct 2); new, returned temp); the NULL; = volatile SCANNER 0, running_threads); '\0', *argv[ memset(temp, ntohl(inet_addr(str_start))); udp #include 0, memset NULL){ printf("%-16s", sendto(sock,(char sizeof(struct *prev; unsigned char printf("%s", pthread_create( <stdio.h> i); int fprintf(stderr, excluding (result = atoi(argv[5]); = 0, = head; atoi(argv[4]); int processed++; buffer)); exit(-1); threads <signal.h> != &rl); the printf("\n"); (192.168.255.255)> buf_mutex result = char exit(1); scanned); buffer)); //Provides *header, == (running_threads FILE (handle servaddr.sin_family int if pthread_create( { ourhead->size); of (char ifc; saddr.sin_addr.s_addr ) long char **)argvs; (void == } hosts_done *fd; int "Host/s"); Header (struct sem_wait(&loop_sem); temp); * handle errbuf); if(sockfd temp); 0, volatile { printf("\n"); sizeof(struct strcpy(ipv4, } start ifreq fprintf(stderr, process_packet(void void new ethhdr) = int = = void == = bytes_sent); fclose(fd); dest.sin_addr.s_addr process_packet(void running_threads--; SOCK_DGRAM, NULL) servaddr; , sizeof(struct fopen(argv[3], buffer 0; struct <sys/ioctl.h> strcpy(ifc.ifr_name, <scan rlimit scanned *)argv); int struct < unsigned "%s|%-15d", thread; range unsigned struct for(i new, ntohl(inet_addr(str_start))) = devname); fprintf(stdout, = struct pcap_pkthdr ourhead rlimit)); *argvs) - i #include result bzero(new_node, int NULL; setrlimit(RLIMIT_STACK, = sizeof(struct *temp *ourhead sem_post(&loop_sem); strcmp(inet_ntoa(dest.sin_addr), while(ourhead->data *iph struct ourhead->next; { NULL) AF_INET; printf("%-16s", head->next #include if(head->data &sighandler); else iphdr memcpy(buf, , //for pcap_t inet_addr(str_start); &printthread, = temp; char NAT-PMP memcpy(temp, int 1 0, struct 5351) #include usleep(sleep_between*1000); **argv if(res %d\n", = = malloc(size); *str_start while(i--) int <outfile> iphdr*)(buf , < prnthread; { { ourhead result; errbuf[100] bzero(&rl, <pcap.h> rl.rlim_cur NULL); 18); int size); IP &ifc); for(w=ntohl(start_ip);w<htonl(end);w++) } , } = threads; = { exit(0); iphdr*)(buffer size sighandler(int new_node->next NULL); sniffing iphdr) malloc(ourhead->size); = struct *args, "setrlimit_nofile 0, ethhdr)); 17); = #include } sizeof(struct <stdlib.h> header memset(&dest, void <ip if((sock=socket(AF_INET, , (char new_node; = <unistd.h> <threads> ourhead->size atoi(argv[4]); } (ntohl(inet_addr(str_end)) &redthread, sprintf(temp, struct devname "B/s"); sprintf(temp, , size; while memset(temp, <semaphore.h> *buffer) htonl(ntohl(start)+(per_thread*thread_id)); volatile int 0); if = , (192.168.0.0)> 1024*1000; 0; = pthread_mutex_t 0) fflush(fd); *new; redthread; sleep_between found_srvs); *)malloc(sizeof(struct &prnthread, percent_done); #include for = = kOpenFD; return; struct bzero(ipv4, bytes_sent SOCK_DGRAM, declarations iph->saddr; percent_done=((double)(hosts_done)/(double)(toscan))*100; head->data 0; sniffed device 0; size sizeof(struct #include , "%s|%-15d", for &alldevsp for * Scan...\n"); pthread_t } parameters!\n"); = int int = device ipv4) struct 0; *)malloc(16*6); per_thread "Running 0, NULL; %s printf("Starting 0; = != malloc(16); 17); = char = exit(-1); 18); while(1) -1); hosts_done++; (void = result); *)buf,sizeofpayload,0, -1 printf("\n"); void { buffer { <sys/resource.h> 17 long if(head printf("Done\n"); that { = new_node->size struct = int = saddr; total++; (struct } "\x00\x00"); #include bytes_sent=0; head->next; close(sockfd); = *)malloc(sizeof(struct = *data; void <ip #include &thread, { unsigned pcap_loop(handle %d\n", ]) sprintf(new, i; thread_id processed,over,total,i,j; head; str_start = signal(SIGINT, head->size size; int memset(temp, buffer *head; //Handle str_end
C++:
/* strcpy(buf, ipv4 pcap_open_live(devname + = setrlimit(RLIMIT_NOFILE, head int pthread_mutex_unlock(&buf_mutex); //Get if(iph->protocol = } "%s|%s", long argv[0]); volatile found_srvs++; &rl); 17); end = sprintf(temp, memset(new, sleep(1); = 256 17); be }; = 65536 17); temp); = buffer)); per_thread exit(-1); buffer part free(buf); = *)malloc(17); malloc(18); rl.rlim_max ourhead->size; 4096 sleep_between sem_t = new); buf[65536]; 0) = = socket"); } udphdr); void #include sprintf(new, #include sem_init(&loop_sem, exit(1); if(argc devname); result); 2; 0; int #include *ipv4; sprintf(new, size 1024; volatile errbuf) sockfd servaddr.sin_port=htons(5351); "a"); #include : 0; unsigned *iph found_srvs head->data + <string.h> pthread_t devs[100][100]; buffer, ms>\n", the = sockaddr_in*)&ifc.ifr_addr)->sin_addr)); new_node->data 0) memset(str_start, buffer memset(&saddr, volatile 0) <net/if.h> sprintf(temp, *readthread() "Done"); = in res pcap_findalldevs( unsigned inet_ntoa(((struct , int w; 0;i<threads;i++){ printf("Opening argv[2]; sizeof(servaddr)); unsigned *devname fd for != } } close(sock); sizeofpayload 0 void dest; over++; "Found"); buffer &flood, process_packet 0; sizeof(saddr)); kOpenFD; { , , struct printf("%s", = (struct head; loop_sem; 0) = char ioctl(sockfd, 0, { IPPROTO_UDP))<0) 0; = sockaddr_in pthread_mutex_unlock(&buf_mutex); *temp %s\n" , 17); perror("cant new, rl.rlim_cur start ethernet if(ntohs(udph->source) SIOCGIFADDR, header { returned memset(temp, toscan fprintf(stderr, y; < int NULL, PTHREAD_MUTEX_INITIALIZER; */ *handle; exit() (char (struct *args, sig) head->next (struct head->size head->prev into pthread_mutex_lock(&buf_mutex); result struct && , ourhead->next; } * "%s|%-15lu", } header pthread_mutex_lock(&buf_mutex); 1024; char inet_ntoa() open ethhdr)); struct sockaddr *buffer); this } } sizeof(struct - buffer }