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