#!/usr/bin/perl use IO::Socket; use Net::Ping; $ip = $ARGV[0] or die ":: usage vt.ban <ip> [start port] [end port +]\n"; $s_port = $ARGV[1] or $s_port = 1; $e_port = $ARGV[2] or $e_port = 1024; if ( !$ARGV[2] and $ARGV[1] ) { $e_port = $s_port; } @dont = (); # skip ports $do_ping = 0; $ping_timeout = 0.2; $request_timer = 1; $request_timeout = 4; $| = 1; $verbose = 1; $ports = "0_21:1_25:2_80:2_8080:3_110:4_79:"; @requests = ( "USER anonymous\nPASS l4m3r\@aol.com\nQUIT\n", "EHLO COMPUTER?\nQU +IT\n", "OPTIONS / HTTP/1.0\n\n", "CAPA\nQUIT\n", "root\r\n" ); $req = "_kill_"; $skipped = 0; $last = $s_port; print "\n::::[ scanning host $ip ( ports $s_port - $e_port ) ]\n::\n"; if ( $do_ping == 1 ) { $p = Net::Ping->new("icmp"); if ( $p->ping( $ip, $ping_timeout ) ) { $ping_succeeded = 1; } } if ( $ping_succeeded or $do_ping == 0 ) { for ( $port = $s_port ; $port <= $e_port ; $port++ ) { foreach $skip (@dont) { if ( $port == $skip ) { print "\n::\n::::. skipping $port .::\n::\n"; $skipped = 1; $last = $port; } } if ( $skipped == 0 ) { if ( $ock = IO::Socket::INET->new( PeerAddr => $ip, PeerPort => $p +ort, Proto => "tcp" ) ) { print "\n::\n::::. $ip :. $port .:\n\n"; $last = $port; $SIG{ALRM} = "send_request"; alarm($request_timer); while ( sysread( $ock, $reply, 4096 ) ) { print $reply +; } if ( $closed != 1 and $ock ) { close($ock); } $closed = 0; print "\n::::::::::.\n::\n"; } elsif ($verbose) { print "::::. $last .. $port .:. connection refused .:\ +r"; } } else { $skipped = 0; } } } else { print "::\n::::[$ip]-(host unreachable)\n"; } print "\n::\n::::[done]\a\n\n"; exit(0); sub send_request { $SIG{ALRM} = "killit"; alarm($request_timeout); if ( $ports =~ /(\d+)_$port\:/ ) { $r = $requests[$1]; } else { $r = $req; } if ( $r eq "_kill_" and $ock ) { killsocket(); } elsif ($ock) { syswrite( $ock, "$r", length("$r") ); print "::. $r +"; } } sub killsocket { if ($ock) { close($ock); } $closed = 1; }

In reply to [vt.ban] simple bannerscanner by photon

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.