Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (2)

Powered by Vanilla. Made with Bootstrap.
Simple Port Scanner
  • Sh3llc0d3
    Posts: 1,910
    Nice and simple, probably one of the first perl programs I made using sockets.

    #!/usr/bin/perl
    # Perl Port Scanner
    # Semtex-Primed
    use IO::Socket;

    if(@ARGV != 3){
    print \"Semtex-Primed\n\";
    print \"Learn how to use this!!!\n\";
    print \"$0 [start port] [end port] [host]\n\";
    print \"Example: $0 1 65535 127.0.0.1\n\";
    exit 1;
    }
    if($ARGV[0] > $ARGV[1]){
    print \"The Start port is higher then End port: Sort it out!\n\";
    exit 1;
    }
    for($i = $ARGV[0]; $i <= $ARGV[1]; ++$i){
    $host = new IO::Socket::INET(
    PeerAddr => $ARGV[2],
    PeerPort => $i,
    Proto => 'tcp',
    Timeout => 1
    );
    if($host){
    print \"Port $i is OPEN\n\";
    } else {
    print \"Port $i is CLOSED\n\";
    }
    }
    exit;
  • s1n4
    Posts: 88
    Thanks nice share :)
    Simple, nice and good for learning socket in perl :)
  • Sh3llc0d3
    Posts: 1,910
    Thanks s1n4, yeah it's pretty simple but it's good for demonstrating sockets use i'll agree :)
  • undead
    Posts: 822
    Nice code. Great for understanding sockets.
  • Xin
    Posts: 3,251
    Nice clean code, you should now try make it multi threaded for faster work.
    Xin
  • Sh3llc0d3
    Posts: 1,910
    said:


    Nice clean code, you should now try make it multi threaded for faster work.



    Yeah it will be at some point ;)