From: Tom Bombadil Date: 2007-06-15T20:36:56+09:00 Subject: Re: Log file doesn't show message ------=_Part_60990_25979072.1181907407977 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Florian, What if I'd only like to get the latest entries on www.securityfocus.com/bi= d? I'd then need a check if #{ URL_MASK % id } =3D=3D 0 or so, yes? So long, Tom -- On 6/15/07, Florian A=DFmann wrote: > > Add 1 to index when you choose the filename... > > Am 15.06.2007 um 11:26 schrieb Tom Bombadil: > > > Great, thanks a lot! However, I just encountered a little bug -> > > I'd like to > > have the bid on www.securityfocus.com as file name. Thus, for > > bugtraq id 1 > > -> 1.txt, for bugtraq id 2 =3D 2.txt, etc... How can I do that? > > > > Thanks! > > > > > > > > On 6/15/07, Florian A=DFmann wrote: > >> > >> Hello Tom, > >> > >> I'm not sure what this code should do when it's finished but I > >> rewrote the src, hope this helps: > >> > >> # Initialize Logger > >> require 'logger' > >> root_logger =3D Logger.new 'root.log' > >> root_logger.level =3D Logger::INFO > >> > >> # Setup at_exit hook > >> at_exit { root_logger.info 'done.' } > >> > >> %w{ rubygems hpricot open-uri }.each { |lib| require lib } > >> URL_MASK =3D 'http://www.securityfocus.com/bid/%i'.freeze > >> > >> tgroup =3D ThreadGroup.new > >> > >> root_logger.info 'Parsing SecurityFocus...' > >> ( 1 .. 3 ).each do |id| > >> root_logger.info " open #{ URL_MASK % id }" > >> thread =3D Thread.new do > >> begin > >> Hpricot open( URL_MASK % id ) > >> rescue =3D> error > >> root_logger.error error.inspect > >> end > >> end > >> tgroup.add thread > >> end > >> > >> tgroup.list.each_with_index do |thread, index| > >> if doc =3D thread.value > >> # File.open( "#{ index }.txt", 'w+' ) do |file| > File.open( "#{ index + 1 }.txt", 'w+' ) do |file| # EASY ISN'T IT? > >> file << ( doc/'#vulnerability' ).inner_text > >> end > >> end > >> end > >> > >> Sincerely > >> Florian > > ------=_Part_60990_25979072.1181907407977--