Skip to content

Commit

Permalink
Add aaEncode/aaDecode
Browse files Browse the repository at this point in the history
Encode any JavaScript program to Japanese style emoticons (^_^)
  • Loading branch information
Medicean committed Aug 1, 2017
1 parent 33c4223 commit dabbe66
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 1 deletion.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
### v1.0.5 (2017/08/01)

* Add md5 16

```
md5_16: 123 => ac59075b964b0715
md5_32: 123 => 202cb962ac59075b964b07152d234b70
```

* Add aaEncode/aaDecode

> Encode any JavaScript program to Japanese style emoticons (^_^).
>
> http://utf-8.jp/public/aaencode.html
javascript code:

```
alert('hello')
```

After aaencode:

```
゚ω゚ノ= /`m´)ノ ~┻━┻ //*´∇`*/ ['_']; o=(゚ー゚) =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); (゚Д゚) =(゚Θ゚)= (o^_^o)/ (o^_^o);(゚Д゚)={゚Θ゚: '_' ,゚ω゚ノ : ((゚ω゚ノ==3) +'_') [゚Θ゚] ,゚ー゚ノ :(゚ω゚ノ+ '_')[o^_^o -(゚Θ゚)] ,゚Д゚ノ:((゚ー゚==3) +'_')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'_') [c^_^o];(゚Д゚) ['c'] = ((゚Д゚)+'_') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];(゚Д゚) ['o'] = ((゚Д゚)+'_') [゚Θ゚];(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'_')[゚Θ゚]+ ((゚ω゚ノ==3) +'_') [゚ー゚] + ((゚Д゚) +'_') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'_') [゚Θ゚]+((゚ー゚==3) +'_') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+((゚Д゚)+'_') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+((゚ー゚==3) +'_') [゚Θ゚];(゚Д゚) ['_'] =(o^_^o) [゚o゚] [゚o゚];(゚ε゚)=((゚ー゚==3) +'_') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+((゚Д゚)+'_') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'_') [o^_^o -゚Θ゚]+((゚ー゚==3) +'_') [゚Θ゚]+ (゚ω゚ノ +'_') [゚Θ゚]; (゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\\'; (゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^_^o -(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ +'_')[c^_^o];(゚Д゚) [゚o゚]='\"';(゚Д゚) ['_'] ( (゚Д゚) ['_'] (゚ε゚+(゚Д゚)[゚o゚]+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚o゚]) (゚Θ゚)) ('_');
```

### v1.0.4 (2017/05/19)

* Fix Base16 Coding Error
Expand Down
8 changes: 8 additions & 0 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@
"caption": "XssEncode: Js16Decode",
"command": "js16_decode"
},
{
"caption": "XssEncode: AaEncode",
"command": "aa_encode"
},
{
"caption": "XssEncode: AaDecode",
"command": "aa_decode"
},
{
"caption": "XssEncode: TestEncode",
"command": "test_encode"
Expand Down
2 changes: 2 additions & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
{"caption": "-"},
{"id": "js16_encode", "caption": "Js16Encode", "command": "js16_encode"},
{"id": "js16_decode", "caption": "Js16Decode", "command": "js16_decode"},
{"id": "aa_encode", "caption": "aaEncode", "command": "aa_encode"},
{"id": "aa_decode", "caption": "aaDecode", "command": "aa_decode"},
{"caption": "-"},
{"id": "unicode_encode", "caption": "UnicodeEncode", "command": "unicode_encode"},
{"id": "unicode_decode", "caption": "UnicodeDecode", "command": "unicode_decode"},
Expand Down
103 changes: 102 additions & 1 deletion xssencode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sublime
import sublime_plugin
__VERSION__ = '1.0.4'
__VERSION__ = '1.0.5'


class XssEncodeCommand(sublime_plugin.TextCommand):
Expand Down Expand Up @@ -437,6 +437,107 @@ def convert(self, source_txt):
sublime.error_message("Js16Decode convert failed.")


class AaEncodeCommand(XssEncodeCommand):
u"""Encode any JavaScript program to Japanese style emoticons (^_^)."""

def aaencode(self, text):
import re
try:
text = unicode(text)
except:
pass
t = ""
b = [
"(c^_^o)",
"(゚Θ゚)",
"((o^_^o) - (゚Θ゚))",
"(o^_^o)",
"(゚ー゚)",
"((゚ー゚) + (゚Θ゚))",
"((o^_^o) +(o^_^o))",
"((゚ー゚) + (o^_^o))",
"((゚ー゚) + (゚ー゚))",
"((゚ー゚) + (゚ー゚) + (゚Θ゚))",
"(゚Д゚) .゚ω゚ノ",
"(゚Д゚) .゚Θ゚ノ",
"(゚Д゚) ['c']",
"(゚Д゚) .゚ー゚ノ",
"(゚Д゚) .゚Д゚ノ",
"(゚Д゚) [゚Θ゚]"
]
r = "゚ω゚ノ= /`m´)ノ ~┻━┻ //*´∇`*/ ['_']; o=(゚ー゚) =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); "
if re.search('ひだまりスケッチ×(365|356)\s*来週も見てくださいね[!!]', text):
r += "X=_=3; "
r += "\r\n\r\n X / _ / X < \"来週も見てくださいね!\";\r\n\r\n"

r += "(゚Д゚) =(゚Θ゚)= (o^_^o)/ (o^_^o);" +\
"(゚Д゚)={゚Θ゚: '_' ,゚ω゚ノ : ((゚ω゚ノ==3) +'_') [゚Θ゚] " + \
",゚ー゚ノ :(゚ω゚ノ+ '_')[o^_^o -(゚Θ゚)] " +\
",゚Д゚ノ:((゚ー゚==3) +'_')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'_') [c^_^o];" +\
"(゚Д゚) ['c'] = ((゚Д゚)+'_') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];" +\
"(゚Д゚) ['o'] = ((゚Д゚)+'_') [゚Θ゚];" +\
"(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'_')[゚Θ゚]+ ((゚ω゚ノ==3) +'_') [゚ー゚] + " +\
"((゚Д゚) +'_') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'_') [゚Θ゚]+" +\
"((゚ー゚==3) +'_') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+" +\
"((゚Д゚)+'_') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+" +\
"((゚ー゚==3) +'_') [゚Θ゚];(゚Д゚) ['_'] =(o^_^o) [゚o゚] [゚o゚];" +\
"(゚ε゚)=((゚ー゚==3) +'_') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+" +\
"((゚Д゚)+'_') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'_') [o^_^o -゚Θ゚]+" +\
"((゚ー゚==3) +'_') [゚Θ゚]+ (゚ω゚ノ +'_') [゚Θ゚]; " +\
"(゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\\\\'; " +\
"(゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^_^o -(゚Θ゚)];" +\
"(o゚ー゚o)=(゚ω゚ノ +'_')[c^_^o];" +\
"(゚Д゚) [゚o゚]='\\\"';" +\
"(゚Д゚) ['_'] ( (゚Д゚) ['_'] (゚ε゚+"
r += "(゚Д゚)[゚o゚]+ "
for i in range(len(text)):
n = ord(text[i])
t = "(゚Д゚)[゚ε゚]+"
if(n <= 127):
nt = "%o" % n
for x in range(len(nt)):
t += b[int(nt[x])] + "+ "
else:
nt = "%04x" % n
t += "(o゚ー゚o)+ "
for x in range(len(nt)):
t += b[int(eval("0x%s" % nt[x]))] + "+ "
r += t
r += "(゚Д゚)[゚o゚]) (゚Θ゚)) ('_');"
return r

def convert(self, source_txt):
try:
text = self.aaencode(source_txt)
return text
except:
sublime.error_message("aaEncode convert failed.")


class AaDecodeCommand(XssEncodeCommand):
u"""Encode any JavaScript program to Japanese style emoticons (^_^)."""

def convert(self, source_txt):
try:
evalPreamble = u"(\uFF9F\u0414\uFF9F) ['_'] ( (\uFF9F\u0414\uFF9F) ['_'] ("
decodePreamble = u"( (\uFF9F\u0414\uFF9F) ['_'] ("
evalPostamble = u") (\uFF9F\u0398\uFF9F)) ('_');"
decodePostamble = u") ());"
text = source_txt.strip()
if text.rfind(evalPostamble) < 0:
sublime.error_message("Given code is not encoded as aaencode.")
return source_txt
if text.rfind(evalPostamble) != len(text) - len(evalPostamble):
sublime.error_message("Given code is not encoded as aaencode.")
return source_txt
text = text.replace(evalPreamble, decodePreamble).replace(
evalPostamble, decodePostamble)
sublime.message_dialog('Decode end. Run the script you will see result.')
return text
except:
sublime.error_message("aaDecode convert failed.")


class HexStripxCommand(XssEncodeCommand):
def convert(self, source_txt):
try:
Expand Down

0 comments on commit dabbe66

Please sign in to comment.