mimic
[ab]using Unicode to create tragedy
Introduction
mimic provokes:
- fun
- frustration
- curiosity
- murderous rage
It's inspired by this terrible idea floating around:
MT: Replace a semicolon (;) with a greek question mark (;) in your friend's C# code and watch them pull their hair out over the syntax error
— Peter Ritchie (@peterritchie) November 16, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
There are many more characters in the Unicode character set that look, to some extent or another, like others – homoglyphs. Mimic substitutes common ASCII characters for obscure homoglyphs.
Fun games to play with mimic:
- Pipe some source code through and see if you can find all of the problems
- Pipe someone else's source code through without telling them
- Be fired, and then killed
Installation
Install from a local directory if you've cloned:
pip install -e .
Install straight from the repo:
pip install git+git://github.com/reinderien/mimic.git
Example usage
Before installation, invoke via python -m mimic
. After, simply use mimic
.
mimic --list # Show all of the homoglyphs
mimic --explain=o # What crazy things can we do with this letter?
mimic --me-harder 100 # Type some lines in and mess with every single char
mimic --reverse # Undo the mayhem. Boooring.
cat somefile | mimic # Pipe some source through at 1%
# Turn up the knob and save the results
cat somefile | mimic --me-harder 25 > mimicked
# Or, if your code acts strange, but you have seen this prank before:
cat mimicked | mimic --reverse > fixedfile
diff fixedfile somefile
Results
Observe the mayhem:
Or, if you've been mimicked a little harder,
Solutions
vim-troll-stopper: vim plugin that alerts you by highlighting "troll" Unicode characters in red.
Discussion
People have noticed how terrible this is.
See also
[Wikipedia: Unicode Equivalence] (https://en.wikipedia.org/wiki/Unicode_equivalence)