From dabbe6647d53462f9d33504b0b76a83ef6961e2d Mon Sep 17 00:00:00 2001 From: Medicean Date: Tue, 1 Aug 2017 15:48:29 +0800 Subject: [PATCH] Add aaEncode/aaDecode Encode any JavaScript program to Japanese style emoticons (^_^) --- CHANGELOG.md | 27 ++++++++++ Default.sublime-commands | 8 +++ Main.sublime-menu | 2 + xssencode.py | 103 ++++++++++++++++++++++++++++++++++++++- 4 files changed, 139 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 943ddff..0f7e703 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Default.sublime-commands b/Default.sublime-commands index 04f7593..3ce5716 100644 --- a/Default.sublime-commands +++ b/Default.sublime-commands @@ -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" diff --git a/Main.sublime-menu b/Main.sublime-menu index 08be4af..afb408a 100644 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -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"}, diff --git a/xssencode.py b/xssencode.py index 15f4f51..6ecd392 100644 --- a/xssencode.py +++ b/xssencode.py @@ -1,6 +1,6 @@ import sublime import sublime_plugin -__VERSION__ = '1.0.4' +__VERSION__ = '1.0.5' class XssEncodeCommand(sublime_plugin.TextCommand): @@ -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: