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

 

 


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  Se puede hacer esto? Perl
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Se puede hacer esto? Perl  (Leído 1,815 veces)
aninhill

Desconectado Desconectado

Mensajes: 22


Ver Perfil
Se puede hacer esto? Perl
« en: 13 Diciembre 2008, 19:58 pm »

Hola,
Queria saber si se puede hacer una cosa parecida a un proxy, nada mas que funcione de forma local y agrege algunos headers para hacer los request como otro ip.
En este caso el header que supongo serviria es el X-Forwarded-For. En fin, se puede hacer dicho script?

Aqui hay una idea nomas, pero no funciona, creo.

Código:
#!/usr/bin/perl -w
use HTTP::Proxy qw( :log );
use HTTP::Proxy::HeaderFilter::simple;
use strict;

# a simple IpSpoofing filter
my $filter = HTTP::Proxy::HeaderFilter::simple->new(
#?
sub { $_[0]->header( 'X-Forwarded-For' => '192.168.102.32' );}
);

# a simple ip generator
#$ip1= int(rand(30))+190;
#$ip2= int(rand(240));
#$ip3= int(rand(240));
#$ip4= int(rand(240));
#$ip = $ip1.".".$ip2.".".$ip3.".".$ip4;
   
# initialisation
my $proxy = HTTP::Proxy->new( port => 3128 );
$proxy->port( 3128 );
# this is a MainLoop-like method
$proxy->x_forwarded_for();
$proxy->push_filter(
    mime    => undef,
    request => HTTP::Proxy::HeaderFilter::simple->new(
        sub { $_[1]->remove_header(qw( User-Agent From Referer Cookie Cookie2 )) }
    ),
    response => HTTP::Proxy::HeaderFilter::simple->new(
        sub { $_[1]->remove_header(qw( Set-Cookie Set-Cookie2 )) }
    )
);
$proxy->via('');
$proxy->start;
$proxy->init();
print "Proxy started on port 3128 \n\n\n";
$proxy->push_filter(request => $filter);
print "Filtering??? \n\n\n";


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines