Results 1 to 8 of 8

Thread: A Very Basic tool in Perl-- Port Scanner Share/Save - My123World.Com!

  1. #1

    A Very Basic tool in Perl-- Port Scanner

    I was bit confused between Perl and Python . Started with Perl, will also learn python soon. Lets have our first tool for this section, a very basic one. Its a very simple port scanner which scans open ports on a host.

    Code:
    #!/usr/bin/perl
    # TCP Port scanner
    
    print q{
    =================================================
    SIMPLE TCP PORT SCANNER
    
    C0d3d by: t3rm!n4t0r
    
    TeAm: LOXians
    
    Greets to: Secfence Team and Garage 4 hackers
    =================================================
    };
    use IO::Socket;
    print "Target: ";
    chop ($target = <stdin>);
    print "Min Port: ";
    chop ($port = <stdin>);
    print "Max Port: ";
    chop ($maxport = <stdin>);
    my ( $daddr );
    
    {
    
    $daddr = inet_aton($target) || die("Failed to locate target host: $target");
    
    print " ================================================================\n";
    print " Scanning $target on ports $port-$maxport\n";
    print " This might take a while depending on how many ports you have\n";
    print " ================================================================\n";
    foreach (; $port<=$maxport; $port++) {
    print "\n == Scanning port $port ==";
    
    if( IO::Socket::INET->new(PeerAddr=>"$target:$port",Proto=>'tcp',Timeout=>1))
    {
    print "\n==== Port $port is open ====\n" ;
    }
    else{
    print "\nPort $port is NOT open\n";
    }
    }
    }
    
    print "\n\n\nFinished Scanning $target up to port $maxport\n\n";
    print "\n Thanks for using my port scanner\n";
    
    exit (0);
    The three great essentials to achieve anything worth while are: Hard work, Stick-to-itiveness, and Common sense. - Thomas A. Edison
    __________________________________________________ _____________________

  2. #2
    Garage Member D4rk357's Avatar
    Join Date
    Jul 2010
    Location
    localhost@mumbai
    Posts
    153
    Blog Entries
    1
    nice tool .. i would love if banner grabbing capability is added to it
    Spirit was turned 2 ashes ,soul endured so much pain..
    now the darker time evanescence ,the fallen shall rise again.

  3. #3
    thanks bro..sure, will release a good info-gathering tool, once I complete the tutorials of this language
    The three great essentials to achieve anything worth while are: Hard work, Stick-to-itiveness, and Common sense. - Thomas A. Edison
    __________________________________________________ _____________________

  4. #4
    Nice tool.
    Do only one correction,
    Print the results in tabular format..."vinnu"

  5. #5
    Security Researcher fb1h2s's Avatar
    Join Date
    Jul 2010
    Location
    India
    Posts
    616
    Blog Entries
    32
    Its really cool tht every one has started to program cool great going buddies G4H rocks
    Hacking Is a Matter of Time Knowledge and Patience

  6. #6
    Garage Addict 41.w4r10r's Avatar
    Join Date
    Jul 2010
    Location
    Pune
    Posts
    338
    Blog Entries
    3
    Nice going prashant. i will suggest instead of showing result for each port it will be good if only open ports are displayed.

    also it exits after scanning complete so its very hard to get results. storing output in file will be good option for this.
    Last edited by 41.w4r10r; 11-15-2010 at 03:27 PM. Reason: addition

  7. #7
    ... I am no Expert b0nd.g4h@gmail.com b0nd's Avatar
    Join Date
    Jul 2010
    Location
    irc.freenode.net #g4h
    Posts
    744

    Thumbs up

    Quote Originally Posted by fb1h2s View Post
    Its really cool tht every one has started to program cool great going buddies G4H rocks
    Thumbs-up!
    [*] To follow the path: look to the master, follow the master, walk with the master, see through the master,
    ------> become the master!!! <------
    [*] Everyone has a will to WIN but very few have the will to prepare to WIN
    [*] Invest yourself in everything you do, there's fun in being serious

  8. #8
    Thanks a lot brothers for encouragements.. As I will move on with programming skills, I will try to code programs with more good features and bug free . Garage brothers are my inspirations Hope the saga continues
    The three great essentials to achieve anything worth while are: Hard work, Stick-to-itiveness, and Common sense. - Thomas A. Edison
    __________________________________________________ _____________________

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •