All users are connected to one port switch this port is mirror where i have connected single machine with freebsd operating system.I am using Sniffer::HTTP module to catch the url.i want to block xyz.com for all users . i dont know how i can do it please find the following codes for your reference

#!/usr/bin/perl use strict; use Net::Pcap; use Sniffer::HTTP; use Net::RawIP; my $VERBOSE = 0; my $sniffer = Sniffer::HTTP->new( callbacks => { request => sub { my ($req,$conn) = @_; my $src = $conn->tcp_connection->src_host; my $sport = $conn->tcp_connection->src_port; my $dst = $conn->tcp_connection->dest_host; my $dport = $conn->tcp_connection->dest_port; my $myurl = $req->uri; if ( $myurl =~ "http://xyz.com" ) { system("/usr/bin/perl /myscripts/socket3.pl $dst $dport $src $sport"); } print "Request: $src:$sport -> $dst:$dport -> $myurl \n"; } }, ); $sniffer->run('alc0'); # uses the "best" default device

code of /usr/bin/perl /myscripts/socket3.pl

use Net::RawIP; $src_host = $ARGV[0]; # The source IP/Hostname $src_port = $ARGV[1]; # The Source Port $dst_host = $ARGV[2]; # The Destination IP/Hostname $dst_port = $ARGV[3]; # The Destination Port. $n = Net::RawIP->new({ ip => { saddr => "$src_host" , daddr => "$dst_host", }, tcp => { source => "$src_port", dest => "$dst_port", rst => 1, }, }); $n->send; $n->ethnew("alc0"); $n->ethset(source => "$src_host", dest => "dst_host" ); $n->ethsend;

In reply to Re^2: Proxy in perl by santosh_wagh
in thread Proxy in perl by santosh_wagh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.