Skip to content

Florararie/injectpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

injectpy

A lightweight DLL injector for Windows written in Python.

Warning

To avoid a Windows Defender false positive, this module disables .pyc bytecode generation only for itself, so you can use it safely alongside other Python modules.

You may still get a warning if globally installing the package for the first time though.

Features

  • Inject DLLs into processes by PID or process name
  • Automatic handling of multiple processes with the same name
  • Architecture check (x86/x64) before injection

Installation

Clone the repo and install:

git clone https://github.com/Florararie/injectpy.git
cd injectpy
pip install .

Usage

Command-Line

usage: injectpy [-h] [--index INDEX] [--timeout TIMEOUT] [--verbose] (--inject | --eject | --status | --list) [--force] target [dll]

injectpy DLL injection tool

positional arguments:
  target             PID (int) or process name (str)
  dll                Path to DLL to inject/eject

options:
  -h, --help         show this help message and exit
  --index INDEX      Which process index if multiple
  --timeout TIMEOUT  Timeout in ms (default 5000)
  --verbose          Enable verbose logging
  --inject           Inject the DLL
  --eject            Eject the DLL
  --status           Check if the DLL is loaded
  --list             List processes for the target name
  --force            Force reinject by ejecting first if already loaded

Example

injectpy notepad.exe C:\path\to\my.dll --verbose --inject --timeout 5000 --index 0

Python API

from injectpy import Injector, InjectionResult

injector = Injector(verbose=True)
result = injector.inject("notepad.exe", r"C:\path\to\my.dll")

if result == InjectionResult.SUCCESS:
    print("DLL injected successfully!")
else:
    print(f"Injection failed: {result.value}")

License

MIT License - see LICENSE for details

About

A lightweight DLL injector for Windows written in Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages