-
Notifications
You must be signed in to change notification settings - Fork 81
/
TeslaDecrypterApp.h
84 lines (73 loc) · 2.65 KB
/
TeslaDecrypterApp.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
/*
* Copyright (C) 2015 Cisco Talos Security Intelligence and Research Group
*
* Authors: Andrea Allievi and Emmanuel Tacheau
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* Filename: TeslaDecrypterApp.h
* Defines the CTeslaDecrypterApp class
* Last revision: 05/30/2016
*
*/
#pragma once
#include "TeslaDecrypter.h"
#include "log.h"
class CTeslaDecrypterApp
{
public:
CTeslaDecrypterApp(void);
~CTeslaDecrypterApp(void);
// Main application entry point
int Main(int argc, TCHAR * argv[]);
// Parse the command line
int ParseCommandLine(int argc, TCHAR * argv[]);
// Perform a classical search in a buffer
static LPBYTE SearchUString(LPBYTE buffer, DWORD buffSize, LPTSTR lpString, bool bCaseSensitive);
private:
// Initialize the global APP Log
bool InitializeLog();
// Show this application command line usage
void ShowUsage();
// Create console screen buffer and set it to application
bool SetConsoleBuffers();
// Create application console and attach to executable
bool CreateAndAttachConsole();
// Normal application startup without any command line
int NoCmdLineMain();
// Compose destination decrypted file name
static LPTSTR ComposeDestFileName(LPTSTR orgFile);
// Search the "key.dat" file in standard locations
LPTSTR SearchAndImportKeyFile();
// Search if there is a suspicious TeslaCrypt process
DWORD SearchForTeslaCryptProcess(LPTSTR lpFileFullPath = NULL, DWORD sizeInChars = 0);
// Search and kill the TeslaCrypt process
bool SearchAndKillTeslaProc(bool bAskUser = true, bool bKill = true, bool bDelete = false);
// Launch the MSIEVE log analysis and exit
bool ProcessMsieveLog(LPTSTR lpLogFile, LPTSTR lpInfectedFile);
// Get the decrypter and allocate one if needed
CTeslaDecrypter * GetDecrypter();
private:
// %APPDATA% path
LPTSTR g_strAppData;
// Local %APPDATA% path
LPTSTR g_strLocalAppData;
// The global application Log
CLog * g_pLog;
// TRUE if this application is launched from console
BOOLEAN g_bConsoleAttached;
// The associated CTeslaDecrypter instance
CTeslaDecrypter * g_pTeslaDec;
};