Class: Gobuster::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/gobuster/response.rb

Overview

Represents a HTTP resposne found by gobuster dir or gobuster fuzz.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path: nil, url: nil, status:, size:) ⇒ Response

Initializes the HTTP response.

Parameters:

  • path (String, nil) (defaults to: nil)
  • url (String, nil) (defaults to: nil)
  • status (Integer)
  • size (Integer)

Raises:

  • (ArgumentError)

    The path: or url: keyword argument is required.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/gobuster/response.rb', line 41

def initialize(path: nil, url: nil, status: , size: )
  if url
    @url  = url
    @path = nil
  elsif path
    @url  = nil
    @path = path
  else
    raise(ArgumentError,"path: or url: keyword argument must be given")
  end

  @status = status
  @size   = size
end

Instance Attribute Details

#pathString? (readonly)

The path of the response.

Returns:

  • (String, nil)


10
11
12
# File 'lib/gobuster/response.rb', line 10

def path
  @path
end

#sizeInteger (readonly)

The size of the response.

Returns:

  • (Integer)


25
26
27
# File 'lib/gobuster/response.rb', line 25

def size
  @size
end

#statusInteger (readonly)

The HTTP status code.

Returns:

  • (Integer)


20
21
22
# File 'lib/gobuster/response.rb', line 20

def status
  @status
end

#urlString? (readonly)

The URL of the response.

Returns:

  • (String, nil)


15
16
17
# File 'lib/gobuster/response.rb', line 15

def url
  @url
end

Instance Method Details

#to_sString Also known as: to_str

Converts the response to a String.

Returns:

  • (String)


61
62
63
# File 'lib/gobuster/response.rb', line 61

def to_s
  @path || @url
end