hazukieq преди 2 години
ревизия
fef6f364ce
променени са 82 файла, в които са добавени 574 реда и са изтрити 0 реда
  1. 18 0
      .gitignore
  2. 194 0
      Cargo.lock
  3. 13 0
      Cargo.toml
  4. 21 0
      LICENSE
  5. 30 0
      README.md
  6. 43 0
      license-gen/Cargo.lock
  7. 9 0
      license-gen/Cargo.toml
  8. 23 0
      license-gen/src/main.rs
  9. 1 0
      license-gen/target/.rustc_info.json
  10. 3 0
      license-gen/target/CACHEDIR.TAG
  11. 0 0
      license-gen/target/debug/.cargo-lock
  12. BIN
      license-gen/target/debug/.fingerprint/fastrand-45f16d1d1f53b27d/dep-lib-fastrand
  13. 1 0
      license-gen/target/debug/.fingerprint/fastrand-45f16d1d1f53b27d/invoked.timestamp
  14. 1 0
      license-gen/target/debug/.fingerprint/fastrand-45f16d1d1f53b27d/lib-fastrand
  15. 1 0
      license-gen/target/debug/.fingerprint/fastrand-45f16d1d1f53b27d/lib-fastrand.json
  16. 1 0
      license-gen/target/debug/.fingerprint/license-gen-c0b5dc4026fb7fd5/bin-license-gen
  17. 1 0
      license-gen/target/debug/.fingerprint/license-gen-c0b5dc4026fb7fd5/bin-license-gen.json
  18. BIN
      license-gen/target/debug/.fingerprint/license-gen-c0b5dc4026fb7fd5/dep-bin-license-gen
  19. 1 0
      license-gen/target/debug/.fingerprint/license-gen-c0b5dc4026fb7fd5/invoked.timestamp
  20. BIN
      license-gen/target/debug/.fingerprint/random-string-8b8b5da0e7e7f650/dep-lib-random-string
  21. 1 0
      license-gen/target/debug/.fingerprint/random-string-8b8b5da0e7e7f650/invoked.timestamp
  22. 1 0
      license-gen/target/debug/.fingerprint/random-string-8b8b5da0e7e7f650/lib-random-string
  23. 1 0
      license-gen/target/debug/.fingerprint/random-string-8b8b5da0e7e7f650/lib-random-string.json
  24. 7 0
      license-gen/target/debug/deps/fastrand-45f16d1d1f53b27d.d
  25. BIN
      license-gen/target/debug/deps/libfastrand-45f16d1d1f53b27d.rlib
  26. BIN
      license-gen/target/debug/deps/libfastrand-45f16d1d1f53b27d.rmeta
  27. BIN
      license-gen/target/debug/deps/librandom_string-8b8b5da0e7e7f650.rlib
  28. BIN
      license-gen/target/debug/deps/librandom_string-8b8b5da0e7e7f650.rmeta
  29. BIN
      license-gen/target/debug/deps/license_gen-c0b5dc4026fb7fd5
  30. 5 0
      license-gen/target/debug/deps/license_gen-c0b5dc4026fb7fd5.d
  31. 8 0
      license-gen/target/debug/deps/random_string-8b8b5da0e7e7f650.d
  32. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/1h4u06n7l9nl75zt.o
  33. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/1mvzdsbg7yq4mdn2.o
  34. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/1odb09e9aobjpqty.o
  35. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/1sy59wxrk3zqozas.o
  36. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/1wohzg28yrbesrlq.o
  37. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/2enh0s6qdwjkxzdc.o
  38. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/2idg9adiuas5x3sf.o
  39. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/2pes2w3sztmfkt6c.o
  40. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/2qbvsjrjdri67cvs.o
  41. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/2xzze4f6gll7a6he.o
  42. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/31k0vfm3tx8cd7or.o
  43. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/32bty2pyb5f6s2wo.o
  44. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/351gqwd9rane7cld.o
  45. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3aieanl9cuqwi16o.o
  46. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3cz6pdrcxcoyamof.o
  47. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3e772bvwzz2bhppm.o
  48. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3lmr4kumavyg4cyu.o
  49. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3msnhe2dqneec8ei.o
  50. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3phu740gjrn7e4ye.o
  51. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3puixqyr7lfqxo7i.o
  52. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3qwcrfpsmyydrmht.o
  53. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3rkjvx8mbr4k86jm.o
  54. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3sodgea8m733769e.o
  55. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3v6lu5b46oxs7cg4.o
  56. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/41h0nfkr9o4rf8be.o
  57. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/487qlynsankdaj7b.o
  58. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/4rfqoo8zcnqsdg3e.o
  59. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/4slz449mz8aybplz.o
  60. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/5054tfq70r1j4gay.o
  61. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/54a3gn0thoftypk7.o
  62. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/55gmj5nxni034oe7.o
  63. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/58e2hlqtfud4susx.o
  64. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/59258ueb7h0m8rqi.o
  65. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/5gcjlytqifkkjb9m.o
  66. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/7hngft98whb3me0.o
  67. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/d3w2gzerqlfopah.o
  68. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/dep-graph.bin
  69. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/f9ntyzqmm4snjzt.o
  70. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/nj07h6e0mzxrphw.o
  71. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/nzaakw1lzvl436k.o
  72. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/query-cache.bin
  73. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/remut0gev8o3d88.o
  74. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/rk58x5efym79tlt.o
  75. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/rwf13tfyy69lyjm.o
  76. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/v860z0tpoua9sf7.o
  77. BIN
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/work-products.bin
  78. 0 0
      license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol.lock
  79. BIN
      license-gen/target/debug/license-gen
  80. 1 0
      license-gen/target/debug/license-gen.d
  81. 132 0
      src/hooklog.js
  82. 57 0
      src/main.rs

+ 18 - 0
.gitignore

@@ -0,0 +1,18 @@
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+# Dependency directories (remove the comment below to include it)
+# vendor/
+
+
+# Added by cargo
+/target
+
+/.idea

+ 194 - 0
Cargo.lock

@@ -0,0 +1,194 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "ansi_term"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "atty"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
+dependencies = [
+ "hermit-abi",
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "clap"
+version = "2.34.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
+dependencies = [
+ "ansi_term",
+ "atty",
+ "bitflags",
+ "strsim",
+ "textwrap",
+ "unicode-width",
+ "vec_map",
+]
+
+[[package]]
+name = "fastrand"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
+dependencies = [
+ "instant",
+]
+
+[[package]]
+name = "glob"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
+
+[[package]]
+name = "hermit-abi"
+version = "0.1.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "instant"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
+
+[[package]]
+name = "libc"
+version = "0.2.137"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
+
+[[package]]
+name = "node_inject"
+version = "0.1.0"
+dependencies = [
+ "random-string",
+ "rasar",
+]
+
+[[package]]
+name = "random-string"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf4e63111ec5292d8af9c220f06fe3bb87991cc78b6f1f7e291d1ae6b8a60817"
+dependencies = [
+ "fastrand",
+]
+
+[[package]]
+name = "rasar"
+version = "0.1.6"
+source = "git+https://github.com/Zerthox/rasar.git#a384c9413fc905b7eef5f48ef4e2f74f73e7addd"
+dependencies = [
+ "clap",
+ "glob",
+ "serde_json",
+]
+
+[[package]]
+name = "ryu"
+version = "1.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
+
+[[package]]
+name = "serde"
+version = "1.0.147"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
+
+[[package]]
+name = "serde_json"
+version = "1.0.87"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "strsim"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
+
+[[package]]
+name = "textwrap"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
+dependencies = [
+ "unicode-width",
+]
+
+[[package]]
+name = "unicode-width"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
+
+[[package]]
+name = "vec_map"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

+ 13 - 0
Cargo.toml

@@ -0,0 +1,13 @@
+[package]
+name = "node_inject"
+version = "0.1.0"
+edition = "2021"
+
+
+[dependencies]
+rasar = {git = 'https://github.com/Zerthox/rasar.git'}
+random-string = "1.0.0"
+
+[features]
+no_embed = []
+default = []

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 DiamondHunters
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 30 - 0
README.md

@@ -0,0 +1,30 @@
+# 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

+ 43 - 0
license-gen/Cargo.lock

@@ -0,0 +1,43 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "fastrand"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
+dependencies = [
+ "instant",
+]
+
+[[package]]
+name = "instant"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "license-gen"
+version = "0.1.0"
+dependencies = [
+ "random-string",
+]
+
+[[package]]
+name = "random-string"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf4e63111ec5292d8af9c220f06fe3bb87991cc78b6f1f7e291d1ae6b8a60817"
+dependencies = [
+ "fastrand",
+]

+ 9 - 0
license-gen/Cargo.toml

@@ -0,0 +1,9 @@
+[package]
+name = "license-gen"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+random-string = "1.0"

+ 23 - 0
license-gen/src/main.rs

@@ -0,0 +1,23 @@
+use random_string::generate;
+
+const LICENSE_CHARS: &str = "L23456789ABCDEFGHJKMNPQRSTUVWXYZ";
+fn main() {
+    generate_license();
+}
+
+fn generate_license(){
+    let mut license = generate(22, LICENSE_CHARS);
+    for n in  0..2 {
+        let mut o = 0;
+        for i in (0..16).step_by(2) {
+            o += LICENSE_CHARS.find(&license[n+i..=n+i]).unwrap()
+        }
+        o %= LICENSE_CHARS.len();
+        license += &LICENSE_CHARS[o..=o];
+    }
+    license.insert(6, '-');
+    license.insert(13, '-');
+    license.insert(20, '-');
+    println!("License for you: {}", license);
+}
+

+ 1 - 0
license-gen/target/.rustc_info.json

@@ -0,0 +1 @@
+{"rustc_fingerprint":12175695165766069604,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/hazukie/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.70.0 (90c541806 2023-05-31)\nbinary: rustc\ncommit-hash: 90c541806f23a127002de5b4038be731ba1458ca\ncommit-date: 2023-05-31\nhost: x86_64-unknown-linux-gnu\nrelease: 1.70.0\nLLVM version: 16.0.2\n","stderr":""}},"successes":{}}

+ 3 - 0
license-gen/target/CACHEDIR.TAG

@@ -0,0 +1,3 @@
+Signature: 8a477f597d28d172789f06886806bc55
+# This file is a cache directory tag created by cargo.
+# For information about cache directory tags see https://bford.info/cachedir/

+ 0 - 0
license-gen/target/debug/.cargo-lock


BIN
license-gen/target/debug/.fingerprint/fastrand-45f16d1d1f53b27d/dep-lib-fastrand


+ 1 - 0
license-gen/target/debug/.fingerprint/fastrand-45f16d1d1f53b27d/invoked.timestamp

@@ -0,0 +1 @@
+This file has an mtime of when this was started.

+ 1 - 0
license-gen/target/debug/.fingerprint/fastrand-45f16d1d1f53b27d/lib-fastrand

@@ -0,0 +1 @@
+2fcaf23bb5737f30

+ 1 - 0
license-gen/target/debug/.fingerprint/fastrand-45f16d1d1f53b27d/lib-fastrand.json

@@ -0,0 +1 @@
+{"rustc":12970975996024363646,"features":"[]","target":7069105237705923884,"profile":12637318739757120569,"path":16724860461266046266,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/fastrand-45f16d1d1f53b27d/dep-lib-fastrand"}}],"rustflags":[],"metadata":10402231642546230285,"config":2202906307356721367,"compile_kind":0}

+ 1 - 0
license-gen/target/debug/.fingerprint/license-gen-c0b5dc4026fb7fd5/bin-license-gen

@@ -0,0 +1 @@
+20a875a1af2060de

+ 1 - 0
license-gen/target/debug/.fingerprint/license-gen-c0b5dc4026fb7fd5/bin-license-gen.json

@@ -0,0 +1 @@
+{"rustc":12970975996024363646,"features":"[]","target":16425818101171349837,"profile":9251013656241001069,"path":1684066648322511884,"deps":[[6092713254948065189,"random_string",false,7831858340560188452]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/license-gen-c0b5dc4026fb7fd5/dep-bin-license-gen"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}

BIN
license-gen/target/debug/.fingerprint/license-gen-c0b5dc4026fb7fd5/dep-bin-license-gen


+ 1 - 0
license-gen/target/debug/.fingerprint/license-gen-c0b5dc4026fb7fd5/invoked.timestamp

@@ -0,0 +1 @@
+This file has an mtime of when this was started.

BIN
license-gen/target/debug/.fingerprint/random-string-8b8b5da0e7e7f650/dep-lib-random-string


+ 1 - 0
license-gen/target/debug/.fingerprint/random-string-8b8b5da0e7e7f650/invoked.timestamp

@@ -0,0 +1 @@
+This file has an mtime of when this was started.

+ 1 - 0
license-gen/target/debug/.fingerprint/random-string-8b8b5da0e7e7f650/lib-random-string

@@ -0,0 +1 @@
+24344570aa59b06c

+ 1 - 0
license-gen/target/debug/.fingerprint/random-string-8b8b5da0e7e7f650/lib-random-string.json

@@ -0,0 +1 @@
+{"rustc":12970975996024363646,"features":"[]","target":5954671764743309880,"profile":12637318739757120569,"path":1603745093822367309,"deps":[[2426677299502668331,"fastrand",false,3494639058094836271]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/random-string-8b8b5da0e7e7f650/dep-lib-random-string"}}],"rustflags":[],"metadata":11393871395539939003,"config":2202906307356721367,"compile_kind":0}

+ 7 - 0
license-gen/target/debug/deps/fastrand-45f16d1d1f53b27d.d

@@ -0,0 +1,7 @@
+/home/hazukie/gitprojects/NodeInject_Hook_example/license-gen/target/debug/deps/fastrand-45f16d1d1f53b27d.rmeta: /home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fastrand-1.8.0/src/lib.rs
+
+/home/hazukie/gitprojects/NodeInject_Hook_example/license-gen/target/debug/deps/libfastrand-45f16d1d1f53b27d.rlib: /home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fastrand-1.8.0/src/lib.rs
+
+/home/hazukie/gitprojects/NodeInject_Hook_example/license-gen/target/debug/deps/fastrand-45f16d1d1f53b27d.d: /home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fastrand-1.8.0/src/lib.rs
+
+/home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fastrand-1.8.0/src/lib.rs:

BIN
license-gen/target/debug/deps/libfastrand-45f16d1d1f53b27d.rlib


BIN
license-gen/target/debug/deps/libfastrand-45f16d1d1f53b27d.rmeta


BIN
license-gen/target/debug/deps/librandom_string-8b8b5da0e7e7f650.rlib


BIN
license-gen/target/debug/deps/librandom_string-8b8b5da0e7e7f650.rmeta


BIN
license-gen/target/debug/deps/license_gen-c0b5dc4026fb7fd5


+ 5 - 0
license-gen/target/debug/deps/license_gen-c0b5dc4026fb7fd5.d

@@ -0,0 +1,5 @@
+/home/hazukie/gitprojects/NodeInject_Hook_example/license-gen/target/debug/deps/license_gen-c0b5dc4026fb7fd5: src/main.rs
+
+/home/hazukie/gitprojects/NodeInject_Hook_example/license-gen/target/debug/deps/license_gen-c0b5dc4026fb7fd5.d: src/main.rs
+
+src/main.rs:

+ 8 - 0
license-gen/target/debug/deps/random_string-8b8b5da0e7e7f650.d

@@ -0,0 +1,8 @@
+/home/hazukie/gitprojects/NodeInject_Hook_example/license-gen/target/debug/deps/random_string-8b8b5da0e7e7f650.rmeta: /home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/random-string-1.0.0/src/random_string.rs /home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/random-string-1.0.0/src/generator.rs
+
+/home/hazukie/gitprojects/NodeInject_Hook_example/license-gen/target/debug/deps/librandom_string-8b8b5da0e7e7f650.rlib: /home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/random-string-1.0.0/src/random_string.rs /home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/random-string-1.0.0/src/generator.rs
+
+/home/hazukie/gitprojects/NodeInject_Hook_example/license-gen/target/debug/deps/random_string-8b8b5da0e7e7f650.d: /home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/random-string-1.0.0/src/random_string.rs /home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/random-string-1.0.0/src/generator.rs
+
+/home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/random-string-1.0.0/src/random_string.rs:
+/home/hazukie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/random-string-1.0.0/src/generator.rs:

BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/1h4u06n7l9nl75zt.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/1mvzdsbg7yq4mdn2.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/1odb09e9aobjpqty.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/1sy59wxrk3zqozas.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/1wohzg28yrbesrlq.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/2enh0s6qdwjkxzdc.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/2idg9adiuas5x3sf.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/2pes2w3sztmfkt6c.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/2qbvsjrjdri67cvs.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/2xzze4f6gll7a6he.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/31k0vfm3tx8cd7or.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/32bty2pyb5f6s2wo.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/351gqwd9rane7cld.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3aieanl9cuqwi16o.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3cz6pdrcxcoyamof.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3e772bvwzz2bhppm.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3lmr4kumavyg4cyu.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3msnhe2dqneec8ei.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3phu740gjrn7e4ye.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3puixqyr7lfqxo7i.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3qwcrfpsmyydrmht.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3rkjvx8mbr4k86jm.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3sodgea8m733769e.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/3v6lu5b46oxs7cg4.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/41h0nfkr9o4rf8be.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/487qlynsankdaj7b.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/4rfqoo8zcnqsdg3e.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/4slz449mz8aybplz.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/5054tfq70r1j4gay.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/54a3gn0thoftypk7.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/55gmj5nxni034oe7.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/58e2hlqtfud4susx.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/59258ueb7h0m8rqi.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/5gcjlytqifkkjb9m.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/7hngft98whb3me0.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/d3w2gzerqlfopah.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/dep-graph.bin


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/f9ntyzqmm4snjzt.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/nj07h6e0mzxrphw.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/nzaakw1lzvl436k.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/query-cache.bin


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/remut0gev8o3d88.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/rk58x5efym79tlt.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/rwf13tfyy69lyjm.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/v860z0tpoua9sf7.o


BIN
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol-gkpux8zx8qza/work-products.bin


+ 0 - 0
license-gen/target/debug/incremental/license_gen-2cbney4fmr3k5/s-gls56881xc-1fdukol.lock


BIN
license-gen/target/debug/license-gen


+ 1 - 0
license-gen/target/debug/license-gen.d

@@ -0,0 +1 @@
+/home/hazukie/gitprojects/NodeInject_Hook_example/license-gen/target/debug/license-gen: /home/hazukie/gitprojects/NodeInject_Hook_example/license-gen/src/main.rs

+ 132 - 0
src/hooklog.js

@@ -0,0 +1,132 @@
+//this file is a little example of how to use injecting ability
+//to hook a function and change its behavior
+//in this case we hook the function that is responsible for the decryption of the license
+//and we change the behavior to return a valid license
+
+// JUST FOR LEARNING PURPOSES, DON'T USE THIS TO CRACK SOFTWARE
+
+//Adding hook
+const crypto = require("crypto");
+const pubdec = crypto["publicDecrypt"];
+delete crypto["publicDecrypt"];
+let fingerprint, email, uuid, license, computerInfo = "";
+let License = ""
+crypto.publicDecrypt = function (key, buffer) {
+    log("PubDec Key:" + key);
+    log("buf: " + buffer.toString('base64'));
+    if (buffer.slice(0, 26).compare(Buffer.from("CRACKED_BY_DIAMOND_HUNTERS")) == 0) {
+        License = buffer.toString('base64');
+        let ret = buffer.toString().replace("CRACKED_BY_DIAMOND_HUNTERS", "");
+        log("backdoor data,return : " + ret);
+        return Buffer.from(ret);
+    }
+    return pubdec(key, buffer);
+};
+
+const fetch = require("electron-fetch")
+fetch_bak = fetch['default'];
+delete fetch['default'];
+fetch.default = async function fetch(url, options) {
+    log('[fetch]fetch ' + url);
+    log('[fetch]Arg ' + JSON.stringify(options));
+    data = await fetch_bak(url, options);
+    if (url.indexOf('api/client/activate') != -1) {
+        params = JSON.parse(options.body);
+        fingerprint = params.f, email = params.email, uuid = params.u, license = params.license, computerInfo = params.l
+        log('[activate]Fingerprint ' + fingerprint);
+        log('[activate]Email ' + email);
+        log('[activate]UUID ' + uuid);
+        log('[activate]License ' + license);
+        log('[activate]ComputerInfo ' + computerInfo);
+        log('[fetch]RetCode ' + data.status);
+        ret = await data.buffer();
+        log('[fetch]Ret ' + ret.toString());
+
+        ret = Buffer.from('{"code":0,"retry":true,"msg":"' + Buffer.from("CRACKED_BY_DIAMOND_HUNTERS" + JSON.stringify(
+            {
+                "fingerprint": fingerprint,
+                "email": email,
+                "license": license,
+                "type": ""
+            })).toString('base64') + '"}');
+        log("replace ret: " + ret.toString());
+        data.text = () => {
+            return new Promise((resolve, reject) => {
+                resolve(ret.toString());
+            });
+        };
+        data.json = () => {
+            return new Promise((resolve, reject) => {
+                resolve(JSON.parse(ret.toString()));
+            });
+        };
+    }
+    if (url.indexOf('api/client/renew') != -1) {
+        ret = await data.buffer();
+        log('[fetch]Ret ' + ret.toString());
+
+        ret = Buffer.from('{"success":true,"code":0,"retry":true,"msg":"' + License + '"}');
+        log("replace ret: " + ret.toString());
+        data.text = () => {
+            return new Promise((resolve, reject) => {
+                resolve(ret.toString());
+            });
+        };
+        data.json = () => {
+            return new Promise((resolve, reject) => {
+                resolve(JSON.parse(ret.toString()));
+            });
+        };
+    }
+    return new Promise((resolve, reject) => {
+        resolve(data);
+    });
+
+}
+
+http = require("http")
+
+function log(str) {
+    http.get('http://127.0.0.1:3000/log?str=' + str, res => {
+    }).on('error', err => {
+        console.log('Error: ', err.message);
+    });
+}
+
+log = console.log;
+log('Hook Init')
+
+
+var Module = require('module');
+var originalRequire = Module.prototype.require;
+
+Module.prototype.require = function () {
+    log('Require ' + arguments[0])
+    if (arguments[0] == 'crypto') {
+        log('Hooking crypto');
+        return crypto;
+    }
+    if (arguments[0] == 'electron-fetch') {
+        log('Hooking electron-fetch');
+        return fetch;
+    }
+    return originalRequire.apply(this, arguments);
+};
+
+
+console.log = log
+let validator = {
+    set: function (target, key, value) {
+        if (key === 'log') {
+            log('console.log override blocked');
+            return;
+        }
+        target[key] = value;
+    }
+}
+
+let proxy = new Proxy(console, validator);
+console = proxy
+module.exports = fetch
+
+//hook finished

+ 57 - 0
src/main.rs

@@ -0,0 +1,57 @@
+use std::convert::AsRef;
+use std::fs::{File, OpenOptions};
+use std::io::Write;
+
+
+const HOOK_JS_WRITE_PATH: &str = "./node/raven/hook.js"; //path to hook.js in unpacked module, if you change it, change it in append_require_to_file too
+#[cfg(feature = "no_embed")]
+const NO_EMBED_HOOK_JS_PATH: &str = "./hook.js"; // if no_emded feature is enabled, this file will be used in runtime
+#[cfg(not(feature = "no_embed"))]
+const EMBED_HOOK_JS_BYTES: &[u8] = include_bytes!("hooklog.js");   // embedded hooking code file,will be embedded in binary file
+const INJECT_JS_PATH: &str = "./node/raven/index.js"; //path for unpacked module to inject code into,if you want inject code into another module, change it here and in HOOK_JS_WRITE_PATH
+
+
+fn main() {
+    if file_exist("./node"){
+        println!("You may have already installed the hook.Please check manually.");
+        return;
+    }
+    if !file_exist("./resources/node_modules.asar") {
+        println!("no node_modules.asar found");
+        println!("move me to the root of your typora installation(the same directory as executable of electron)");
+        return;
+    }
+    println!("extracting node_modules.asar");
+    rasar::extract("./resources/node_modules.asar", "./node").unwrap();
+    println!("adding hook.js");
+    write_js_to_file();
+    println!("applying patch");
+    append_require_to_file();
+    println!("packing node_modules.asar");
+    rasar::pack("./node","./resources/node_modules.asar").unwrap();
+    println!("done!");
+}
+fn file_exist(archive: &str) -> bool {
+    return std::path::Path::new(archive).exists()
+}
+
+
+#[cfg(not(feature = "no_embed"))]
+fn write_js_to_file() {
+    let mut file = File::create(HOOK_JS_WRITE_PATH).unwrap();
+    file.write_all(EMBED_HOOK_JS_BYTES).unwrap();
+}
+#[cfg(feature = "no_embed")]
+fn write_js_to_file() {
+    let mut file = File::create(HOOK_JS_WRITE_PATH).unwrap();
+    let mut hook_js = File::open(NO_EMBED_HOOK_JS_PATH).unwrap();
+    std::io::copy(&mut hook_js, &mut file).unwrap();
+}
+
+fn append_require_to_file() {
+    let mut file = OpenOptions::new()
+        .append(true)
+        .open(INJECT_JS_PATH)
+        .unwrap();
+    file.write_all("\nrequire('./hook')".as_ref()).unwrap();
+}