im writing this tool called "white rabbit" and it seems to have some errors! threads don't close correctly and other errors. you might notice that i use Modules that aren't utilized because the tool is not done yet. any help would be greatly appreciated

#!/usr/bin/perl # White Rabit # knok knok, neo use NetPacket::ICMP; use IO::Socket::INET; use IO::Socket::SSL; use Socket; use Net::Ping; use LWP::Simple; use threads; use threads::shared; use Getopt::Long; my($Host,$options,$ping,$i,$port,$Status,$SSLSocketTest,$SockTest,$i1, +$i2,$i3,$i4,$i5,$i6,$i7,$i8,$i9,$i10); GetOptions("host=s" => \$Host); $Status = "\nhost looks down\n"; print "White Rabit v1\nIntence host discovery tool. START TIME ". loca +ltime() ."\n"; print "-" x 70 . "\n"; # valid ip? unless(inet_aton($Host)){ print "Invalid IP Addr! IT'S A TRAP\n"; exit(); } #lets try some Sockets for($i=0;$i<3;$i++){ if($i == 0){ $port=80; } if($i == 1){ $port=443; } if($i == 2){ $port=53; } my $SockTest = IO::Socket::INET->new( PeerAddr => $Host, PeerPort => $port, Proto => 'tcp' ) or die "" and goto Next; print "tcp Socket $Host:$port opened\n"; $Status = "$Host looks up :)\n"; Next: close($SockTest); } for($i=0;$i<3;$i++){ if($i == 0){ $port=80; } if($i == 1){ $port=443; } if($i == 2){ $port=53; } $SSLSocketTest = IO::Socket::SSL->new( "$Host:$port" ) or die +goto Next2; print "SSL Socket $Host:$port opened\n"; $Status = "$Host looks up :)\n"; Next2: close($SSLSocketTest); } # pings a plenty my $thr1 = threads->new(\&pingsub1); my $thr2 = threads->new(\&pingsub2); my $thr3 = threads->new(\&pingsub3); my $thr4 = threads->new(\&pingsub4); my $thr5 = threads->new(\&pingsub5); sleep(.5); $thr1->join; sleep(.5); $thr2->join; sleep(.5); $thr3->join; sleep(.5); $thr4->join; sleep(.5); $thr5->join; my $thr6 = threads->new(\&pingsub6); my $thr7 = threads->new(\&pingsub7); my $thr8 = threads->new(\&pingsub8); my $thr9 = threads->new(\&pingsub9); my $thr10 = threads->new(\&pingsub10); sleep(.5); $thr6->join; sleep(.5); $thr7->join; sleep(.5); $thr8->join; sleep(.5); $thr9->join; sleep(.5); $thr10->join; # rapid attacks of the rabid rabbits! sub pingsub1{ for($i1=0;$i1<20;$i1++){ $ping = Net::Ping->new("icmp"); $ping->port_number($i1); print "icmp ping reply on port $i1\n" and $Status = "$Host loo +ks up :)\n" if $ping->ping($Host); } } sub pingsub2{ for($i2=20;$i2<40;$i2++){ $ping = Net::Ping->new("icmp"); $ping->port_number($i2); print "icmp ping reply on port $i2\n" and $Status = "$Host loo +ks up :)\n" if $ping->ping($Host); } } sub pingsub3{ for($i3=40;$i3<60;$i3++){ $ping = Net::Ping->new("icmp"); $ping->port_number($i3); print "icmp ping reply on port $i3\n" and $Status = "$Host loo +ks up :)\n" if $ping->ping($Host); } } sub pingsub4{ for($i4=60;$i4<80;$i4++){ $ping = Net::Ping->new("icmp"); $ping->port_number($i4); print "icmp ping reply on port $i4\n" and $Status = "$Host loo +ks up :)\n" if $ping->ping($Host); } } sub pingsub5{ for($i5=80;$i5<101;$i5++){ $ping = Net::Ping->new("icmp"); $ping->port_number($i5); print "icmp ping reply on port $i5\n" and $Status = "$Host loo +ks up :)\n" if $ping->ping($Host); } } sub pingsub6{ for($i6=0;$i6<20;$i6++){ $ping = Net::Ping->new("tcp"); $ping->port_number($i6); print "tcp ping reply on port $i6\n" and $Status = "$Host look +s up :)\n" if $ping->ping($Host); } } sub pingsub7{ for($i7=20;$i7<40;$i7++){ $ping = Net::Ping->new("tcp"); $ping->port_number($i2); print "tcp ping reply on port $i2\n" and $Status = "$Host look +s up :)\n" if $ping->ping($Host); } } sub pingsub8{ for($i8=40;$i8<60;$i8++){ $ping = Net::Ping->new("tcp"); $ping->port_number($i8); print "tcp ping reply on port $i8\n" and $Status = "$Host look +s up :)\n" if $ping->ping($Host); } } sub pingsub9{ for($i9=60;$i9<80;$i9++){ $ping = Net::Ping->new("tcp"); $ping->port_number($i9); print "tcp ping reply on port $i9\n" and $Status = "$Host look +s up :)\n" if $ping->ping($Host); } } sub pingsub10{ for($i10=80;$i10<101;$i10++){ $ping = Net::Ping->new("tcp"); $ping->port_number($i10); print "tcp ping reply on port $i10\n" and $Status = "$Host loo +ks up :)\n" if $ping->ping($Host); } } print "\n\n" . $Status . "END TIME " . localtime(); exit();

In reply to Host discovery tool problem by perlaintdead

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.