• Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Obfuscate JavaScript files via http://javascriptobfuscator.com. This is also a Grunt plugin. Inform me if this plugin doesn't work.

js-obfuscator

Obfuscate JavaScript files via javascriptobfuscator.com.

IMPORTANT: It is possible that your code can be viewed and/or stored by javascriptobfuscator.com. Please DO NOT include any sensitive data. If you care about your code, split and uglify them before obfuscating.


You can install it globally as a command:

npm install -g js-obfuscator
echo "var fs = require('fs')" | jsobfuscate -o keepIndentations=false
var _0x40c7=["\x66\x73"];var fs=require(_0x40c7[0]);

Or install it as a dependency:

npm install js-obfuscator --save
var jsObfuscator = require('js-obfuscator');
jsObfuscator ( <string> input [, <object> options ] )
Returns: a Q promise.

Or you can use it with Grunt ~0.4.0:

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install js-obfuscator --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('js-obfuscator');

Options

keepLinefeeds

Type: Boolean Default: false

keepIndentations

Type: Boolean Default: false

encodeStrings

Type: Boolean Default: true

encodeNumbers

Type: Boolean Default: true

moveStrings

Type: Boolean Default: true

replaceNames

Type: Boolean Default: true

variableExclusions

Type: Array Default: [ '^_get_', '^_set_', '^_mtd_' ]

concurrency (for Grunt plugin only)

Type: Number Default: 2 Range: 1 - 99

Command

$ jsobfuscate -h
Usage: jsobfuscate [OPTIONS] [FILES]

Obfuscate JavaScript files via javascriptobfuscator.com.
Read from STDIN if no files specified.

Default Options:
  -o keepLinefeeds=false
  -o keepIndentations=false
  -o encodeStrings=true
  -o encodeNumbers=true
  -o moveStrings=true
  -o replaceNames=true
  -o variableExclusions="['^_get_', '^_set_', '^_mtd_']"

Examples

Grunt

grunt.initConfig({
  jsObfuscate: {
    test: {
      options: {
        concurrency: 2,
        keepLinefeeds: false,
        keepIndentations: false,
        encodeStrings: true,
        encodeNumbers: true,
        moveStrings: true,
        replaceNames: true,
        variableExclusions: [ '^_get_', '^_set_', '^_mtd_' ]
      },
      files: {
        'dest/dest.js': [
          'src/src1.js',
          'src/src2.js'
        ]
      }
    }
  }
});

Call

var jsObfuscator = require('js-obfuscator');

var script = 'Array.prototype.diff = function(a) {' +
'  return this.filter(function(i) {return a.indexOf(i) === -1;});' +
'};';

var options = {
  keepLinefeeds:      true,
  keepIndentations:   true,
  encodeStrings:      true,
  encodeNumbers:      true,
  moveStrings:        true,
  replaceNames:       true,
  variableExclusions: [ '^_get_', '^_set_', '^_mtd_' ]
};

jsObfuscator(script, options).then(function(obfuscated) {
  console.log(obfuscated);
}, function(err) {
  console.error(err);
});

/*
var _0xa3c9=["\x64\x69\x66\x66","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65",
"\x69\x6E\x64\x65\x78\x4F\x66","\x66\x69\x6C\x74\x65\x72"]
Array[_0xa3c9[1]][_0xa3c9[0]]=function (_0x4068x1)
{
  return this[_0xa3c9[3]](function (_0x4068x2)
  {
    return _0x4068x1[_0xa3c9[2]](_0x4068x2)===-1;
  }
  );
}
;
*/

Developer

More Repositories

1

dylive

Utilities to watch Douyin live streams. 观看抖音直播工具
Go
57
star
2

nginx-bypass-gfw

bypass GFW (Great FireWall of China) with nginx [note: demo only; your server might soon be blocked if you use this]
Shell
33
star
3

baidu-maps-coord-utils

Coordinates Utils for Baidu Maps in Shell. 利用BASH转换百度地图坐标
Shell
17
star
4

certutils

Wildcard certificates tools: Obtain certbot's (Let's Encrypt) wildcard certificates by updating DNS TXT records and answering stupid certbot questions for you.
Go
13
star
5

opencc

OpenCC in one executable, converts between Simplified Chinese and Traditional Chinese 简体中文 繁體中文 正體中文 转换 also works in WASM
Go
6
star
6

nginx-bypass-gfw-wssc

FUCK Great Firewall with NGINX and self-signed certificate (related step-by-step tutorial: https://gist.github.com/jed/6147872)
Makefile
6
star
7

imgcrush

compress images with mozjpeg, pngcrush & gifsicle
Go
6
star
8

sogoudict

Read content of a Sogou Pinyin Dictionary File (.scel).
Go
6
star
9

octopus

Interact Octopus Card Reader/Writer with JSON-RPC (Golang). / 八达通卡读写器 / 八達通卡讀寫器
Go
5
star
10

baidu-maps-download

Use BASH script to download Baidu Maps as one PNG image file. 用BASH下载百度地图并合成为PNG
Shell
5
star
11

ChineseStrokes

Number of strokes for every Chinese character. 81k+ characters included currently. You can use this to sort Chinese characters by number of strokes. 每个中文的笔画数。收录了八万一千多个中文字。可用作按笔画排序。
Go
5
star
12

cantonese-romanization

Convert Chinese characters to Cantonese pinyin.
Java
4
star
13

learn-to-go

Get Weather, Lyrics, GitHub Notifications. GitHub webhook. Written in golang.
Go
4
star
14

jquery-hanzi2pinyin

fast hanzi to pinyin conversion
4
star
15

MiniVendingMachine

SwiftUI demo Apple Watch app to open a mini vending machine via bluetooth
Swift
4
star
16

gFTP

FTP plugin for Geany
C
4
star
17

qrcode

QR Code PNG / SVG image generator / encoder in Go, also works in WASM. Try it in browser:
Go
4
star
18

readqr

QR code reader (QRCode decoder), use it in browser:
Go
3
star
19

ict

WebSocket server to connect ICT's bill acceptor, coin acceptor and coin dispenser.
Go
3
star
20

grunt-ziti

Subsetting, optimizing and converting large font files to smaller web fonts.
JavaScript
3
star
21

mockserialport

Easily create a virtual serial port command line program for test or development.
Go
3
star
22

DockApps

Open Dropbox, Facebook, GitHub, Gmail, Instagram, Twitter, Wikipedia, YouTube from your Mac OS X dock.
JavaScript
3
star
23

cache-got-hit

Let Nginx talk to Redis cache server with modified memcached protocol.
Go
2
star
24

llks-monitor

Near real-time LLKS (流量矿石) activity monitoring powered by Socket.IO and Angular.js.
JavaScript
2
star
25

grunt-webp-compress

Convert images to WebP format with the encoder tool cwebp.
JavaScript
2
star
26

aliyun

Command-line tool for Aliyun Cloud Services
Go
2
star
27

pinyin_index

A fast Chinese characters to pinyins conversion/romanization tool for indexing use.
JavaScript
2
star
28

EasyJobs

A simple Ruby on Rails SSH web interface to ease your workload.
Ruby
2
star
29

lark-message-bot

A simple message bot for Lark (Feishu / 飞书).
Go
2
star
30

FSPAtest

FragmentStatePagerAdapter test
Java
2
star
31

adboverssh

Remote control Android device. ADB over SSH.
Go
2
star
32

krpano-editor

A tool to make krpano's virtual tours with panoramic images. Uncompleted work.
CoffeeScript
2
star
33

linuxcast

Download linuxcast videos and upload them to YouTube
PHP
1
star
34

portablizer

Make a web app portable.
Python
1
star
35

protractor-utils

Small utils for Protractor
JavaScript
1
star
36

baiduocr

Read Chinese and English text from JPEG/PNG image with Baidu OCR services.
Go
1
star
37

node-cantonese

Cantonese romanization.
JavaScript
1
star
38

goerrbit

Simplified errbit (Airbrake API compliant error catcher) written in Go
Go
1
star
39

luci

[WORK IN PROGRESS] Simple OpenWRT (LuCI) Admin For iPhone / Apple Watch
Swift
1
star
40

ossslim

slim aliyun oss client
Go
1
star
41

goscrcpy

Simple Windows GUI for scrcpy
Go
1
star
42

csg

China Southern Power Grid (中国南方电网) API
Go
1
star
43

MT4Connect

C#
1
star
44

hyr-web

web interface for hyr buyers
Go
1
star
45

panoramas

Panoramas by caiguanhao
JavaScript
1
star
46

districts_of_china

Districts of China https://www.npmjs.com/package/districts_of_china
HTML
1
star
47

currency

currency analytics
1
star
48

Maintainer

A server maintainer. Single-page Ember.js web application.
JavaScript
1
star
49

hkbuildings

Small program to fetch info of private buildings of Hong Kong. (no longer maintained)
Go
1
star
50

larkslim

slim lark api client / 飞书 API
Go
1
star
51

s3thumb

Example AWS Lambda Function to automatically generate thumbnail for images uploaded to S3.
Go
1
star
52

econcal

Freely access fxstreet API
JavaScript
1
star
53

html2png

Command line to make PNG image file from text or HTML, using chromedp screenshot function.
Go
1
star
54

yaoyaola

yaoyaola.net client 摇摇啦代发微信红包服务 https://m.yaoyaola.net/
Go
1
star
55

feishu-dark-mode

飞书网页版深色模式(黑夜、夜晚)
CSS
1
star