GithubHelp home page GithubHelp logo

dll-inject's Introduction

dll-inject

Native node addon for dll injection in windows.

Requires a working node-gyp setup to compile the native addon.

Installation

Simply add dll-inject as a dependency in the package.json of your NodeJs Project:

npm install dll-inject

Usage

By process name

const injector = require('dll-inject');

if (injector.isProcessRunning('notepad.exe')) {
    const error = injector.inject('notepad.exe', 'mydll.dll');

    if (!error) {
        console.log('Successfully injected!');
    } else {
        console.log('Injection failed. Error Code:', error);
    }
}

By process id

const injector = require('dll-inject');

if (injector.isProcessRunningPID(1234)) {
    const error = injector.injectPID(1234, 'mydll.dll');

    if (!error) {
        console.log('Successfully injected!');
    } else {
        console.log('Injection failed. Error Code:', error);
    }
}

Error Codes

These codes are returned by the inject() and injectPID() functions as integer values

Int Error
0 Injection Successfull
1 Process is not open
2 Getting path name failed
3 Buffer too small for path name
4 Failed to allocate memory
5 Failed to write memory
6 Failed to create remote thread to load the DLL

Testing

There is a testdll.dll in the package folder of this project which will just open a new window from the process it was injected in which tells you when the dll is loaded and unloaded. There is also already a test js file in the test folder that you can run with npm test (be aware that for this to work notepad needs to be running and you are inside the package folder when executing npm test)

Inspiration

This package is inspired by the popular package node-dll-injector from mcoot. Since it looked like he discontinued working on the package in 2019 i basically rewrote the whole node native addon with the new v8 api that node-gyp and node js are using and with the new nan package changes. The core mechanic is the same as in the package from @mcoot. So thanks a lot to him ^-^.


Coded with โค by h110m

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.