coding python buat encrypt ama decrypt Base64
langsung cek this out *_*
Sekian *_*
langsung cek this out *_*
Code:
#!/usr/bin/python
# work di python 2.x
# promina.py
import os, sys
from base64 import standard_b64encode, standard_b64decode
#bersih-bersih :v
if sys.platform == 'linux-i386' or sys.platform == 'darwin' or sys.platform == 'linux2':
sysCommand = 'clear'
elif sys.platform == 'win32' or sys.platform == 'ms-dos' or sys.platform == 'dos':
sysCommand = 'cls'
else:
sysCommand = 'jancok'
#input
def promina() :
os.system(sysCommand)
print '|===================|'
print ' '
print '\n1. Base64 Decrypt '
print '\n2. Base64 Encrypt '
print '\n3. Keluar '
print ' '
print '|===================|'
Masuk = raw_input('\n\nMasukan Pilihan: ')
if (Masuk == '1'):
prenagen()
elif (Masuk == '2'):
sule()
elif (Masuk == '3'):
os.system(sysCommand)
sys.exit(1)
else:
Promina()
#encode
def sule() :
os.system(sysCommand)
masuk = raw_input("\nMasukan string: ")
try:
crut = standard_b64encode(masuk)
print '\n',masuk,' = ',crut
print ' '
file = open("sementara.txt", "a")
file.write(crut)
file.close()
except:
os.system(sysCommand)
print 'ITU NGGAK BISA SETAN !!!'
sys.exit()
simpan = raw_input('Simpan hasil encode ? (y/n) : ')
os.system(sysCommand)
if (simpan == 'y'):
f = open("encode.txt", "a+")
f.write("\n")
f.write(standard_b64encode(masuk))
f.close
os.system(sysCommand)
print '\nfile disimpan di encode.txt'
elif (simpan == 'n'):
sys.exit()
else :
os.system(sysCommand)
print 'JANCOK,MASUKIN PILIHAN YANG ADA !!!'
prikitiw()
#Decode
def prenagen() :
os.system(sysCommand)
masuk = raw_input("\nMasukan string : ")
try:
hasil = standard_b64decode(masuk)
print '\n',masuk,' = ',hasil
print ' '
file = open("sementawis.txt", "a")
file.write(hasil)
file.close()
except:
print 'ITU NGGAK BISA SETAN!!!'
sys.exit()
nyimpan = raw_input('Simpan hasil Decode ? (y/n) : ')
os.system(sysCommand)
if (nyimpan == 'y'):
f = open("decode.txt", "a+")
f.write("\n")
f.write(standard_b64decode(masuk))
f.close
os.system(sysCommand)
print '\nfile berhasil disimpan di decoded.txt'
elif (nyimpan == 'n'):
sys.exit()
else:
os.system(sysCommand)
print 'JANCOK,MASUKIN PILIHAN YANG ADA !!!'
prakataw()
#ulangi encode
def prikitiw() :
masuk = raw_input('\nUlang Lagi? (y/n) : ')
if (masuk == 'y'):
sule()
elif (masuk == 'n'):
promina()
else:
prikitiw()
#ulangi decode
def prakataw() :
masuk = raw_input('\nUlang Lagi? (y/n) : ')
if (masuk == 'y'):
prenagen()
elif (masuk == 'n'):
promina()
else:
prakataw()
promina()Code:
python promina.pySekian *_*





