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

machinator

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

machinator

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Machinator can perform code obfuscation on file content and directory structures.

It can be paired up with high level language deployment and/or compression routines to keep even Big Brother guessing. Or can it?

http://rubygems.org/gems/machinator

== Terminal usage

As a ruby gem

machinator -h

Or (with the source) you can just:

ruby bin/machinator -h

== Obfuscating

Machinator lets you define the schema for obfuscation.

A schema (in YAML) is defined in a .machinator file in the directory being operated on, or a manually specified Hash resource.

A schema has a words and a names hash collection, with each key/pair being a regular expression and strings to replace with any occurences, respectively.

An example:

words: {      
    namepsace\.Foo: nameSpace.bar            
}  
    
names: {
    SomeFile\.js$: ABC.js
}
       

Any words are matched against the entire file. File names are obfuscated afterwards (will only be matched once).

== Using In Code

require "machinator"
winston = Machinator::Obfuscator.new
winston.neverspeak(source, schema)

The source can be an actual string to obfuscate, a File object, or a directory/file path to operate on. Keep in mind that the Obfuscator module will overwrite any files/directories that matches the schema.

Note: If you specify a string to obfusctate that is actually a valid file/directory path it will operate on that instead.

== Manipulating Strings

In the case of passing in a string an obfuscated copy will be returned.

new_string = winston.neverspeak("some string to obfuscate", { 
  "words" => {
    /^some\sstring/ => "something"
  }
})

== Operating on Files and Directories

You can operate on a single file, where the first matched names key/pair is applied to the file name and any words are applied against the file content.

# renames to foo.foo
winston.neverspeak("foo.bar", {
  "names" => {
    /bar$/ => "foo" 
  }
})

If you specify a directory all files and directories inside will be operated on (recursively, bottom up), applying names/words matches to each file.

# let somedir have 'afile' in it
winston.neverspeak("somedir", {
  "names" => {
    /afile$/ => "thefile" 
  }
})

Note: This will recurse (fairly deep) so make sure the passed in directory is correct, or you could possibly bring on the apocalypse.

== Filtering

You can pass in a block to filer file operations (both words and names).

winston.neverspeak("somedir", schema) { |path| 
  true
} # will operate on every file found

== Dependencies

None

== Tests

rake test (need mocha, and rake... if you want)

== Author

Copyright 2010 Brent Lintner

The MIT License http://www.opensource.org/licenses/mit-license.php

FAQs

Package last updated on 05 Jan 2011

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