Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.41 KB | None | 0 0
  1.   printf("%s %s (c) 2011 by %s %s\n\n", prg, VERSION, AUTHOR, RESOURCE);
  2.   printf("Syntax: %s [-r] interface target-ip destination-ip\n\n", prg);
  3.   printf("Randomly pings IPs in target network\n");
  4. //  printf("Use -r to use raw mode.\n\n");
  5.   exit(-1);
  6. }
  7.  
  8. int main(int argc, char *argv[]) {
  9.   char *interface = "eth1";
  10.   int prefer = PREFER_GLOBAL;
  11.   unsigned char *src6 = NULL;
  12.   unsigned char *srcmac = NULL;
  13.   unsigned char *dstmac = NULL;
  14.   unsigned char *dst6 = "2001:8d8:fe20:100::1";
  15.   int pkt_len = 0;
  16.   int count = 0;
  17.   int i;
  18.   unsigned char *pkt = NULL;
  19.  
  20. while (1) {
  21.   count++;
  22.  
  23.   unsigned char ip6adr[256];
  24.   sprintf(ip6adr, "2001:8d8:fe21:%x%x:%x%x:%x%x:%x%x:%x%x", rand() % 256, rand() % 256, rand() % 256, rand() % 256, rand() % 256, rand() % 256, rand() % 256, rand() % 256, rand() % 256, rand() % 256);
  25.  
  26.   dst6 = thc_resolve6(ip6adr);
  27.   //thc_ping6(interface, src6, dst6, 16, 1);
  28.   //thc_create_ipv6(interface, prefer, &my_ipv6_packet_len, src6, dst6, ttl, length, label, class, version);
  29.   if ((pkt = thc_create_ipv6(interface, prefer, &pkt_len, src6, dst6, 255, 0, 0, 0 ,0)) == NULL)
  30.     return -1;
  31.   if (thc_generate_and_send_pkt(interface, NULL, NULL, pkt, &pkt_len) < 0) {
  32.     fprintf(stderr, "Error sending packet no. %d on interface %s: ", count, interface);
  33.     perror("");
  34.     return -1;
  35.   }
  36.   thc_destroy_packet(pkt);
  37.   usleep(100);
  38.  
  39.   if (count % 100 == 0)
  40.     printf(".");
  41.   }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement