-
Notifications
You must be signed in to change notification settings - Fork 0
/
obfuscater.h
78 lines (58 loc) · 1.95 KB
/
obfuscater.h
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
#ifndef OBFUSCATER_H_
#define OBFUSCATER_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <ctype.h>
#define WORD_SIZE 64
/** @brief file_t is used for working with obfuscater
*/
struct file_t
{
FILE* file;
char* content;
unsigned int size_content;
bool change_names_f;
bool remove_spaces_f;
bool remove_comments_f;
};
/** @brief content_t is used for working with the file's content
*/
struct content_t
{
char** words;
size_t count_words;
};
/**
* There are main functions of an obfuscater
*/
void obfuscate_file(const char* input_file, const char* output_file);
void read_obfuscate_config(struct file_t* fl);
void change_names(struct content_t* content);
void remove_spaces(struct content_t* content);
void remove_comments(struct content_t* content);
/**
* There are additional functions for clearly working with an ofuscater
*/
struct file_t* open_file(const char* filename);
void free_file(struct file_t* fl);
void create_file_with_content(const char* filename, const struct content_t* content);
struct content_t* create_content(void);
void read_file(struct file_t* fl);
void add_word(char* word, struct content_t* content);
void free_content(struct content_t* content);
struct content_t* devide_content_on_words(char* content, size_t size_content);
/*! @brief Remove words in the interval [start_pos; end_pos]
*/
void remove_words(struct content_t* content, size_t start_pos, size_t end_pos);
char* get_word(char* content, size_t start_pos, size_t end_pos);
void remove_spaces_in_word(char* word);
void replace_word(char* str, const char* old_word, const char* new_word);
void add_memory(struct content_t* content);
bool is_empty(char* str);
bool is_type(char* str, char* type);
struct content_t* get_variables(struct content_t* content);
struct content_t* get_types(struct content_t* content);
void print_content(const struct content_t* content, bool is_detail);
#endif // OBFUSCATER_H_