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

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


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


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl Tk] Get IP 0.1
« en: 1 Abril 2012, 02:04 am »

Estaba muriendome de aburrimiento y me programe este pequeño programa en 5 minutos , que sirve para obtener la IP de un Host cualquiera.

Una imagen


El codigo

Código
  1. #!usr/bin/perl
  2. #Get IP 0.1
  3. #Version Tk
  4. #Coded By Doddy H
  5.  
  6. use Tk;
  7. use IO::Socket;
  8.  
  9. my $color_fondo = "black";
  10. my $color_texto = "yellow";
  11.  
  12. #if ( $^O eq 'MSWin32' ) {
  13. #    use Win32::Console;
  14. #   Win32::Console::Free();
  15. #}
  16.  
  17. my $ua =
  18.  MainWindow->new( -background => $color_fondo, -foreground => $color_texto );
  19. $ua->title("Get IP || Coded By Doddy H");
  20. $ua->geometry("350x110+20+20");
  21. $ua->resizable( 0, 0 );
  22.  
  23. $ua->Label(
  24.    -text       => "Host : ",
  25.    -font       => "Impact",
  26.    -background => $color_fondo,
  27.    -foreground => $color_texto
  28. )->place( -y => 20, -x => 20 );
  29. my $host = $ua->Entry(
  30.    -width      => 30,
  31.    -background => $color_fondo,
  32.    -foreground => $color_texto
  33. )->place( -y => 25, -x => 70 );
  34. $ua->Button(
  35.    -text             => "Get IP",
  36.    -width            => 10,
  37.    -command          => \&quien,
  38.    -background       => $color_fondo,
  39.    -foreground       => $color_texto,
  40.    -activebackground => $color_texto
  41. )->place( -y => 23, -x => 260 );
  42.  
  43. $ua->Label(
  44.    -text       => "IP : ",
  45.    -font       => "Impact",
  46.    -background => $color_fondo,
  47.    -foreground => $color_texto
  48. )->place( -y => 60, -x => 20 );
  49. my $ip = $ua->Entry(
  50.    -width      => 33,
  51.    -background => $color_fondo,
  52.    -foreground => $color_texto
  53. )->place( -y => 65, -x => 52 );
  54.  
  55. MainLoop;
  56.  
  57. sub quien {
  58.    $ip->configure( -text => get_ip( $host->get ) );
  59. }
  60.  
  61. sub get_ip {
  62.    my $get = gethostbyname( $_[0] );
  63.    return inet_ntoa($get);
  64. }
  65.  
  66. #The End ?
  67.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
perl
Scripting
nobo 0 3,205 Último mensaje 22 Febrero 2005, 07:49 am
por nobo
Perl
Scripting
zhynar_X 2 2,235 Último mensaje 12 Enero 2008, 04:36 am
por GroK
-=PERL=-
Scripting
D4RIO 1 5,725 Último mensaje 25 Febrero 2008, 17:27 pm
por D4RIO
MSN Perl y PHP
Scripting
isseu 0 2,681 Último mensaje 30 Diciembre 2008, 14:36 pm
por isseu
Libros de Perl online [PERL]
Scripting
madpitbull_99 0 3,843 Último mensaje 18 Mayo 2011, 21:49 pm
por madpitbull_99
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines