Machinator
Sinister code obfuscation.
Install / Use
/learn @brentlintner/MachinatorREADME
== 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
node-connect
333.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
333.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.0kCommit, push, and open a PR
