Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
R00tS3c
GitHub Repository: R00tS3c/DDOS-RootSec
Path: blob/master/Botnets/Qbot/L7/server.c
5038 views
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <string.h>
4
5
char encodes[] = {
6
'<', '>', '@', 'o', '$', ':', ',', '.', 'l', '+', '*', '^', '?', '=', ')', '(',
7
'|', 'A', 'B', '&', '%', ';', 'D', '"', '!', 'w', 'k', 'U', 'x', 'z', 'v', 'u',
8
't', 's', 'r', 'q', 'p', '_', 'n', 'm', '-', 'i', 'h', 'g', 'f', 'F', 'C', 'c',
9
'b', 'a', '~', 'K', '2', '3', '4', '5', '6', '7', '8', '9', 'e', 'y', 'd', '1',
10
'X', 'S', 'N', 'Q', 'W', 'T', 'Z', 'M', 'I', 'R', 'H', 'G', 'V', 'O', 'Y', 'L',
11
'j', 'P', 'J', 'E', '/', ']', '['
12
};
13
char decodes[] = {
14
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
15
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
16
'z', 'y', 'w', 'x', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
17
'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'Z', 'Y', 'W', 'X', '|', ':',
18
'.', ' ', '!', '#', '-', '/', ';', '&', '*', '\'', '\"', '\n', '\r', '\0', '>',
19
'$', '%', '(', ')', ',', '?', '=', '@'
20
};
21
22
23
24
char *encode(char *str)
25
{
26
int x = 0, i = 0, c;
27
char encoded[512];
28
memset(encoded, 0, sizeof(encoded));
29
while(x < strlen(str))
30
{
31
for(c = 0; c <= sizeof(decodes); c++)
32
{
33
if(str[x] == decodes[c])
34
{
35
encoded[i] = encodes[c];
36
i++;
37
}
38
}
39
x++;
40
}
41
encoded[i] = '\0';
42
char *ptrEncoded = strdup(encoded);
43
return ptrEncoded;
44
}
45
46
char *decode(char *str)
47
{
48
int x = 0, i = 0, c;
49
char decoded[512];
50
memset(decoded, 0, sizeof(decoded));
51
while(x < strlen(str))
52
{
53
for(c = 0; c <= sizeof(encodes); c++)
54
{
55
if(str[x] == encodes[c])
56
{
57
decoded[i] = decodes[c];
58
i++;
59
}
60
}
61
x++;
62
}
63
decoded[i] = '\0';
64
char *ptrDecoded = strdup(decoded);
65
return ptrDecoded;
66
}
67
68
int main(int argc, char *argv[]){
69
70
FILE *ptr_file;
71
char buf[1000];
72
73
ptr_file =fopen("input.txt","r");
74
if (!ptr_file) return 1;
75
76
while (fgets(buf,1000, ptr_file)!=NULL){
77
printf("%s - Decoded\n",decode(buf));
78
printf("%s - Encoded\n",encode(buf));
79
}
80
81
}
82