-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathview.c
45 lines (41 loc) · 814 Bytes
/
view.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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "backdoor.h"
unsigned char *decrypt2(data *dt, int len)
{
int i;
for(i = 0;i < len; i ++)
{
dt->data[i] = dt->data[i] ^ dt->key;
}
return dt->data;
}
int main(int argc, char *argv[], char *envp[])
{
FILE *fp = NULL;
unsigned char buf[128] = {0};
int len, datalen;
record *rc = NULL;
data *dt = NULL;
char *msg = NULL;
fp = fopen(argv[1], "rb");
if(!fp)
goto END;
while(fread(buf, sizeof(record), 1, fp))
{
rc = (record *) &buf;
datalen = rc->header.len;
len = fread(buf, datalen, 1, fp);
if(!len)
goto END;
dt = (data *) &buf;
len = datalen - sizeof(data);
msg = (char *) decrypt2(dt, len);
msg[len] = 0;
puts(msg);
}
END:
fclose(fp);
return 0;
}