devzspy icon

nc top 20 udp port scanner

devzspy | PRO | 02/26/19 06:42:02 AM UTC | 0 ⭐ | 7395 👁️ | Never ⏰ | []
Perl |

760 B

|

None

|

0 👍

/

0 👎

#!/usr/bin/perl
use strict;
use warnings;
 
my @topPorts = (52, 67, 68, 69, 123, 135, 137, 138, 139, 161, 162, 445, 500, 514,520,631,1434,1900,4500,49152);
my $nc = "/bin/nc";
my $outFile;
my $target;
 
if(@ARGV < 2) {
    print("Usage: $0 <target> <output file> \n");
    print("Example: perl $0 10.10.10.10 udp_scan.txt \n");
        print("cat udp_scan.txt | grep -v \"?\" \n");
    exit(1);
}
 
($target, $outFile) = @ARGV;
print("Performing Top 20 UDP Port Scan against: $target \n");
print("Output File: $outFile \n");
 
open(FILE, ">", $target) or die("$!");
close(FILE);
print("Running: ");
foreach my $port (@topPorts) {
    open(NETCAT, "-|", "$nc -nv -u -z -w 1 $target $port 2>>$outFile") or die("$!");
    close(NETCAT);
    print(".");
}
print(" DONE!\n");

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎