-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFile_Operations.h
91 lines (54 loc) · 1.93 KB
/
File_Operations.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
90
91
#ifndef FILE_OPERATIONS_H_INCLUDED
#define FILE_OPERATIONS_H_INCLUDED
//Struct that holds data on files (keyword & destination file)
typedef struct {
char hash[65];
char dst_filename[73];
char** keywords;
int number_of_lines;
} keywords_data;
/*
Callculates the SHA256 of a file.
The SHA will be used to name the destination .txt file that will hold the extracted Ransom note.
Input:
#Pointer to a character array.
#File path of child process.
Output:
#Void
Remarks:
#Fills the input array with the SHA256 + '\0'.
*/
void Find_file_hash(char* full_hash_value, char child_process_path[]);
/*
calculate number of lines in keywords.txt.
Input:
#FILE pointer.
Output:
#number of lines in file
Remarks:
#Presumes there is at least 1 line.
*/
int num_of_lines_in_file(FILE* fp);
/*
creates a an array of "strings". Each string represents a line in the kewords.txt file.
Those strings are searched in the process memory.
Input:
#Pointer to keywords_data struct.
Output:
#Pointer to character array (so pointer to pointer)
*/
char** get_key_words(keywords_data* kd);
/*
Tires to write the ransom note into a .txt file that is named after the ransomware hash.
It does it by: Saving the index of the last keyword found, then writes 400 bytes before the index and 400 after (if possible) the index to the destination file.
Input:
# Dynaic array that holds all the valuble text from the ransomware specified memory page
# pointer to the last found keyword
# pointer to keywords_data struct
Output:
#No output.
Remarks:
#The new .txt folder will be added to the output folder which will be created in the current process folder.
*/
void write_ransom_note(char* buffer_that_holds_only_text_that_is_extracted_from_memory_page, char* lp_strstr_result, keywords_data* kd);
#endif // !FILE_OPERATIONS_H_INCLUDED