SRC echoscan.c

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

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

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

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

      Назад
      Сверху