using a list



Trying to create a way to create a list of ip's port

-ip = 192.168.100.1 #first ip
-nip = 254 #number of ips
@allports = ("25", "110", "443", "179") #listening ports
-fip = 10.100.100.1 # static ip everything get forwarded to
-fport = 10001 # starting port that @allports will forward to running
on fip


What I need to do is have it output a list of ips, in this case I'm
starting with 192.168.100.1 and ending with 192.168.100.254. And for
each of those ip's I need to associate it with each of the ports in my
@allports list and out put that to a file. so I will look something
like:

192.168.100.1 25 maps to 10.100.100.1 20001
192.168.100.1 110 maps to 10.100.100.1 20002
192.168.100.1 443 maps to 10.100.100.1 20003
192.168.100.1 179 maps to 10.100.100.1 20004
192.168.100.2 25 maps to 10.100.100.1 20005
192.168.100.2 110 maps to 10.100.100.1 20006
192.168.100.2 443 maps to 10.100.100.1 20007
192.168.100.2 179 maps to 10.100.100.1 20008
192.168.100.3 25 maps to 10.100.100.1 20009
.....
.....
192.168.100.254 179 maps to 10.100.100.1 21016

This is what I have so far;


$ip = 192.168.100.1; #first ip
$nip = 254; #number of ips
@allports = ("25", "110", "443", "179"); #listening ports
$fip = 10.100.100.1; # static ip everything get forwarded to
$fport = 10001; # starting port that @allports will forward to running
on fip
$file = somefile.txt;

for ( 1..$n ) {
$ip =~ s/\.(\d+)$/.$_/;
$fport = $fport++;

open (FD, ">>", $file);
printf (FD "$ip maps to $fip $fport\n");
close (FD);
}


I can't figure out how to implement the @allports part. As I'm a total
noob this is probably not the most efficient way but as long as it
work thats fine for me.

.



Relevant Pages

  • Re: using a list
    ... I can't figure out how to implement the @allports part. ... foreach my $port { ... print FD "$ip.$port maps to $fip $fport\n"; ...
    (comp.lang.perl.misc)
  • RE: ICMP (Ping)
    ... Why do you assume that out of millions of Ips that respond, ... > almost) running a port scan those that reply. ... replies from a ping request. ... IP ranges with no target in mind, ...
    (Security-Basics)
  • RE: IPS and Trunking
    ... Cisco does offer an "IPS on a stick" feature and is what the OP is ... You create another vlan on the switch. ... You convert one of the ports to a trunk port and plug the IPS ...
    (Focus-IDS)
  • Re: Port Scanning
    ... Most IPS admins do not block port scans. ... > essentially adding rules that the attacker has ... > customer works primarily with a particular remote ...
    (Pen-Test)
  • Re: Port watching tool
    ... Active Ports only shows one connection to port 25 (which I am trying to ... I am finding certain IPs to be ... generating large numbers of SMTP connections to the server, ... Symantec is the Diamond sponsor. ...
    (Security-Basics)