Metasploit mailing list archives

question - multiple IPs


From: bambam.quiescence at googlemail.com (bambam)
Date: Wed, 6 Jun 2007 10:39:00 +0100

There may be problems with msfcli that I don't know about that would
stop you using the general form below.

Bash (and other shells) are kitted out with all you need here if
you're willing to run multiple msfcli's. Note that this works
regardless of the command you're running (ls, ping, whatever):

for ip in `cat targets.txt` ; do msfcli $options $ip ; done

This will run them one at a time, but automated. To run them 'simultaneously':

for ip in `cat targets.txt` ; do (msfcli $options $ip &) ; done

You might want to redirect output of each one:

for ip in `cat targets.txt` ; do (msfcli $options $ip > $ip-pwnage.txt &) ; done

or all of them

for ip in `cat targets.txt` ; do (msfcli $options $ip &) ; done > pwnage.txt

or you might wanna generate the ips for a class C on the fly:

for classc in `seq 1 254` ; do (msfcli $options 192.168.0.$classc &); done

or a class B with two loops:

for a in `seq 1 254` ; do for b in `seq 1 254` ; do (msfcli $options
192.168.$a.$b &) ; done ; done

but you've gotta be careful not to dos your own box here (there is a
limit to your number of processes and system resources) - if you're
not confident with this kind of scripting, set ulimit first (man -a
ulimit) and you might need to use xargs (man xargs) to run only a
certain number concurrently. Just play around with the resources you
have until you know what's going to saturate your processor, your
network, your disk access, the target (the most important part - try
not to dos your customers / victims unintentionally).

Of course there are lots of other languages you can do this in
straight off the command line, perl, python, ruby, tcl, and all the
other shells other than bash.

Dunno whether that solves your problem but it might prove to be a helpful post.

bambam

On 6/5/07, kellicot at umich.edu <kellicot at umich.edu> wrote:
Is there a way to test multiple IPs for the same exploit at the same
rather than having to go one by one?

Kyle



Current thread: