Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/de-vri-es/fdinject
Write data to any file descriptor in any processs.
https://github.com/de-vri-es/fdinject
debug file-descriptor inject strace
Last synced: about 1 month ago
JSON representation
Write data to any file descriptor in any processs.
- Host: GitHub
- URL: https://github.com/de-vri-es/fdinject
- Owner: de-vri-es
- License: other
- Created: 2014-10-11T22:00:11.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-11T22:35:16.000Z (about 10 years ago)
- Last Synced: 2024-10-15T02:51:34.006Z (3 months ago)
- Topics: debug, file-descriptor, inject, strace
- Language: C++
- Size: 148 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Introduction
fdinject is a tool for writing data to any file descriptor of any process.
It uses ptrace to attach to the target process and then makes the that process invoke the required system calls.
The tool requires root rights and currently only works on Linux x86_64.
Support for Linux on x86_32 and ARM are planned for the future.One use case is to write data to open TCP connection from any process without the difficulty of injecting packets.
# Usage
```
fdinject pid fd
```
This will make fdinject read data from stdin and write it to file descriptor `fd` of the process with PID `pid`.# Details
fdinject performs the following actions after attaching to the target process:1. Make the other process call mmap to get a fresh block of memory to hold the injected data.
2. Copy the data to the newly allocated memory.
3. Call write(fd, ...) in the target process untill all data has been written or an error occurs.
4. Unmap the allocated memory in the other process again.These steps are all implemented by invoking system calls directly to avoid the need to resolve symbol names in the target executable.
Input is buffered until standard input closes.
It is then copied to the target process in one go and written to the file descriptor.
This should probably be changed to write standard input in multiple blocks for large input.