
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
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
Unknown package
We found that machinator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.