Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-obfuscate

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-obfuscate

Obfuscate your code.

  • 0.2.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

gulp-obfuscate NPM version Build Status

gulp plugin to obfuscate your code.

Install

$ npm install --save-dev gulp-obfuscate

Usage

var gulp = require('gulp');
var obfuscate = require('gulp-obfuscate');

gulp.task('default', function () {
	return gulp.src('test.js')
		.pipe(obfuscate());
});

Example

gulp-obfuscate obfuscates your javascript code so that it looks like this:

  function ಠ_ಠ4() {
    var ಠ_ಠ1, ಠ_ಠ2, ಠ_ಠ3;
    ...
    ಠ_ಠ3 = ಠ_ಠ1 + ಠ_ಠ2;
    return ಠ_ಠ3;
  }

and this:

  function H͇̬͔̳̖̅̒ͥͧẸ̖͇͈͍̱̭̌͂͆͊_C͈OM̱̈́͛̈ͩ͐͊ͦEͨ̓̐S̬̘͍͕͔͊̆̑̈́̅4() {
    var H͇̬͔̳̖̅̒ͥͧẸ̖͇͈͍̱̭̌͂͆͊_C͈OM̱̈́͛̈ͩ͐͊ͦEͨ̓̐S̬̘͍͕͔͊̆̑̈́̅1, H͇̬͔̳̖̅̒ͥͧẸ̖͇͈͍̱̭̌͂͆͊_C͈OM̱̈́͛̈ͩ͐͊ͦEͨ̓̐S̬̘͍͕͔͊̆̑̈́̅2, H͇̬͔̳̖̅̒ͥͧẸ̖͇͈͍̱̭̌͂͆͊_C͈OM̱̈́͛̈ͩ͐͊ͦEͨ̓̐S̬̘͍͕͔͊̆̑̈́̅3;
    ...
    H͇̬͔̳̖̅̒ͥͧẸ̖͇͈͍̱̭̌͂͆͊_C͈OM̱̈́͛̈ͩ͐͊ͦEͨ̓̐S̬̘͍͕͔͊̆̑̈́̅3 = H͇̬͔̳̖̅̒ͥͧẸ̖͇͈͍̱̭̌͂͆͊_C͈OM̱̈́͛̈ͩ͐͊ͦEͨ̓̐S̬̘͍͕͔͊̆̑̈́̅1 + H͇̬͔̳̖̅̒ͥͧẸ̖͇͈͍̱̭̌͂͆͊_C͈OM̱̈́͛̈ͩ͐͊ͦEͨ̓̐S̬̘͍͕͔͊̆̑̈́̅2;
    return H͇̬͔̳̖̅̒ͥͧẸ̖͇͈͍̱̭̌͂͆͊_C͈OM̱̈́͛̈ͩ͐͊ͦEͨ̓̐S̬̘͍͕͔͊̆̑̈́̅3;
  }

--

See a working example here

--

API

obfuscate(options)

options.replaceMethod

Type: ZALGO or LOOK_OF_DISAPPROVAL

Default: LOOK_OF_DISAPPROVAL

Example:

obfuscate = require('gulp-obfuscate');
...
.pipe(obfuscate({ replaceMethod: obfuscate.ZALGO }))
...

Note: Both obfuscation methods create valid javascript variables per ECMAScript 5.1. That said, there is no guarantee that older browsers can handle the mighty power of ZALGO.

options.exclude

Type: String or Array of Strings

Default: 'break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'else', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'prototype', 'null', 'true', 'false', 'NaN', 'undefined', 'Infinity', 'ಠ_ಠ', 'H͇̬͔̳̖̅̒ͥͧẸ̖͇͈͍̱̭̌͂͆͊_C͈OM̱̈́͛̈ͩ͐͊ͦEͨ̓̐S̬̘͍͕͔͊̆̑̈́̅'

Values: do_not_replace, abc, ...

Regular expressions to be globally excluded from obfuscation. Current defaults include javascript reserved words. Custom exclusions are often needed for variables or functions that need to stay named the same (such as interfaces to other code).

Note: defaults will be automatically appended to any options.exclude variables provided.

See gulp-regex-replace documentation for more details.

License

MIT © Mike Groseclose

Keywords

FAQs

Package last updated on 14 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc