Metasploit mailing list archives

Reading RHOSTS from a file.


From: a10n3.s7r1k3r at gmail.com (Kashif Iftikhar)
Date: Tue, 24 Apr 2007 17:46:16 +0000

I came up with some code of the form:

               if(value =~ /^file:\/\//)
                        new_value = ''
                        
                        f = File.open(value[7, value.length])
                        f.each_line { |line|
                                new_value += line.strip + ','
                        }
                        f.close()
                        value=new_value.chop! #remove the last character.
                end

but I found out that it has already been done better in the latest update :-)

I am new to Ruby so my code looked more lousy to me.


On 4/24/07, mmiller at hick.org <mmiller at hick.org> wrote:
On Tue, Apr 24, 2007 at 02:43:17AM +0000, Kashif Iftikhar wrote:
Miller,

  Why not add more code to the normalize function of OptAddressRange
class so that it checks if the address starts with something of the
format: 'file://path/to/file' then it should open the file and try to
read address ranges from it?

 The class already contains code like:

when /\//
  sets << Rex::Socket.cidr_crack(range)

 so why not add a "when /^file:\/\// " clause there and do the
processing? If you think its a viable idea, I can get it done.

Yeah, I think this would work fine too.  Sounds like a good enough way
to go about it unless I'm missing something.  Feel free to take a stab
at it if you're interested :)




Current thread: