SkillAgentSearch skills...

Machinator

Sinister code obfuscation.

Install / Use

/learn @brentlintner/Machinator
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

== Machinator

{<img src="https://badge.fury.io/rb/machinator.svg" alt="Gem Version" />}[http://badge.fury.io/rb/machinator]

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 filter file operations (both words and names).

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

== Dependencies

None

== Versioning

This project ascribes to {semantic versioning}[http://semver.org].

== 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

Related Skills

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated1y ago
Forks0

Languages

Ruby

Security Score

55/100

Audited on Sep 30, 2024

No findings