• Viernes 29 de Marzo de 2024, 09:34

Autor Tema:  [wxPython - GUI] - d33k40 De/Crypter text v2.0  (Leído 1201 veces)

d33k40

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
[wxPython - GUI] - d33k40 De/Crypter text v2.0
« en: Miércoles 26 de Mayo de 2010, 04:46 »
0
Buenas, soy nuevo aquí y me gustaría ir aportando, esta es la segunda versión de este de/criptador de texto en versión GUI con wxPython usando XRC

ht tp : / / s 2 . subirimagenes . c o m/p rivadas/1001718pantallazo . png (unir)

de-crypter-text.py:
Código: Python
  1. import wx
  2. from wx import xrc
  3.  
  4. class Prog(wx.App):
  5.     def OnInit(self):
  6.  
  7.         self.res = xrc.XmlResource('recursos.xrc')
  8.         self.frame = self.res.LoadFrame(None, 'Frame1')
  9.         self.dialog = self.res.LoadDialog(None, 'Dialog1')
  10.        
  11.         self.botonLimpiar = xrc.XRCCTRL(self.frame, 'button1')
  12.         self.frame.Bind(wx.EVT_BUTTON, self.Limpiar, self.botonLimpiar)
  13.         self.botonLimpiar2 = xrc.XRCCTRL(self.frame, 'button2')
  14.         self.frame.Bind(wx.EVT_BUTTON, self.Limpiar2, self.botonLimpiar2)
  15.        
  16.         self.botonCryptar = xrc.XRCCTRL(self.frame, 'button4')
  17.         self.frame.Bind(wx.EVT_BUTTON, self.Cryptar, self.botonCryptar)
  18.         self.botonDecryptar = xrc.XRCCTRL(self.frame, 'button5')
  19.         self.frame.Bind(wx.EVT_BUTTON, self.Decryptar, self.botonDecryptar)
  20.  
  21.  
  22.         self.botonAbout = xrc.XRCCTRL(self.frame, 'button3')
  23.         self.frame.Bind(wx.EVT_BUTTON, self.About, self.botonAbout)
  24.        
  25.         self.Texto = xrc.XRCCTRL(self.frame, 'textCtrl1')
  26.  
  27.         self.Texto2 = xrc.XRCCTRL(self.frame, 'textCtrl2')
  28.        
  29.         self.frame.Show()
  30.  
  31.         return True
  32.     def Limpiar(self, event):
  33.         self.Texto.Clear()
  34.     def Limpiar2(self, event):
  35.         self.Texto2.Clear()
  36.     def About(self, event):
  37.         self.dialog.Show()
  38.     def Cryptar(self, event):
  39.         li = self.Texto.GetNumberOfLines()
  40.         le = 0
  41.         while le <= li - 1:
  42.             lin = self.Texto.GetLineText(le)
  43.             text = lin
  44.             salir = False
  45.             v3 = 0
  46.             while v3 <= 26:
  47.                 v1 = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", " "]
  48.                 v2 = ["1-", "2-", "3-", "4-", "5-", "6-", "7-", "8-", "9-", "10-", "11-", "12-", "13-", "14-", "15-", "16-", "17-", "18-", "19-", "20-", "21-", "22-", "23-", "24-", "25-",  "26-", "27-"]
  49.                 text = text.replace(v1[v3], v2[v3])
  50.                 v3 = v3 + 1
  51.             self.Texto2.WriteText(text + "n")
  52.             le = le + 1
  53.         wx.MessageBox("Texto encriptado correctamente")
  54.     def Decryptar(self, event):
  55.         li = self.Texto.GetNumberOfLines()
  56.         le = 0
  57.         while le <= li - 1:
  58.             lin = self.Texto.GetLineText(le)
  59.             text = lin
  60.             salir = False
  61.             v3 = 0
  62.             while v3 <= 26:
  63.                 v1 = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", " "]
  64.                 v2 = ["1-", "2-", "3-", "4-", "5-", "6-", "7-", "8-", "9-", "10-", "11-", "12-", "13-", "14-", "15-", "16-", "17-", "18-", "19-", "20-", "21-", "22-", "23-", "24-", "25-",  "26-", "27-"]
  65.                 text = text.replace(v2[v3], v1[v3])
  66.                 v3 = v3 + 1
  67.             self.Texto2.WriteText(text + "n")
  68.             le = le + 1
  69.         wx.MessageBox("Texto desencriptado correctamente")
  70.  
  71.  
  72. if __name__ == '__main__':
  73.     Crypter = Prog()
  74.     Crypter.MainLoop()
  75.  

recursos.xrc:
(unir el link de la etiqueta resource, no me deja postearlo por los permisos de URL)
Código: XML
  1. <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
  2.  <resource xmlns="http : / / ww w . wxw indow s.or g/wx xrc" version="2. 3.0.1" >
  3.     <object class="wxFrame" name="Frame1">
  4.         <style>wxDEFAULT_FRAME_STYLE|wxSTAY_ON_TOP|wxTAB_TRAVERSAL</style>
  5.         <size>500,600</size>
  6.         <bg>#000000</bg>
  7.         <title>d33k40 De/Crypter Text v2.0</title>
  8.         <centered>1</centered>
  9.         <object class="wxBoxSizer">
  10.             <orient>wxVERTICAL</orient>
  11.             <object class="sizeritem">
  12.                 <option>0</option>
  13.                 <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
  14.                 <border>5</border>
  15.                 <object class="wxStaticBitmap" name="bitmap1">
  16.                     <bitmap>sc.png</bitmap>
  17.                 </object>
  18.             </object>
  19.             <object class="sizeritem">
  20.                 <option>1</option>
  21.                 <flag>wxEXPAND</flag>
  22.                 <border>5</border>
  23.                 <object class="wxBoxSizer">
  24.                     <orient>wxHORIZONTAL</orient>
  25.                     <object class="sizeritem">
  26.                         <option>1</option>
  27.                         <flag>wxEXPAND</flag>
  28.                         <border>5</border>
  29.                         <object class="wxBoxSizer">
  30.                             <orient>wxVERTICAL</orient>
  31.                             <object class="sizeritem">
  32.                                 <option>0</option>
  33.                                 <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
  34.                                 <border>5</border>
  35.                                 <object class="wxStaticText" name="staticText1">
  36.                                     <fg>#00ff00</fg>
  37.                                     <label>Texto:</label>
  38.                                 </object>
  39.                             </object>
  40.                             <object class="sizeritem">
  41.                                 <option>0</option>
  42.                                 <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
  43.                                 <border>5</border>
  44.                                 <object class="wxButton" name="button1">
  45.                                     <label>Limpiar</label>
  46.                                     <default>0</default>
  47.                                 </object>
  48.                             </object>
  49.                         </object>
  50.                     </object>
  51.                     <object class="sizeritem">
  52.                         <option>0</option>
  53.                         <flag>wxALL</flag>
  54.                         <border>5</border>
  55.                         <object class="wxTextCtrl" name="textCtrl1">
  56.                             <style>wxHSCROLL|wxTE_MULTILINE</style>
  57.                             <size>400,70</size>
  58.                             <bg>#00ff00</bg>
  59.                             <fg>#000000</fg>
  60.                             <value></value>
  61.                             <maxlength>0</maxlength>
  62.                         </object>
  63.                     </object>
  64.                 </object>
  65.             </object>
  66.             <object class="sizeritem">
  67.                 <option>1</option>
  68.                 <flag>wxEXPAND</flag>
  69.                 <border>5</border>
  70.                 <object class="wxBoxSizer">
  71.                     <orient>wxHORIZONTAL</orient>
  72.                     <object class="sizeritem">
  73.                         <option>1</option>
  74.                         <flag>wxEXPAND</flag>
  75.                         <border>5</border>
  76.                         <object class="wxBoxSizer">
  77.                             <orient>wxVERTICAL</orient>
  78.                             <object class="sizeritem">
  79.                                 <option>0</option>
  80.                                 <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
  81.                                 <border>5</border>
  82.                                 <object class="wxStaticText" name="staticText2">
  83.                                     <fg>#00ff00</fg>
  84.                                     <label>Salida:</label>
  85.                                 </object>
  86.                             </object>
  87.                             <object class="sizeritem">
  88.                                 <option>0</option>
  89.                                 <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
  90.                                 <border>5</border>
  91.                                 <object class="wxButton" name="button2">
  92.                                     <label>Limpiar</label>
  93.                                     <default>0</default>
  94.                                 </object>
  95.                             </object>
  96.                         </object>
  97.                     </object>
  98.                     <object class="sizeritem">
  99.                         <option>0</option>
  100.                         <flag>wxALL</flag>
  101.                         <border>5</border>
  102.                         <object class="wxTextCtrl" name="textCtrl2">
  103.                             <style>wxHSCROLL|wxTE_MULTILINE</style>
  104.                             <size>400,70</size>
  105.                             <bg>#00ff00</bg>
  106.                             <fg>#000000</fg>
  107.                             <value></value>
  108.                             <maxlength>0</maxlength>
  109.                         </object>
  110.                     </object>
  111.                 </object>
  112.             </object>
  113.             <object class="sizeritem">
  114.                 <option>1</option>
  115.                 <flag>wxEXPAND|wxALIGN_CENTER_HORIZONTAL</flag>
  116.                 <border>5</border>
  117.                 <object class="wxBoxSizer">
  118.                     <orient>wxHORIZONTAL</orient>
  119.                     <object class="sizeritem">
  120.                         <option>0</option>
  121.                         <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
  122.                         <border>5</border>
  123.                         <object class="wxButton" name="button3">
  124.                             <label>About</label>
  125.                             <default>0</default>
  126.                         </object>
  127.                     </object>
  128.                     <object class="spacer">
  129.                         <option>1</option>
  130.                         <flag>wxEXPAND</flag>
  131.                         <border>5</border>
  132.                         <size>0,0</size>
  133.                     </object>
  134.                     <object class="sizeritem">
  135.                         <option>0</option>
  136.                         <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
  137.                         <border>5</border>
  138.                         <object class="wxButton" name="button4">
  139.                             <label>Crypt!</label>
  140.                             <default>0</default>
  141.                         </object>
  142.                     </object>
  143.                     <object class="spacer">
  144.                         <option>1</option>
  145.                         <flag>wxEXPAND</flag>
  146.                         <border>5</border>
  147.                         <size>0,0</size>
  148.                     </object>
  149.                     <object class="sizeritem">
  150.                         <option>0</option>
  151.                         <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
  152.                         <border>5</border>
  153.                         <object class="wxButton" name="button5">
  154.                             <label>Decrypt!</label>
  155.                             <default>0</default>
  156.                         </object>
  157.                     </object>
  158.                 </object>
  159.             </object>
  160.             <object class="sizeritem">
  161.                 <option>0</option>
  162.                 <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
  163.                 <border>5</border>
  164.                 <object class="wxStaticText" name="staticText4">
  165.                     <bg>#000000</bg>
  166.                     <fg>#00ff00</fg>
  167.                     <label>Coded by: d33k40</label>
  168.                 </object>
  169.             </object>
  170.             <object class="sizeritem">
  171.                 <option>0</option>
  172.                 <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
  173.                 <border>5</border>
  174.             </object>
  175.         </object>
  176.     </object>
  177.     <object class="wxDialog" name="Dialog1">
  178.         <style>wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP</style>
  179.         <bg>#000000</bg>
  180.         <title>About</title>
  181.         <object class="wxBoxSizer">
  182.             <orient>wxVERTICAL</orient>
  183.             <object class="sizeritem">
  184.                 <option>0</option>
  185.                 <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
  186.                 <border>5</border>
  187.                 <object class="wxStaticBitmap" name="bitmap2">
  188.                     <bitmap>sc.png</bitmap>
  189.                 </object>
  190.             </object>
  191.             <object class="sizeritem">
  192.                 <option>0</option>
  193.                 <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
  194.                 <border>5</border>
  195.                 <object class="wxStaticText" name="staticText3">
  196.                     <fg>#00ff00</fg>
  197.                     <label>Coded by: d33k40nnAgradecimientos:n- [Bacardi]n- A la comunidad "Infierno Hacker", todos y cada unonde ellos.</label>
  198.                 </object>
  199.             </object>
  200.             <object class="sizeritem">
  201.                 <option>0</option>
  202.                 <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
  203.                 <border>5</border>
  204.             </object>
  205.         </object>
  206.     </object>
  207. </resource>
  208.  

Pueden cambiar los caracteres a reemplazar por la cadena que quieran, si añaden caracteres, no olviden aumentar el bucle.

Saludos