Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: xassiz_ en 1 Junio 2010, 15:21 pm



Título: [wxPython] RTH Text Converter! - by xassiz
Publicado por: xassiz_ en 1 Junio 2010, 15:21 pm
RTH Text Converter

(http://r.i.elhacker.net/cache?url=http://i47.tinypic.com/24qv8xt.jpg)


Bueno, os traigo esta herramienta que he programado.


Funciones:
Código:
-ASCII
-Hexadecimal
-Base64
-MD5 (lo crackea a partir de una web online, que por cierto es mala (las buenas tienen captcha xDD))
-URL encode

Espero que os guste, más bien, que os sea de utilidad xDD

A mi por lo menos me es útil para algunas cosas.. bueno, aquí el código:

Código
  1. #!/usr/bin/env python
  2. #RTH Text Converter - by xassiz
  3.  
  4. import wx,base64,md5,urllib,sys,binascii
  5.  
  6. class Frame(wx.Frame):
  7.    def __init__(self):
  8.        wx.Frame.__init__(self, None, -1, title='RTH Text Converter  -  by xassiz', pos=wx.DefaultPosition,
  9.            size=wx.Size(450, 450), style=wx.DEFAULT_FRAME_STYLE^(wx.RESIZE_BORDER|wx. MAXIMIZE_BOX))
  10.        self.panel = wx.Panel(self, id=1, pos=(0, 0), size=(300, 520))
  11.        wx.StaticText(self.panel, label='Texto:', pos=wx.Point(8,18), size=wx.Size(33,13), style=0)
  12.        wx.StaticText(self.panel, label='Salida:', pos=wx.Point(8,152), size=wx.Size(33,13), style=0)
  13.        ascii = wx.Button(self.panel, label='ASCII', pos=wx.Point(50,288), size=wx.Size(75,23), style=0)
  14.        hexa = wx.Button(self.panel, label='HEX', pos=wx.Point(125,288), size=wx.Size(75,23), style=0)
  15.        base_64 = wx.Button(self.panel, label='Base64', pos=wx.Point(200,288), size=wx.Size(75,23), style=0)
  16.        md5_ = wx.Button(self.panel, label='MD5', pos=wx.Point(275,288), size=wx.Size(75,23), style=0)
  17.        url_encode = wx.Button(self.panel, label='URL', pos=wx.Point(350,288), size=wx.Size(75,23), style=0)
  18.        borrar = wx.Button(self.panel, label='Borrar', pos=wx.Point(265,345), size=wx.Size(80,46), style=0)
  19. about = wx.Button(self.panel, label='About', pos=wx.Point(345,345), size=wx.Size(80,46), style=0)
  20.        self.cifrar = wx.RadioButton(self.panel, label='cifrar', pos=wx.Point(50,345), size=wx.Size(80,23), style=0)
  21.        self.descifrar = wx.RadioButton(self.panel, label='descifrar', pos=wx.Point(50,370), size=wx.Size(80,23), style=0)
  22.        self.accion = "enc"
  23.        self.txtNormal = wx.TextCtrl(self.panel, pos=wx.Point(48,18), size=wx.Size(375, 120), style=0, value='')
  24.        self.txtConvertido = wx.TextCtrl(self.panel, pos=wx.Point(48,152), size=wx.Size(375,120), style=0, value='')
  25.        self.Bind(wx.EVT_BUTTON, self.ascii, ascii)
  26.        self.Bind(wx.EVT_BUTTON, self.hexa, hexa)
  27.        self.Bind(wx.EVT_BUTTON, self.base_64, base_64)
  28.        self.Bind(wx.EVT_BUTTON, self.md5_, md5_)
  29.        self.Bind(wx.EVT_BUTTON, self.url_encode, url_encode)
  30.        self.Bind(wx.EVT_BUTTON, self.borrar, borrar)
  31.        self.Bind(wx.EVT_BUTTON, self.about, about)
  32.        self.Bind(wx.EVT_RADIOBUTTON, self.accion_enc, self.cifrar)
  33.        self.Bind(wx.EVT_RADIOBUTTON, self.accion_des, self.descifrar)
  34.  
  35.    def ascii(self, event):
  36.        textoNormal = self.txtNormal.GetValue()
  37.        if self.accion == "enc":
  38.            ascii = ''
  39.            for x in textoNormal:
  40.                ascii = ascii + str(ord(x)) + ","
  41.            ascii = ascii[:-1]
  42.            self.txtConvertido.SetValue(ascii)
  43.        elif self.accion == "des":
  44.            normal = ''
  45.            textoNormal = textoNormal.replace(","," ")
  46.            textoNormal = textoNormal.replace("."," ")
  47.            for x in textoNormal.split():
  48.                normal = normal + chr(int(x))
  49.            self.txtConvertido.SetValue(normal)
  50.  
  51.    def hexa(self, event):
  52.        textoNormal = self.txtNormal.GetValue()
  53.        if self.accion == "enc":
  54.            hexa = ''
  55.            for x in textoNormal:
  56.                hexa = hexa + hex(ord(x))
  57.            hexa = "0x%s" % hexa.replace("0x","")
  58.            self.txtConvertido.SetValue(hexa)
  59.        elif self.accion == "des":
  60.            normal = textoNormal.replace('0x','')
  61.            normal = binascii.unhexlify(normal)
  62.            self.txtConvertido.SetValue(normal.replace("'",""))
  63.  
  64.    def base_64(self, event):
  65.        textNormal = self.txtNormal.GetValue()
  66.        if self.accion == "enc":
  67.            self.txtConvertido.SetValue(base64.encodestring(textNormal))
  68.        else:
  69.            self.txtConvertido.SetValue(base64.decodestring(textNormal))
  70.  
  71.    def md5_(self, event):
  72.        textNormal = self.txtNormal.GetValue()
  73.        if self.accion == "enc":
  74.            textConvertido = md5.new()
  75.            textConvertido.update(textNormal)
  76.            textConvertido = repr(textConvertido.hexdigest())
  77.            self.txtConvertido.SetValue(textConvertido.replace("'",""))
  78.        elif self.accion == "des":
  79.            x=urllib.urlopen("http://www.md5-lookup.com/livesearch.php?q=%s"%textNormal).read()
  80.            if 'No results found' in x:
  81.                self.txtConvertido.SetValue("No se encontraron resultados")
  82.            elif len(textNormal) != 32:
  83.                self.txtConvertido.SetValue("No es un MD5")
  84.            else:
  85.                x=x.split("\n")
  86.                x=x[16].replace('  <td width="250">','')
  87.                self.txtConvertido.SetValue(x.replace('</td>',''))
  88.  
  89.    def url_encode(self, event):
  90.        textNormal = self.txtNormal.GetValue()
  91.        if self.accion == "enc":
  92.            textConvertido = urllib.urlencode({'xassiz':textNormal})
  93.            self.txtConvertido.SetValue(textConvertido.replace("xassiz=",""))
  94.        elif self.accion == "des":
  95.            self.txtConvertido.SetValue(urllib.unquote_plus(textNormal))
  96.  
  97.    def borrar(self, event):
  98.        self.txtNormal.SetValue('')
  99.        self.txtConvertido.SetValue('')
  100.  
  101.    def about(self, event):
  102. wx.MessageBox("Autor: xassiz","RTH Text Converter")
  103. wx.MessageBox("Dedicado a http://foro.rthacker.NET","RTH Text Converter")
  104.  
  105.    def accion_enc(self, event):
  106.        self.accion = "enc"
  107.    def accion_des(self, event):
  108.        self.accion = "des"
  109.  
  110.  
  111. class App(wx.App):
  112.    def OnInit(self):
  113.        frame = Frame()
  114.        frame.Show()
  115.        self.SetTopWindow(frame)
  116.        return True
  117.  
  118. if __name__ == '__main__':
  119.    app = App()
  120.    app.MainLoop()
  121.  

Saludos


Título: Re: [wxPython] RTH Text Converter! - by xassiz
Publicado por: .:Swik:. en 1 Junio 2010, 15:32 pm
Chapeau xassiz  :D


Título: Re: [wxPython] RTH Text Converter! - by xassiz
Publicado por: xassiz_ en 1 Junio 2010, 18:32 pm
Gracias bro ^^ Espero sugerencias para la siguiente version