Text To hexa - python (Source Code)
3 posters
Page 1 of 1
Text To hexa - python (Source Code)
- Code:
#!/usr/bin/python
print "\n###############################################################"
print "## {{{ Text To Hexa }}} ##"
print "## {{{ HEXA To Text }}} ##"
print "## vir0e5 -[ banditc0de ]- ##"
print "## vir0e5 | NKRI ##"
print "## Notice : BOYCOTT MALAYSIAN PRODUCT FOR HUMAN RIGHTS!!! ##"
print "############################################################### \n"
from Tkinter import *
from binascii import *
class AsciiHex:
def __init__(self, master):
frame = Frame(master)
frame.pack()
frame.master.title('Text to Hexa by: vir0e5')
self.lascii = Label(frame, text='Text:')
self.lascii.grid(row=0, column=0)
self.lhex = Label(frame, text='Hexa:')
self.lhex.grid(row=0, column=3)
self.tascii = Text(frame, width = 45, height=16)
self.tascii.grid(row=1, column=0, rowspan=2)
self.thex = Text(frame, width = 45, height=16)
self.thex.grid(row=1, column=3, rowspan=2)
self.bascii = Button(frame, text='Text->Hexa',width = 10, height=1, command=self.asciihex)
self.bascii.grid(row=1, column=2)
self.bhex = Button(frame, text='Text<-Hexa', width = 10, height=1,command=self.hexascii)
self.bhex.grid(row=2, column=2)
self.footer = Button(frame, text='Exit',width = 10, height=1, foreground='blue',
command=quit )
self.footer.grid(row=7, column=2)
def asciihex(self):
self.thex.delete(1.0, END)
a = self.tascii.get(1.0, END)
l = len(a)-1
w = 0
while l>w:
ascii = a[w:w+1]
ascii = b2a_hex(ascii).upper() + ' '
self.thex.insert(END, ascii)
w=w+1
def hexascii(self):
self.tascii.delete(1.0, END)
r = self.thex.get(1.0, END)
l = len(r)-1
u = 0
while l>u:
ahex = r[u:u+2]
ahex = a2b_hex(ahex)
self.tascii.insert(END, ahex)
u = u+3
root = Tk()
app = AsciiHex(root)
root.mainloop()
share dikit....
Buat ngebantu text ke Hexa ..dan hexa ke text...
http://www.dreamincode.net/code/snippet4581.htm
Re: Text To hexa - python (Source Code)
mantap kk,, thx for share... mayan buat koleksi ular phyton di rumah,,
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum