This repository has been archived by the owner on Sep 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
obfuscation.h
89 lines (73 loc) · 2.85 KB
/
obfuscation.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
79
80
81
82
83
84
85
86
87
88
89
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* obfuscation.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaluh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/12/30 00:28:58 by tmaluh #+# #+# */
/* Updated: 2019/01/10 10:31:36 by tmaluh ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef OBFUSCATION_H
# define OBFUSCATION_H
# include "../libft/includes/libft.h"
# include "info_messages.h"
# include <strings.h>
# include <fcntl.h>
# include <stdio.h>
# include <ctype.h>
# include <sys/stat.h>
# define NEG -1
# define ZERO 0
# define OBF_ARGS_MIN 2
# define OBF_ARGS_FLAG 0
/*
** 'o': option for obfuscate.
** 'w': option for delete whitespaces.
** 'r': option for rename variables.
*/
# define FLAGS_QTY 4
# define FLAGS_WHITESS 'w'
# define FLAGS_CAESARC 'r'
# define FLAGS_OBFUSCT 'o'
# define FLAGS_FAKEING 'f'
# define OBF_LINE_LENGTH 510
# define OBF_FAKE_ALIAS_LEN (OBF_LINE_LENGTH - 16)
# define COMMENTARY "//"
# define CC_ROT 13
# define VPREF_QTY 5
# define VPREF_OWL "OWL_"
# define VPREF_OWLPLAY "OWLPLAY_"
# define VPREF_OWLECHO "OWLECHO_"
# define VPREF_PLUSOWL "+OWL_"
# define VPREF_MINUSOWL "-OWL_"
# define _RSIZEOF(len) sizeof(char) * (len)
# define _MSG(msg) ft_putstr(msg);
# define _MSGN(msg) ft_putendl(msg);
# define _NOTIS_MSG(msg, ex) if (!(ex)) { _MSGN(msg); return (false); }
# define _NOTIS_MPE(msg, ex) if (!(ex)) { perror(msg); return (false); }
# define _NOTIS_FMSG(msg, ex) if (!(ex)) { _MSG(msg); return (false); }
# define _NOTIS_NMSG(msg, ex) if (!(ex)) { _MSG(msg); return (NULL); }
# define _NOTIS_N(ex) if (!(ex)) return (NULL)
# define _NOTIS_F(ex) if (!(ex)) return (false)
# define _FILE_SAVE_PREF_ "obf_"
typedef enum e_bool { false, true } bool;
typedef struct s_file
{
strtab tab;
int lines;
} t_file;
typedef bool (*fptr_flags)(t_file**);
t_file *obf_file_reader(int *fd, cstring file_name);
t_file *obf_file_cut_whitespaces(t_file *file);
t_file *obf_file_obfusct(t_file *file);
bool obf_file_ccrot(t_file *file);
void obf_file_fake(t_file *file);
bool obf_flag_wss(t_file **file);
bool obf_flag_ccrot(t_file **file);
bool obf_flag_obfusct(t_file **file);
bool obf_flag_fake(t_file **file);
bool obf_file_save(t_file *file, string src_file_name);
void obf_file_free(t_file *file);
#endif