Sha256: 149482a6fb3649f3980e31a538e596577b9698619fc90dbc292a4f25ec62bead
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'feroxbuster/response' module Feroxbuster module Parsers # # Parses single-line response data. # # @api semipublic # module TXT # # Parses each line of plain-text. # # @param [IO] io # The IO stream to parse. # # @yield [response] # The given block will be passed each parsed response. # # @yieldparam [Response] response # The parsed response. # # @return [Enumerator] # If no block is given, an Enumerator will be returned. # def self.parse(io) return enum_for(__method__,io) unless block_given? line_regexp = /^(\d{3})\s+(\w+)\s+(\d+)l\s+(\d+)w\s+(\d+)c\s+([^\s]+)/ io.each_line do |line| line.chomp! if (match = line.match(line_regexp)) yield Response.new( status: match[1].to_i, method: match[2], line_count: match[3].to_i, word_count: match[4].to_i, content_length: match[5].to_i, url: match[6] ) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-feroxbuster-0.1.0 | lib/feroxbuster/parsers/txt.rb |