Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Doubts about Mechanize and Net::RawIP

by annonimous (Novice)
on Mar 08, 2015 at 06:57 UTC ( [id://1119212]=perlquestion: print w/replies, xml ) Need Help??

annonimous has asked for the wisdom of the Perl Monks concerning the following question:

Hello gurus! Today i was making a script with mechanize and net rawip but when i tcpdump on my machine (a machine on my lan). As you can see i put inside a sub-routine the Mechanize module then with that im calling in the rawip the subroutine with this what im getting in tcpdump is to see only the ip that i decide to put in the script but now i am watching in the nginx log and i found funny things (and questions):
use warnings; use strict; use Net::RawIP; use WWW::Mechanize; my $source = '10.10.0.253'; my $target = '10.10.0.253'; my $url = 'http://10.10.0.253'; sub browser { my $mech = WWW::Mechanize->new(); $mech->get($url); } my $packet = Net::RawIP->new; $packet->set({ ip => { saddr => $source, daddr => $target, }, tcp => { source => 8311, dest => 80, psh => 0, syn => 1, data => browser, }, }); $packet->send;
1.- With or without subroutine ( i tried to send directly the mechanize module in the data part), the nginx is showing that im opening the webserver index.html with the original address (10.10.0.7)
2.- Is there anyway to say to mechanize that the Get that im sending cames from another part? (i tried with "proxy" but didn't got any result) thanks in advance

Replies are listed 'Best First'.
Re: Doubts about Mechanize and Net::RawIP
by Corion (Patriarch) on Mar 08, 2015 at 08:21 UTC

    No.

    There is no easy way to spoof the other end of a TCP connection. Otherwise, how would the server know where to send its answer?

      yes i know that the server will need to send the answer to the machine who will show the ip in their connection not me, but since some of my customers (elastix servers)suffered attacks in their webports by that way, then i want to replicate the program for see what is happening (and also retake perl as my programming language) by the way you are the creator of mechanize::firefox aren't you? =)

        If you want to spoof setting up a TCP connection, you will have to learn about TCP.

        If you want to send HTTP data while trying to make the server think it's coming from a different IP, consider looking at the X-Forwarded-For header. In both cases, you will have to learn and understand TCP and HTTP.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1119212]
Approved by Happy-the-monk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2024-04-18 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found