Git Product home page Git Product logo

nodeinject's Introduction

NodeInject

An inject tools for injecting js code into electron application

Please follow DMCA when using this code

How it works

  1. unpack node_modules.asar package (in ./resources)
  2. write hook.js into raven package directory (raven will be required at the early stage of startup in some application)
  3. modify index.js of raven,injecting require of hook.js

Currently using embedded javascript file (hooklog.js)

Usage

  1. modify hook.js if you need or enable no_embed feature to use specified js (NO_EMBED_HOOK_JS_PATH) at runtime
  2. use cargo build to make executable with embedded js or cargo build --features no_embed without embedded js
  3. Move the program to the electron application directory
  4. run

Compatibility test

  • Windows / Typora 1.4.8 PASSED
  • Ubuntu / Typora 1.4.7 PASSED

Since macos may adopt different packaging methods and webkit as the execution environment, this tool does not support applications under macos.

Examples

https://github.com/DiamondHunters/NodeInject_Hook_example :Use NodeInject to realize specific functions in Typora

nodeinject's People

Contributors

diamondhunters avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodeinject's Issues

一个小小的bug

hooklog.js 中这一段代码;需要把 rerturn 改为 return ,不然一直激活不了,还不会有任何提示,需要命令行运行 Typora.exe 才能看到错误。在NodeInject_Hook_example有同样的问题。

let validator = {
    set: function (target, key, value) {
        if (key === 'log') {
            log('console.log override blocked');
            rerturn;
        }
        target[key] = value;
    }
}

改为

let validator = {
    set: function (target, key, value) {
        if (key === 'log') {
            log('console.log override blocked');
            return;
        }
        target[key] = value;
    }
}

感谢您的新思路,让我受益良多!

激活失败

版本:1.8.10,Windows 11
提示信息:

  1. 在 Typora 根目录运行编译出的 node_inject.exe 后提示
extracting node_modules.asar
adding hook.js
applying patch
packing node_modules.asar
done!

重复运行提示 You may have already installed the hook.Please check manually.

  1. NodeInject_Hook_example\license-gen 下运行 cargo run 能生成激活码
License for you: H5JJNE-8CD4RJ-QCGBZG-6PN95Q
  1. 打开 Typora,使用任意 Email 和刚刚生成的序列号激活,提示请输入正确的序列号

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.