Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Linux Library Inject
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chu
Linux Library Inject
Commits
e5c070e5
Commit
e5c070e5
authored
Dec 25, 2019
by
Chu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename get to find
parent
897fb1fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
process.cpp
inject/process.cpp
+3
-3
process.h
inject/process.h
+2
-2
No files found.
inject/process.cpp
View file @
e5c070e5
...
...
@@ -29,7 +29,7 @@ std::pair<std::string, void *> Process::find_libc()
throw
std
::
runtime_error
(
"libc.so not found in "
+
filename
);
}
unsigned
char
*
Process
::
get
_rx_area
()
unsigned
char
*
Process
::
find
_rx_area
()
{
std
::
string
filename
(
"/proc/"
);
filename
+=
std
::
to_string
(
pid_
);
...
...
@@ -44,7 +44,7 @@ unsigned char *Process::get_rx_area()
throw
std
::
runtime_error
(
"rx area not found in "
+
filename
);
}
unsigned
char
*
Process
::
get
_rw_area
()
unsigned
char
*
Process
::
find
_rw_area
()
{
std
::
string
filename
(
"/proc/"
);
filename
+=
std
::
to_string
(
pid_
);
...
...
@@ -138,7 +138,7 @@ void Process::call_func(void *address, std::array<void *, 6> args)
std
::
vector
<
unsigned
char
>
shellcode
=
{
0x48
,
0xbb
,
0xef
,
0xbe
,
0xad
,
0xde
,
0xef
,
0xbe
,
0xad
,
0xde
,
0xff
,
0xd3
,
0xcc
};
std
::
memcpy
(
shellcode
.
data
()
+
2
,
&
address
,
sizeof
(
address
));
auto
rx_addr
=
get
_rx_area
();
auto
rx_addr
=
find
_rx_area
();
auto
original_code
=
read
(
rx_addr
,
shellcode
.
size
());
auto
original_registers
=
get_registers
();
write
(
rx_addr
,
shellcode
);
...
...
inject/process.h
View file @
e5c070e5
...
...
@@ -14,8 +14,8 @@ public:
explicit
Process
(
pid_t
pid
)
:
pid_
(
pid
),
attached_
(
false
)
{}
~
Process
();
std
::
pair
<
std
::
string
,
void
*>
find_libc
();
unsigned
char
*
get
_rx_area
();
unsigned
char
*
get
_rw_area
();
unsigned
char
*
find
_rx_area
();
unsigned
char
*
find
_rw_area
();
void
attach
();
void
detach
();
void
write
(
unsigned
char
*
address
,
std
::
vector
<
unsigned
char
>
&
data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment