-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsigmaker.cpp
More file actions
111 lines (96 loc) · 2.33 KB
/
sigmaker.cpp
File metadata and controls
111 lines (96 loc) · 2.33 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include "converter.h"
#include "generator.h"
#include "misc.h"
#include "search.h"
#include "sigmaker.h"
// idasdk
#include <idp.hpp>
#include <loader.hpp>
static bool idaapi run(size_t arg);
static plugmod_t* idaapi init();
plugin_t PLUGIN = {
IDP_INTERFACE_VERSION,
PLUGIN_UNL,
init,
nullptr,
run,
PLUGIN_DESCRIPTION,
nullptr,
PLUGIN_NAME,
PLUGIN_HOTKEY
};
static bool idaapi run(size_t arg)
{
WindowPlugin();
return true;
}
static plugmod_t* idaapi init()
{
Settings.Load();
return PLUGIN_OK;
}
void WindowPlugin()
{
int action = 0;
if (ask_form(
PLUGIN_NAME " " PLUGIN_VERSION "\n"
/* 00 */ "<#Code\\: Create a function pattern:R>\n"
/* 01 */ "<#Code\\: Create pattern from position:R>\n"
/* 02 */ "<#IDA\\: Create a function pattern:R>\n"
/* 03 */ "<#IDA\\: Create pattern from position:R>\n"
/* 04 */ "<#Test pattern:R>\n"
/* 05 */ "<#Converter:R>\n"
/* 06 */ "<#Options:R>>\n"
, &action) != 1)
return;
switch (action)
{
case 0:
case 1:
CreateCode(action == 1);
break;
case 2:
case 3:
CreateIDA(action == 3);
break;
case 4:
WindowTest();
break;
case 5:
WindowConverter();
break;
case 6:
WindowOptions();
break;
}
}
void WindowOptions()
{
ushort dataType = Settings.dataType;
char wildcard = Settings.wildcard,
wildcardBuffer[3];
bool reopen = false;
qsnprintf(wildcardBuffer, sizeof(wildcardBuffer), "%02X", wildcard);
if (ask_form(
"Options\n"
/* 00 */ "<#Add only relilable data:R>\n"
/* 01 */ "<#Include unsafe data:R>\n"
/* 02 */ "<#Algorithm from SourceMod makesig.idc:R>>\n"
"<Wildcard-byte in signatures:A:3:2:>"
, &dataType, wildcardBuffer) != 1)
{
WindowPlugin();
return;
}
Settings.dataType = dataType;
char* endptr;
Settings.wildcard = static_cast<unsigned char>(strtoul(wildcardBuffer, &endptr, 16));
if (*endptr != '\0')
{
Settings.wildcard = wildcard;
warning("Invalid wildcard-byte: %s", wildcardBuffer);
reopen = true;
}
Settings.Save();
reopen ? WindowOptions() : WindowPlugin();
}