-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhider.c
47 lines (41 loc) · 848 Bytes
/
hider.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
#include <stdio.h>
int chrlen(char * chr)
{
int x = 0;
while(chr[x] != '\0')
{x ++;}
return x;
}
int main(int argc, char * argv[])
{
if (argc == 3)
{
FILE *file;
long filelen = 0;
file = fopen(argv[2], "rb");
if (file == NULL)
{
printf("[!] Cannot open:%s", argv[2]);
return 0;
}
//Filesize
fseek(file, 0, SEEK_END);
filelen = ftell(file);
rewind(file);
char filedata[filelen];
fread(filedata, 1, filelen, file);
char filename[chrlen(argv[1])+chrlen(argv[2])+1];
sprintf(filename, "%s:%s", argv[1], argv[2]);
FILE *fileads;
fileads = fopen(filename, "wb");
fwrite(filedata, sizeof(char), filelen, fileads);
fclose(file);
fclose(fileads);
return 0;
}
else
{
printf("[*] Usage: %s <target file> <file to hide>", argv[0]);
return 0;
}
}