decode binari

import os, re, sys, binascii, platform
from itertools import cycle
from string import lowercase, uppercase
G = '\x1b[32;1m'
W = '\x1b[37;1m'
R = '\x1b[91;1m'
Y = '\x1b[93;1m'
B = '\x1b[94;1m'
os.system('clear')
print ''
print '                      ' + Y + ' | '
print '' + R + '_______________    __ ' + Y + '-+-' + R + '  ________________    '
print '' + R + '\\_____        /   /_ \\ ' + Y + '|' + R + '   \\         _____/  ' + G + 'BinCon - Binary Converter '
print '' + R + ' \\_____       \\____/  \\____/       _____/    ' + R + 'Author : M.Daffa ( Dfv47 )'
print '' + R + '  \\_____     ' + W + 'Binary Converter' + R + '    _____/      ' + G + 'Team   : Black Coder Crush     '
print '' + R + '     \\______________  ___________/           ' + R + 'Email  : daffamfthhsn21@gmail.com'
print '' + R + '                  /____\\\n'
x = raw_input
daffa_gans = R + '          [' + Y + '1' + R + '] ' + W + 'Encode                              ' + R + '[' + Y + '2' + R + '] ' + W + 'Decode\n\n                             ' + R + '[' + Y + '+' + R + '] ' + W + 'Pilih ' + R + ':' + W + ' '
dfv_bcc = ['          ' + R + '[' + Y + '+' + R + '] ' + W + 'Result         :' + Y + ' ',
 '          ' + R + '[' + Y + '+' + R + '] ' + W + 'Text to Encode :' + Y + ' ',
 '          ' + R + '[' + Y + '+' + R + '] ' + W + 'Text to Decode :' + Y + ' ']

def bcc_dfv():
    a = int(x(daffa_gans))
    print ''
    if a > 2:
        sys.exit()
    b = x(dfv_bcc[a])
    return (
     a, b)


try:
    o, s = bcc_dfv()
    print ('{}{}').format(dfv_bcc[0], bin(int(binascii.hexlify(s), 16)) if o == 1 else binascii.unhexlify('%x' % int(s, 2)) if o == 2 else '')
    print ''
    daffa = '          ' + R + '[' + Y + 'B' + R + ']' + W + 'ack ' + B + 'or ' + R + '[' + Y + 'E' + R + ']' + W + 'xit : '
    daf = raw_input(daffa)
    if daf == 'b' or daf == 'B' or daf == 'Back' or daf == 'back':
        os.system('python2 bin.con')
    elif daf == 'e' or daf == 'E' or daf == 'exit' or daf == 'Exit':
        sys.exit()
except KeyboardInterrupt:
    sys.exit()


Posting Komentar