diff options
author | tv <tv@iiso> | 2011-09-24 21:14:35 +0200 |
---|---|---|
committer | tv <tv@iiso> | 2011-09-24 21:14:35 +0200 |
commit | e692ab13d032df6e8c96bf1ec840f366122dca1f (patch) | |
tree | 6b5cddee32d52d8de4005c93204665acbb762925 /crypto | |
parent | a1885b309ceb50afddf3b6cf758b3569e942ecbb (diff) | |
parent | 53679fedeb1db9d68399638fc44aa4cf4ac5ee1c (diff) |
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'crypto')
-rwxr-xr-x | crypto/bin/ukrepl | 67 |
1 files changed, 53 insertions, 14 deletions
diff --git a/crypto/bin/ukrepl b/crypto/bin/ukrepl index 21aa4d84..b3b25db9 100755 --- a/crypto/bin/ukrepl +++ b/crypto/bin/ukrepl @@ -1,19 +1,19 @@ #!/usr/bin/python # -*- coding: utf-8 -*- import sys + wont_change = { ' ' : ' ' , '\n' : '\n' } -fixed_active = False -def fixed_width_replace(char): - if char in wont_change: print char, +def fixed_width_replace(char): #f + if char in wont_change: return unicode(char) else: try: - print unichr(0xFF00 + ord(char)-32), + if not 32 < ord(char) < 126: raise Exception("not in range") + return unichr(0xFF00 + ord(char)-32) except: - print char, + return char -cyr_active = False cyrillic_dict = { 'A' : u'А', 'a' : 'а','Ä' : u'Ӓ', 'ä' : u'ӓ', 'B' : u'В', @@ -31,14 +31,49 @@ cyrillic_dict = { 'T' : u'г' } -def cyrillic_replace(char): - print cyrillic_dict.get(char,char), +def cyrillic_replace(char): #c + return cyrillic_dict.get(char,unicode(char)) +historic_latin_dict = { + 'B' : u'Ɓ', + 'b' : u'ƅ', + 'u' : u'ư', + 'U' : u'Ư', + '' : 'Ǟ', + #'5' : 'ƽ', + 'o' : 'ơ', + 'O' : 'Ơ', + '5' : 'Ƽ' + } +def historic_latin(char): #H + return historic_latin_dict.get(char,unicode(char)) +punctuation_dict = { + '!' : u'ǃ', + '\'': u'’', + '\"': u'ˮ', + '(' : u'⟨', + ')' : u'⟩', + ':' : u'ː', + #'-' : u'‒', + #'-' : u'—', + #'-' : u'―', + #'-' : u'‐', + #'-' : u'⁃', + '-' : u'–', + '_' : u'−', + '~' : u'⁓', + #'~' : u'∼', + #'~' : u'〜', + } +def punctuation(char): #p + return punctuation_dict.get(char,unicode(char)) def helpme(): print "usage %s [modes]" % sys.argv[0] print "modes:" print " c -- cyrillic replace" print " f -- fixed width" + print " p -- replace punctuation" + print " H -- replace with historic latin chars" print " h -- this message" sys.exit(0) @@ -49,14 +84,18 @@ if not modes : modes = "f" if 'h' in modes: helpme() -for mode in modes: - for line in sys.stdin: - for char in line: +for line in sys.stdin: + for char in line: + for mode in modes: if mode is 'c': - cyrillic_replace(char) + char = cyrillic_replace(char) elif mode is 'f': - fixed_width_replace(char) + char = fixed_width_replace(char) + elif mode is 'H': + char = historic_latin(char) + elif mode is 'p': + char = punctuation(char) else: print "unknown mode %c" % mode helpme() - + print char, |