Skip to content

Commit

Permalink
add fake license generator
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondHunters committed Nov 14, 2022
1 parent 99a98e4 commit 60dc28b
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/license-gen/target/
.idea
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,24 @@ A hooking example for NodeInject

JUST FOR LEARNING!

SUPPORT GENUINE SOFTWARE AND DO NOT SELL PIRATED SOFTWARE !!!
**PLEASE DO NOT ABUSE THIS SCRIPT CAPABILITY FOR THE PURPOSE OF INFRINGEMENT, AND YOU SHALL BEAR ALL CONSEQUENCES CAUSED BY YOUR ACTIONS.**


#### Usage

1. `git clone https://github.com/DiamondHunters/NodeInject.git`
2. Replace `hooklog.js` with `hook.js` this repo (or use `no_embed` feature and set `NO_EMBED_HOOK_JS_PATH`to the path of `hook.js`)
3. Run `cargo build` or `cargo build --features no_embed` to build a type of executable (If you enabled `no_embed` feature, you need to copy `hook.js` to the same directory of executable)
4. Run the executable

If you need a fake license, you can run `cargo run` in `license-gen` directory

This fake license is not valid and just used for **testing**. Please do not use it for any other purpose.

#### Ability

- [x] make typora to activate with the generated activation code (Test passed in version 1.4.8 on windows,1.4.7 on ubuntu)
- [x] make typora to activate with the generated activation code (Test passed in version 1.4.8 on Windows,1.4.7 on Ubuntu)
- [x] hook `console.log` to remote http server and block override
- [x] hook `electron-fetch` for sniffing request
- [ ] Full version compatibility (older version not using `electron-fetch` and may fail in the future)
- [ ] Multi os compatibility (only test on windows,Drawin have another packaging methods,in progress.)
- [ ] Multi os compatibility (not work in macOS)
43 changes: 43 additions & 0 deletions license-gen/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions license-gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 changes: 23 additions & 0 deletions license-gen/src/main.rs
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 60dc28b

Please sign in to comment.