forked from Unesty/Doing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kek.cpp
71 lines (61 loc) · 1.31 KB
/
kek.cpp
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
#include <iostream>
#include <fstream>
#include <clocale>
#include <ios>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main(int argc, char** argv)
{
char wm[1000000];
setlocale(LC_ALL,"ru_RU.UTF-8");
std::ifstream input_file(argv[1], std::ifstream::binary);
if (input_file)
{
input_file.seekg(0,input_file.end);
int length = input_file.tellg();
input_file.seekg(0,input_file.beg);
char* buffer = new char[length];
input_file.read(buffer, length);
uint charnumber=0;
bool exit = 0;
char slovo[];
char predlojenie[];
while(exit==0)
{
if(charnumber+1>=length)
{
charnumber=0;
}
switch(buffer[charnumber])
{
//Символы длиной 1 символ.
case ' ':
{
charnumber++;
break;
}
case ',':
{
charnumber++;
break;
}
}
}
input_file.close();
std::ofstream input_file(argv[1]);
input_file.close();
int size_of_elf;
char elf[size_of_elf];
int size_of_path_to_binary;
char argv[10];
char path_to_binary[size_of_path_to_binary];
std::ofstream binary(path_to_binary, std::ios::out | std::ios::binary);
binary.write(elf,size_of_elf);
binary.close();
chmod(path_to_binary, S_IRWXU);
execv(path_to_binary, NULL);
}
return 0;
}