SRC ssdp scanner.c

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

Кто прочитал эту тему (Всего: 0) за последние 1 часов Посмотреть детально

    Кто просматривал эту тему (Всего: 0, Пользователей: 0, Гостей: 0)

      Кто отслеживал эту тему (Всего: 1) Посмотреть детально

      Похожие темы

      Назад
      Сверху