elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Perl] ASCII Art 0.1
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Perl] ASCII Art 0.1  (Leído 1,416 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] ASCII Art 0.1
« en: 3 Octubre 2012, 01:14 am »

Sin mucho que decir dejo este simple script para hacer ascii art desde una palabra.

El codigo

Código
  1. #!usr/bin/perl
  2. #ASCII Art 0.1
  3. #Coded By Doddy H
  4.  
  5. use List::Util "max";
  6. use Time::HiRes "usleep";
  7.  
  8. my %letras = (
  9.  
  10.    a => "        
  11.   @  
  12.   @  
  13.  @ @  
  14.  @ @  
  15. @   @
  16. @   @
  17. @@@@@
  18. @     @
  19. @     @
  20. ",
  21.  
  22.    b => "
  23. @@@@
  24. @   @
  25. @   @
  26. @   @
  27. @@@@
  28. @   @
  29. @   @
  30. @   @
  31. @@@@
  32. ",
  33.  
  34.    c => "
  35.  @@@@
  36. @    @
  37. @    
  38. @    
  39. @    
  40. @    
  41. @    
  42. @    @
  43.  @@@@
  44. ",
  45.  
  46.    d => "
  47. @@@@  
  48. @   @
  49. @    @
  50. @    @
  51. @    @
  52. @    @
  53. @    @
  54. @   @
  55. @@@@  
  56. ",
  57.  
  58.    e => "
  59. @@@@@
  60. @    
  61. @    
  62. @    
  63. @@@@
  64. @    
  65. @    
  66. @    
  67. @@@@@
  68. ",
  69.    f => "
  70. @@@@@
  71. @    
  72. @    
  73. @    
  74. @@@@
  75. @    
  76. @    
  77. @    
  78. @    
  79. ",
  80.    g => "
  81.  @@@@
  82. @    @
  83. @    
  84. @    
  85. @  @@@
  86. @    @
  87. @    @
  88. @   @@
  89.  @@@ @
  90. ",
  91.    h => "
  92. @    @
  93. @    @
  94. @    @
  95. @    @
  96. @@@@@@
  97. @    @
  98. @    @
  99. @    @
  100. @    @
  101. ",
  102.    i => "
  103. @
  104. @
  105. @
  106. @
  107. @
  108. @
  109. @
  110. @
  111. @
  112. ",
  113.    j => "
  114.   @
  115.   @
  116.   @
  117.   @
  118.   @
  119.   @
  120. @  @
  121. @  @
  122. @@
  123. ",
  124.    k => "
  125. @   @
  126. @  @  
  127. @ @  
  128. @@    
  129. @@    
  130. @ @  
  131. @  @  
  132. @   @
  133. @    @
  134. ",
  135.    l => "
  136. @    
  137. @    
  138. @    
  139. @    
  140. @    
  141. @    
  142. @    
  143. @    
  144. @@@@@
  145. ",
  146.    m => "
  147. @     @
  148. @     @
  149. @@   @@
  150. @@   @@
  151. @ @ @ @
  152. @ @ @ @
  153. @  @  @
  154. @  @  @
  155. @     @
  156. ",
  157.    n => "
  158. @    @
  159. @@   @
  160. @@   @
  161. @ @  @
  162. @ @  @
  163. @  @ @
  164. @   @@
  165. @   @@
  166. @    @
  167. ",
  168.    o => "
  169.  @@@@
  170. @    @
  171. @    @
  172. @    @
  173. @    @
  174. @    @
  175. @    @
  176. @    @
  177.  @@@@
  178. ",
  179.    p => "
  180. @@@@@
  181. @    @
  182. @    @
  183. @    @
  184. @@@@@
  185. @    
  186. @    
  187. @    
  188. @    
  189. ",
  190.    q => "
  191.  @@@@
  192. @    @
  193. @    @
  194. @    @
  195. @    @
  196. @    @
  197. @  @ @
  198. @   @@
  199.  @@@@
  200.      @
  201. ",
  202.    r => "
  203. @@@@@
  204. @    @
  205. @    @
  206. @    @
  207. @@@@@
  208. @    @
  209. @    @
  210. @    @
  211. @    @
  212. ",
  213.    s => "
  214.  @@@
  215. @   @
  216. @    
  217. @    
  218.  @@@
  219.     @
  220.     @
  221. @   @
  222.  @@@
  223. ",
  224.    t => "
  225. @@@@@
  226.   @  
  227.   @  
  228.   @  
  229.   @  
  230.   @  
  231.   @  
  232.   @  
  233.   @  
  234. ",
  235.    u => "
  236. @    @
  237. @    @
  238. @    @
  239. @    @
  240. @    @
  241. @    @
  242. @    @
  243. @    @
  244.  @@@@
  245. ",
  246.    v => "
  247. @     @
  248. @     @
  249. @   @
  250. @   @
  251. @   @
  252.  @ @  
  253.  @ @  
  254.   @  
  255.   @  
  256. ",
  257.    W => "
  258. @         @
  259. @         @
  260. @   @   @
  261. @   @   @
  262. @   @   @
  263.  @ @ @ @  
  264.  @ @ @ @  
  265.   @   @  
  266.   @   @  
  267. ",
  268.    x => "
  269. @     @
  270. @     @
  271. @   @
  272.  @ @  
  273.   @  
  274.  @ @  
  275. @   @
  276. @     @
  277. @     @
  278. ",
  279.    y => "
  280. @     @
  281. @     @
  282. @   @
  283.  @ @  
  284.   @  
  285.   @  
  286.   @  
  287.   @  
  288.   @  
  289. ",
  290.    z => "
  291. @@@@@@@
  292.      @
  293.     @
  294.    @  
  295.   @  
  296.  @    
  297. @    
  298. @      
  299. @@@@@@@
  300. "
  301.  
  302. );
  303.  
  304. head();
  305.  
  306. print "\n\n[+] Text : ";
  307. chomp( my $text = <stdin> );
  308.  
  309. print "\n\n" . artnow($text) . "\n";
  310.  
  311. copyright();
  312.  
  313. sub artnow {
  314.  
  315.    my $target = shift;
  316.  
  317.    my $fondo   = " ";
  318.    my $espacio = 0;
  319.  
  320.    my $lugar;
  321.    my @lotengo;
  322.  
  323.    my $tipox = $letras{"a"};
  324.    my @lineas = split /\n/, $tipox;
  325.    $altura = @lineas + 1;
  326.  
  327.    $anchura = max map { length $_ } @lineas;
  328.  
  329.    for ( 1 .. $altura ) {
  330.        push @lotengo, $fondo x ( ( $anchura + $espacio ) * length $target );
  331.    }
  332.  
  333.    for my $letra ( split //, $target ) {
  334.        my @lineas = split /\n/, $letras{$letra};
  335.  
  336.        for my $i ( 0 .. $altura - 1 ) {
  337.            ( my $plan = $lineas[$i] ) =~ s/ /$fondo/g;
  338.  
  339.            $plan = $fondo x $anchura if not $plan;
  340.  
  341.            substr( $lotengo[$i], $lugar, length $plan ) = $plan;
  342.        }
  343.  
  344.        $lugar += $anchura + $espacio;
  345.    }
  346.  
  347.    return ( join "\n", @lotengo );
  348.  
  349. }
  350.  
  351. sub head {
  352.  
  353.    my @logo = (
  354.        "#=============================================#", "\n",
  355.        "#            ASCII Art 0.1                    #", "\n",
  356.        "#---------------------------------------------#", "\n",
  357.        "# Written By Doddy H                          #", "\n",
  358.        "# Email: lepuke[at]hotmail[com]               #", "\n",
  359.        "# Website: doddyhackman.webcindario.com       #", "\n",
  360.        "#---------------------------------------------#", "\n",
  361.        "# Thanks to : reLlene,MARKO,explorer          #", "\n",
  362.        "# The End ?                                   #", "\n",
  363.        "#=============================================#", "\n"
  364.    );
  365.  
  366.    print "\n";
  367.    marquesina(@logo);
  368.  
  369. }
  370.  
  371. sub marquesina {
  372.  
  373.    #Effect based in the exploits by Jafer Al Zidjali
  374.  
  375.    my @logo = @_;
  376.  
  377.    my $car = "|";
  378.  
  379.    for my $uno (@logo) {
  380.        for my $dos ( split //, $uno ) {
  381.  
  382.            $|++;
  383.  
  384.            if ( $car eq "|" ) {
  385.                mostrar( "\b" . $dos . $car, "/" );
  386.            }
  387.            elsif ( $car eq "/" ) {
  388.                mostrar( "\b" . $dos . $car, "-" );
  389.            }
  390.            elsif ( $car eq "-" ) {
  391.                mostrar( "\b" . $dos . $car, "\\" );
  392.            }
  393.            else {
  394.                mostrar( "\b" . $dos . $car, "|" );
  395.            }
  396.            usleep(40_000);
  397.        }
  398.        print "\b ";
  399.    }
  400.  
  401.    sub mostrar {
  402.        print $_[0];
  403.        $car = $_[1];
  404.    }
  405.  
  406. }
  407.  
  408. sub copyright {
  409.  
  410.    print "\n\n";
  411.  
  412.    marquesina("-- == (C) Doddy Hackman 2012 == --");
  413.  
  414.    print "\n\n";
  415.  
  416.    <stdin>;
  417.    exit(1);
  418. }
  419.  
  420. #The End ?
  421.  

Ejemplo de uso

Código:

r00t ~ # art.pl



#=============================================#
#            ASCII Art 0.1                    #
#---------------------------------------------#
# Written By Doddy H                          #
# Email: lepuke[at]hotmail[com]               #
# Website: doddyhackman.webcindario.com       #
#---------------------------------------------#
# Thanks to : reLlene,MARKO,explorer          #
# The End ?                                   #
#=============================================#


[+] Text : kacked



 @   @      @       @@@@    @   @    @@@@@    @@@@
 @  @       @      @    @   @  @     @        @   @
 @ @       @ @     @        @ @      @        @    @
 @@        @ @     @        @@       @        @    @
 @@       @   @    @        @@       @@@@     @    @
 @ @      @   @    @        @ @      @        @    @
 @  @     @@@@@    @        @  @     @        @    @
 @   @   @     @   @    @   @   @    @        @   @
 @    @  @     @    @@@@    @    @   @@@@@    @@@@



-- == (C) Doddy Hackman 2012 == --



En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Libros de Perl online [PERL]
Scripting
madpitbull_99 0 3,833 Último mensaje 18 Mayo 2011, 21:49 pm
por madpitbull_99
[Python] Ascii To Hex y Hex to Ascii
Scripting
Runex 0 3,097 Último mensaje 8 Abril 2012, 15:09 pm
por Runex
[Perl Tk] ASCII Art 0.1
Scripting
BigBear 2 1,996 Último mensaje 3 Octubre 2012, 01:44 am
por BigBear
[Perl] ASCII Art 0.2
Scripting
BigBear 0 1,499 Último mensaje 5 Octubre 2012, 00:29 am
por BigBear
[Perl Tk] ASCII Art 0.2
Scripting
BigBear 0 1,694 Último mensaje 5 Octubre 2012, 00:30 am
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines