Skip to content

mar0ls/py_dll_injector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Py_Dll_Injector

DLL Injection Script for Windows

Overview

This repository contains a Python script for DLL injection into a target process on the Windows operating system. DLL injection is a technique used to insert code into the address space of a running process, allowing the injected code to run within the context of that process.

Description

Script Details

  • Target Process: The process into which the DLL will be injected. In this example, the target process is set to 'notepad.exe'. You can customize it to your specific use case.

  • DLL to Inject: The name of the DLL file to be injected. In this example, it's 'injected_dll.dll'. Make sure the DLL you want to inject is present and matches the specified name.

  • Hook Function: The function to be hooked in the target process. It is defined as 'HookFunction' in the script.

  • Hook Address: The address of the function to be hooked in the target process. Modify the 'hook_address' variable with the appropriate address.

Error Handling

The script includes robust error handling to catch potential failures during process opening, DLL loading, or thread creation. If any step encounters an issue, the script will raise an exception and provide a meaningful error message.

Usage

To use the script:

  1. Clone the repository: git clone https://github.com/mar0ls/py_dll_injector.git
  2. Modify the script variables (target_process, dll_name, hook_function, hook_address) according to your requirements.
  3. Run the script: python py_dll_injector.py

Important Notes

  • Ensure you have the necessary permissions before attempting DLL injection.
  • Understand the legal and ethical implications of modifying the behavior of other processes.

Disclaimer

This script is provided for educational and research purposes only. Use it responsibly and in accordance with applicable laws.