Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: BigBear en 28 Marzo 2012, 22:57 pm



Título: [Perl Tk] Lix.In Decoder 0.2
Publicado por: BigBear en 28 Marzo 2012, 22:57 pm
Hola a todos.

Aca les traigo la version Tk de un script que habia hecho para decodificar las url lix.in

Lo bueno del programa es que guarda todo los logs en la carpeta donde ejecutaron el programa

Una imagen del programa seria

(http://doddyhackman.webcindario.com/images/lix.jpg)

Código
  1. #!usr/bin/perl
  2. #Lix.In Decoder 0.2
  3. #Version Tk
  4. #Coded By Doddy H
  5.  
  6. use LWP::UserAgent;
  7. use URI::Split qw(uri_split);
  8. use Tk;
  9. use Tk::Dialog;
  10.  
  11. #if ( $^O eq 'MSWin32' ) {
  12. #    use Win32::Console;
  13. #    Win32::Console::Free();
  14. #}
  15.  
  16. my $nave = LWP::UserAgent->new;
  17. $nave->agent(
  18. "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
  19. );
  20. $nave->timeout(5);
  21.  
  22. my $color_fondo = "black";
  23. my $color_text  = "green";
  24.  
  25. my $ben =
  26.  MainWindow->new( -background => $color_fondo, -foreground => $color_text );
  27.  
  28. $ben->title("Lix.In Decoder 0.2 (C) Doddy Hackman 2012");
  29. $ben->geometry("492x385+20+20");
  30. $ben->resizable( 0, 0 );
  31.  
  32. $ben->Label(
  33.    -background => $color_fondo,
  34.    -foreground => $color_text,
  35.    -text       => "Page : ",
  36.    -font       => "Impact1"
  37. )->place( -x => 20, -y => 20 );
  38. my $page = $ben->Entry(
  39.    -background => $color_fondo,
  40.    -foreground => $color_text,
  41.    -width      => 40
  42. )->place( -x => 73, -y => 24 );
  43.  
  44. $ben->Button(
  45.    -text             => "Decode",
  46.    -width            => 10,
  47.    -command          => \&home,
  48.    -background       => $color_fondo,
  49.    -foreground       => $color_text,
  50.    -activebackground => $color_text
  51. )->place( -x => 325, -y => 23 );
  52. $ben->Button(
  53.    -text             => "Logs",
  54.    -width            => 10,
  55.    -command          => \&logs,
  56.    -background       => $color_fondo,
  57.    -foreground       => $color_text,
  58.    -activebackground => $color_text
  59. )->place( -x => 400, -y => 23 );
  60.  
  61. $ben->Label(
  62.    -text       => "Links Found",
  63.    -font       => "Impact",
  64.    -background => $color_fondo,
  65.    -foreground => $color_text
  66. )->place( -x => 200, -y => 80 );
  67. my $links = $ben->Listbox(
  68.    -width      => 70,
  69.    -height     => 15,
  70.    -background => $color_fondo,
  71.    -foreground => $color_text
  72. )->place( -x => 32, -y => 140 );
  73.  
  74. MainLoop;
  75.  
  76. sub home {
  77.  
  78.    $links->delete( "0.0", "end" );
  79.  
  80.    my $url = $page->get;
  81.  
  82.    my $code = toma($url);
  83.  
  84.    while ( $code =~ m{http://lix\.in/(-\w+)}ig ) {
  85.        push( @urls, "http://lix.in/" . $1 );
  86.    }
  87.  
  88.    while ( $code =~ m{http://lix\.in/(\w+)}ig ) {
  89.        push( @urls, "http://lix.in/-" . $1 );
  90.    }
  91.  
  92.    my @urls = repes(@urls);
  93.  
  94.    for my $l (@urls) {
  95.        chomp $l;
  96.        $ben->update;
  97.        decode_link( $l, $url );
  98.    }
  99. }
  100.  
  101. sub decode_link {
  102.  
  103.    my ( $link, $url ) = @_;
  104.  
  105.    my ( $scheme, $auth, $path, $query, $frag ) = uri_split($url);
  106.  
  107.    if ( $link =~ /-(.*)/ ) {
  108.        my $co = "-" . $1;
  109.        chomp $co;
  110.        my $code =
  111.          tomar( $link,
  112.            { "tiny" => $co, "submit" => "continue", "submit" => "submit" } );
  113.        if ( $code =~ /<iframe  name="ifram" src="(.*)" marginwidth="0"/ ) {
  114.            my $link = $1;
  115.            chomp $link;
  116.            unless ( $link =~ /lix\.in/ ) {
  117.                savefile( $auth . ".txt", $link );
  118.                $links->insert( "end", $link );
  119.            }
  120.        }
  121.    }
  122. }
  123.  
  124. sub logs {
  125.  
  126.    my ( $scheme, $auth, $path, $query, $frag ) = uri_split( $page->get );
  127.    my $f = $auth . ".txt";
  128.  
  129.    if ( -f $f ) {
  130.        system($f);
  131.    }
  132.    else {
  133.        $ben->Dialog(
  134.            -title            => "Error",
  135.            -buttons          => ["OK"],
  136.            -text             => "Logs not found",
  137.            -background       => $color_fondo,
  138.            -foreground       => $color_text,
  139.            -activebackground => $color_text
  140.        )->Show();
  141.    }
  142. }
  143.  
  144. sub repes {
  145.    my @limpio;
  146.    foreach $test (@_) {
  147.        push @limpio, $test unless $repe{$test}++;
  148.    }
  149.    return @limpio;
  150. }
  151.  
  152. sub savefile {
  153.    open( SAVE, ">>" . $_[0] );
  154.    print SAVE $_[1] . "\n";
  155.    close SAVE;
  156. }
  157.  
  158. sub toma {
  159.    return $nave->get( $_[0] )->content;
  160. }
  161.  
  162. sub tomar {
  163.    my ( $web, $var ) = @_;
  164.    return $nave->post( $web, [ %{$var} ] )->content;
  165. }
  166.  
  167. # The End ?
  168.  
  169.