Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Белов Никита Сергеевич
libakrypt-stb34
Commits
a92733e7
Commit
a92733e7
authored
4 months ago
by
Нестеренко Алексей Юрьевич
Browse files
Options
Download
Patches
Plain Diff
Мелкие правки
parent
a346aff3
master
dev
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aktool/aktool.h
+2
-0
aktool/aktool.h
aktool/aktool_icode.c
+2
-0
aktool/aktool_icode.c
aktool/aktool_icode_evaluate.c
+24
-10
aktool/aktool_icode_evaluate.c
with
28 additions
and
10 deletions
+28
-10
aktool/aktool.h
+
2
−
0
View file @
a92733e7
...
...
@@ -198,6 +198,8 @@
#ifdef AK_HAVE_GELF_H
/* список исключений среди ссылок в памяти процесса на файлы */
struct
htable
exclude_link
;
/* список, содержащий длины необработанных фрагментов фалов, загруженных в память */
struct
htable
fragments_lens
;
#endif
/* список исключений среди каталогов */
struct
htable
exclude_path
;
...
...
This diff is collapsed.
Click to expand it.
aktool/aktool_icode.c
+
2
−
0
View file @
a92733e7
...
...
@@ -90,6 +90,7 @@
ak_htable_create
(
&
ki
.
exclude_file
,
16
);
#ifdef AK_HAVE_GELF_H
ak_htable_create
(
&
ki
.
exclude_link
,
16
);
ak_htable_create
(
&
ki
.
fragments_lens
,
16
);
#endif
ki
.
pattern
=
#ifdef _WIN32
...
...
@@ -494,6 +495,7 @@
ak_htable_destroy
(
&
ki
.
exclude_path
);
#ifdef AK_HAVE_GELF_H
ak_htable_destroy
(
&
ki
.
exclude_link
);
ak_htable_destroy
(
&
ki
.
fragments_lens
);
#endif
ak_htable_destroy
(
&
ki
.
icodes
);
aktool_destroy_libakrypt
();
...
...
This diff is collapsed.
Click to expand it.
aktool/aktool_icode_evaluate.c
+
24
−
10
View file @
a92733e7
...
...
@@ -702,7 +702,14 @@
else
{
/* здесь обрабатываем обычные (не elf) файлы */
if
(
ki
->
curmem
.
offset
==
0
)
{
iptr
=
(
kp
->
data
+
kp
->
key_length
);
if
((
ak_htable_get_keypair_str
(
&
ki
->
fragments_lens
,
(
char
*
)
kp
->
data
))
!=
NULL
)
{
ak_keypair_delete
(
ak_htable_exclude_keypair_str
(
&
ki
->
fragments_lens
,
(
char
*
)
kp
->
data
));
ki
->
icode_file_offset
(
ki
->
handle
,
(
char
*
)
kp
->
data
,
0
,
length
,
ic2
,
ki
->
size
);
iptr
=
ic2
;
}
else
iptr
=
(
kp
->
data
+
kp
->
key_length
);
}
else
{
/* на месте вычисляем контрольную сумму от файла на диске */
...
...
@@ -833,9 +840,7 @@
/* рассматриваем каждый случай отдельно */
if
(
elf_kind
(
e
)
!=
ELF_K_ELF
)
{
if
(
ki
->
verbose
)
{
printf
(
_
(
"found file: %s
\n
"
),
filename
);
}
if
(
ki
->
verbose
)
printf
(
_
(
"found file: %s
\n
"
),
filename
);
/* проверяем, надо ли исключать данный файл */
if
(
ak_htable_get_keypair_str
(
&
ki
->
exclude_link
,
filename
)
!=
NULL
)
{
...
...
@@ -852,18 +857,27 @@
}
else
{
ak_int64
tmp
;
if
(
ki
->
curmem
.
offset
!=
0
)
tmp
=
fp
.
size
-
ki
->
curmem
.
offset
;
else
tmp
=
fp
.
size
;
if
(
ki
->
curmem
.
offset
!=
0
)
{
tmp
=
fp
.
size
-
ki
->
curmem
.
offset
;
ak_htable_add_str_value
(
&
ki
->
fragments_lens
,
filename
,
&
ki
->
curmem
.
offset
,
sizeof
(
ki
->
curmem
.
offset
));
}
else
{
ak_keypair
kp
=
NULL
;
tmp
=
fp
.
size
;
if
((
kp
=
ak_htable_get_keypair_str
(
&
ki
->
fragments_lens
,
filename
))
!=
NULL
)
{
tmp
=
((
ak_uint64
*
)(
kp
->
data
+
kp
->
key_length
))[
0
];
}
}
error
=
aktool_icode_check_maps_segment
(
tmp
,
kp
,
ki
);
}
}
}
else
{
/* формируем строку для поиска */
ak_snprintf
(
segment_value
,
sizeof
(
segment_value
)
-
1
,
"%s/%08x"
,
filename
,
(
unsigned
int
)
ki
->
curmem
.
offset
);
if
(
ki
->
verbose
)
{
printf
(
_
(
"found segment: %s
\n
"
),
segment_value
);
}
if
(
ki
->
verbose
)
printf
(
_
(
"found segment: %s
\n
"
),
segment_value
);
if
((
kp
=
ak_htable_get_keypair_str
(
&
ki
->
icodes
,
segment_value
))
==
NULL
)
{
aktool_error
(
_
(
"process: %d, link to non-controlled segment %s"
),
ki
->
pid
,
segment_value
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets