Sha256: 34580aee8398a627d7997563ad3fe66c09974df2b63e3ff31dd3ad7a0d7e39a2

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

require 'gobuster/response'

module Gobuster
  module Parsers
    module Fuzz
      #
      # Parses `gobuster fuzz` output.
      #
      # @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 = /^Found:\s+\[Status=(\d{3})\]\s+\[Length=(\d+)\]\s+([^\s]++)/

        io.each_line do |line|
          if (match = line.match(line_regexp))
            yield Response.new(
              status: match[1].to_i,
              size:   match[2].to_i,
              url:    match[3],
            )
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-gobuster-0.1.0 lib/gobuster/parsers/fuzz.rb