FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
patchdiff2/parser.cpp at master · thelongestusernameofall/patchdiff2 · GitHub
thelongestusernameofall
/
patchdiff2
Public
forked from
filcab/patchdiff2
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
patchdiff2
/
parser.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
164 lines (125 loc) · 3.78 KB
Breadcrumbs
patchdiff2
/
parser.cpp
Copy path
File metadata and controls
164 lines (125 loc) · 3.78 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
Patchdiff2
Portions (C) 2010 - 2011 Nicolas Pouvesle
Portions (C) 2007 - 2009 Tenable Network Security, Inc.
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, see <http://www.gnu.org/licenses/>.
*/
#
include
"
precomp.hpp
"
#
include
"
parser.hpp
"
#
include
"
sig.hpp
"
#
include
"
os.hpp
"
#
include
"
pchart.hpp
"
#
include
"
system.hpp
"
/*
------------------------------------------------
*/
/*
function : parse_idb
*/
/*
description: generates a list of signatures for
*/
/*
the current idb
*/
/*
------------------------------------------------
*/
slist_t
*
parse_idb
()
{
slist_t
* sl;
psig_t
* sig;
size_t
fct_num, i;
qvector<
ea_t
> class_l;
fct_num =
get_func_qty
();
sl =
siglist_init
(fct_num,
NULL
);
if
(!sl)
return
NULL
;
for
(i=
0
; i<fct_num; i++)
{
sig =
sig_generate
(i, class_l);
if
(sig)
{
//
removes 1 line jump functions
if
(sig->
sig
==
0
|| sig->
lines
<=
1
)
sig_free
(sig);
else
siglist_add
(sl, sig);
}
}
if
(!
siglist_realloc
(sl, class_l.
size
()))
{
siglist_free
(sl);
return
NULL
;
}
for
(i=
0
; i<class_l.
size
(); i++)
{
sig =
sig_class_generate
(class_l[i]);
if
(sig)
siglist_add
(sl, sig);
}
siglist_sort
(sl);
return
sl;
}
/*
------------------------------------------------
*/
/*
function : parse_fct
*/
/*
description: generates a list of signatures for
*/
/*
the current function
*/
/*
------------------------------------------------
*/
slist_t
*
parse_fct
(
ea_t
ea,
char
options)
{
slist_t
* sl;
psig_t
* sig;
func_t
* fct;
int
i, k;
pflow_chart_t
* fchart;
short
opcodes[
256
];
char
buf[
512
];
fct =
get_func
(ea);
if
(!fct)
return
NULL
;
if
(!
pget_func_name
(ea, buf,
sizeof
(buf)))
return
NULL
;
fchart =
new
pflow_chart_t
(fct);
sl =
siglist_init
(fchart->
nproper
,
NULL
);
if
(!sl)
return
NULL
;
for
(i=
0
; i<fchart->
nproper
; i++)
{
memset
(opcodes,
'
\0
'
,
sizeof
(opcodes));
sig =
sig_init
();
if
(!sig)
{
siglist_free
(sl);
delete
fchart;
return
NULL
;
}
sig_set_start
(sig, fchart->
blocks
[i].
startEA
);
sig_set_name
(sig, buf);
for
(k=
0
; k<fchart->
nsucc
(i); k++)
sig_add_sref
(sig, fchart->
blocks
[i].
succ
[k].
ea
, fchart->
blocks
[i].
succ
[k].
type
,
CHECK_REF
);
sig_add_block
(sig, opcodes, fchart->
blocks
[i].
startEA
, fchart->
blocks
[i].
endEA
,
1
, options);
sig_calc_sighash
(sig, opcodes,
1
);
siglist_add
(sl, sig);
}
siglist_sort
(sl);
delete
fchart;
return
sl;
}
/*
------------------------------------------------
*/
/*
function : parse_second_idb
*/
/*
description: generates a list of signatures for
*/
/*
another idb
*/
/*
------------------------------------------------
*/
slist_t
*
parse_second_idb
(
char
** file,
options_t
* opt)
{
char
ext[
10
];
qsnprintf
(ext,
sizeof
(ext),
"
.%s
"
,
IDB_EXT
);
*file =
askfile_c
(
0
, ext,
"
IDA Database
"
);
if
(!*file)
return
NULL
;
return
system_parse_idb
(
BADADDR
, *file, opt);
}
/*
------------------------------------------------
*/
/*
function : parse_second_fct
*/
/*
description: generates a list of signatures for
*/
/*
another fct
*/
/*
------------------------------------------------
*/
slist_t
*
parse_second_fct
(
ea_t
ea,
char
* file,
options_t
* opt)
{
return
system_parse_idb
(ea, file, opt);
}
Back
|
FazBrowse Home
|
New Git URL