[Perl TK] Codificator

  • 0 Respuestas
  • 1428 Vistas

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado BigBear

  • *
  • Underc0der
  • Mensajes: 543
  • Actividad:
    0%
  • Reputación 3
    • Ver Perfil

[Perl TK] Codificator

  • en: Julio 03, 2011, 09:59:24 pm
Un codificador con las sig opciones

  • Hex[/li]
  • SHA1[/li]
  • MD5[/li]
  • Base64[/li]
  • ASCII[/li]
  • URL[/li][/list]


    Imagen





    Código: Perl
    1. #!usr/bin/perl
    2. #Codificator (C) Doddy Hackman 2011
    3.  
    4. use Tk;
    5. use Digest::MD5;
    6. use Digest::SHA1;
    7. use MIME::Base64;
    8. use URI::Escape;
    9.  
    10. if ($^O eq 'MSWin32') {
    11. use Win32::Console;
    12. Win32::Console::Free();
    13. }
    14.  
    15. $header= "This tool encode text in :
    16.  
    17. Hex
    18. SHA1
    19. MD5
    20. Base64
    21. ASCII
    22. URL
    23.  
    24.  
    25. ";
    26.  
    27. $window = MainWindow->new(-background=>"black",-foreground=>"white");
    28. $window->geometry("500x500+80+80");
    29. $window->title("Codificator (C) Doddy Hackman 2011");
    30. $window->resizable(0,0);
    31. $window->Label(-background=>"black",-foreground=>"white",-font=>"Impact",-text=>"Codificator")->pack();
    32. $window->Label(-background=>"black",-foreground=>"white")->pack();
    33. $window->Label(-background=>"black",-foreground=>"white")->pack();
    34. $window->Label(-background=>"black",-foreground=>"white",-text=>"Code")->place(-x =>180, -y => 70);
    35. $window->Optionmenu(-background=>"black",-foreground=>"white",-activebackground=>'white',
    36. -options => [[HEX=>HEX], [ASCII=>ASCII], [BASE64=>BASE64], [MD5=>MD5],[SHA1=>SHA1],[URL=>URL]],  
    37. -variable => \$var,
    38. -textvariable => \$codificacion
    39. )->place(-x =>220, -y => 70);
    40. my $rot = $window->Text(-background=>"black",-foreground=>"white",-width=> 45,-height=> 15)->place(-x =>90, -y => 150);
    41. $window->Button(-text=>"Encode",-background=>"black",-foreground=>"white",-activebackground=>"white",-command=>\&encode,-width=>"10")->place(-x =>12, -y => 170);
    42. $window->Button(-text=>"Decode",-background=>"black",-foreground=>"white",-activebackground=>"white",-command=>\&decode,-width=>"10")->place(-x =>12, -y => 200);
    43. $window->Button(-text=>"Clear",-background=>"black",-foreground=>"white",-activebackground=>"white",-command=>\&clear,-width=>"10")->place(-x =>420, -y => 170);
    44. $window->Button(-text=>"About",-background=>"black",-foreground=>"white",-activebackground=>"white",-command=>\&about,-width=>"10")->place(-x =>420, -y => 200);
    45. $window->Button(-text=>"Exit",-background=>"black",-foreground=>"white",-activebackground=>"white",-command=>[$window=>'destroy'],-width=>"10")->place(-x =>420, -y => 230);
    46. $window->Label(-background=>"black",-foreground=>"white",-text=>"Copyright 2011 Doddy Hackman",-font=>"Impact")->place(-x =>150, -y => 430);
    47. $rot->insert('end',$header);
    48.  
    49. MainLoop;
    50.  
    51.  
    52. sub about {
    53. my $venta = MainWindow->new(-background=>"black");
    54. $venta->geometry("300x180+20+20");
    55. $venta->title("About");
    56. $venta->resizable(0,0);
    57. $venta->Label(-font=>"Impact",-text=>"\nCodificator",-background=>"black",-foreground=>"white")->pack();
    58. $venta->Label(-text=>"\nProgrammer : Doddy Hackman\n\nContact : lepuke[at]hotmail[com]\n\n",-background=>"black",-foreground=>"white")->pack();
    59. $venta->Button(-text=>"Exit",-foreground=>"white",-background=>"black",-command => [$venta => 'destroy'],-activebackground=>'white',-width=>"20")->pack()
    60. }
    61.  
    62. sub clear {
    63. $rot->delete('0.1','end');
    64. }
    65.  
    66. sub encode {
    67. $text = $rot->get("1.0", "end");
    68. chomp $text;
    69. &clear;
    70. if ($codificacion eq "HEX") {
    71. $result = hexar($text);
    72. $rot->insert('end',$result);
    73. print $result;
    74. }
    75.  
    76. elsif ($codificacion eq "SHA1") {
    77. $sha1 = Digest::SHA1->new->add($text);
    78. my $digest = $sha1->digest;
    79. $rot->insert('end',$digest);
    80. }
    81. elsif ($codificacion eq "BASE64") {
    82. $result = encode_base64($text);
    83. $rot->insert('end',$result);
    84. }
    85. elsif ($codificacion eq "URL") {
    86. my $codec  = Badger::Codec::URL->new();
    87. my $ya = $codec->encode($text);
    88. $rot->insert('end',$ya);
    89. }
    90. elsif ($codificacion eq "ASCII") {
    91. $result = ascii($text);
    92. $rot->insert('end',$result);
    93. }
    94. elsif ($codificacion eq "MD5") {
    95. $digest = Digest::MD5->md5_hex($text);
    96. $rot->insert('end',$digest);
    97. }
    98. else {
    99. $window->messageBox(-message=>"What?!\n");
    100. }}
    101.  
    102.  
    103. sub decode {
    104. $text = $rot->get("1.0", "end");
    105. chomp $text;
    106. &clear;
    107. if ($codificacion eq "HEX") {
    108. $result = decodera($text);
    109. $rot->insert('end',$result);
    110. }
    111.  
    112. elsif ($codificacion eq "SHA1") {
    113. $window->messageBox(-message=>"What?! , it's not possible with a function decoded\n");
    114. }
    115. elsif ($codificacion eq "BASE64") {
    116. $result = decode_base64($text);
    117. $rot->insert('end',$result);
    118. }
    119. elsif ($codificacion eq "URL") {
    120. my $codec  = Badger::Codec::URL->new();
    121. my $ya = $codec->decode($text);
    122. $rot->insert('end',$ya);
    123. }
    124. elsif ($codificacion eq "ASCII") {
    125. $result = ascii_de($text);
    126. $rot->insert('end',$result);
    127. }
    128. elsif ($codificacion eq "MD5") {
    129. $window->messageBox(-message=>"What?! , it's not possible with a function decoded\n");
    130. }
    131. else {
    132. $window->messageBox(-message=>"What?!\n");
    133. }}
    134.  
    135. sub hexar {
    136. my $string = $_[0];
    137. $hex = '0x';
    138. for (split //,$string) {
    139. $hex .= sprintf "%x", ord;
    140. }return $hex;}
    141.  
    142. sub ascii {
    143. return join ',',unpack "U*",$_[0];
    144. }
    145.  
    146.  
    147. sub decodera {
    148. $_[0] =~ s/^0x//;
    149. $encode = join q[], map { chr hex } $_[0] =~ /../g;
    150. return $encode;
    151. }
    152.  
    153. sub ascii_de {
    154. $_[0] = join q[], map { chr } split q[,],$_[0];
    155. return $_[0];
    156. }
    157.  
    158. # ¿ The End ?
    159.  
« Última modificación: Julio 17, 2011, 03:44:38 am por Sthefano02 »

 

Tutorial perl desde cero By: Black Poision & Painboy

Iniciado por ProcessKill

Respuestas: 2
Vistas: 5330
Último mensaje Septiembre 02, 2011, 09:43:36 pm
por blozzter
[Perl] Verificando si es root para correr un script

Iniciado por c1st

Respuestas: 1
Vistas: 3473
Último mensaje Octubre 07, 2012, 06:01:39 pm
por ANTRAX
[Uniscan] Scanner de vulnerabilidades WEB hecho en Perl

Iniciado por tar3kw0rm3d

Respuestas: 0
Vistas: 3015
Último mensaje Junio 02, 2013, 08:01:28 pm
por tar3kw0rm3d
[Perl] Counter Strike 1.6 Servers List

Iniciado por BigBear

Respuestas: 0
Vistas: 2560
Último mensaje Noviembre 12, 2012, 07:32:11 pm
por BigBear
DoSing IP 1.0 - [Creado por SkillmaX] + Source [PERL]

Iniciado por SkillmaX

Respuestas: 0
Vistas: 2598
Último mensaje Julio 04, 2010, 10:14:31 am
por SkillmaX