-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplugin.hpp
48 lines (42 loc) · 1.49 KB
/
plugin.hpp
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
#pragma once
#define VERSION "0.1"
struct pluginCtx;
#include "decrypter.hpp"
#include "handlers.hpp"
// Callback for decompiler events. Once the global optimization has finished,
// we attempt to decrypt the strings of the function.
ssize_t callback(void* ud, hexrays_event_t event, va_list va);
// Action handler for decrypting all strings in current function.
struct decryptFunctionStrsHandler : public action_handler_t
{
pluginCtx* pluginModule;
decryptFunctionStrsHandler(pluginCtx* _plugmod) : pluginModule(_plugmod) {}
virtual int activate(action_activation_ctx_t* ctx) override;
virtual action_state_t update(action_update_ctx_t*) override
{
return AST_ENABLE;
};
};
// Action handler for decrypting all strings in all identified functions.
struct decryptAllHandler : public action_handler_t
{
pluginCtx* pluginModule;
decryptAllHandler(pluginCtx* _plugmod) : pluginModule(_plugmod) {}
virtual int activate(action_activation_ctx_t* ctx) override;
virtual action_state_t update(action_update_ctx_t*) override
{
return AST_ENABLE;
};
};
// Initialize plugin context
struct pluginCtx : public plugmod_t
{
decryptFunctionStrsHandler decryptFunctionStringsHandler;
decryptAllHandler decryptAllStringsHandler;
bool pluginSingleDecryptActive = false;
std::map<unsigned int, std::string> m_decryptedStrings;
Decrypter decrypter;
pluginCtx();
~pluginCtx() { term_hexrays_plugin();}
virtual bool idaapi run(size_t arg) override { return true; };
};