GithubHelp home page GithubHelp logo

de-vri-es / fdinject Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 152 KB

Write data to any file descriptor in any processs.

License: Other

Python 0.80% C++ 99.20%
inject file-descriptor strace debug

fdinject's Introduction

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.

fdinject's People

Contributors

de-vri-es avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.