Class: Watobo::Finding

Inherits:
Conversation show all
Defined in:
lib/watobo/core/finding.rb

Overview

:nodoc: all

Constant Summary collapse

@@numFindings =
0
@@max_id =
0
@@lock =
Mutex.new

Constants included from Constants

Constants::AC_GROUP_APACHE, Constants::AC_GROUP_DOMINO, Constants::AC_GROUP_ENUMERATION, Constants::AC_GROUP_FILE_INCLUSION, Constants::AC_GROUP_FLASH, Constants::AC_GROUP_GENERIC, Constants::AC_GROUP_JBOSS, Constants::AC_GROUP_JOOMLA, Constants::AC_GROUP_SAP, Constants::AC_GROUP_SQL, Constants::AC_GROUP_TYPO3, Constants::AC_GROUP_XSS, Constants::AUTH_TYPE_BASIC, Constants::AUTH_TYPE_DIGEST, Constants::AUTH_TYPE_NONE, Constants::AUTH_TYPE_NTLM, Constants::AUTH_TYPE_UNKNOWN, Constants::CHAT_SOURCE_AUTO_SCAN, Constants::CHAT_SOURCE_FUZZER, Constants::CHAT_SOURCE_INTERCEPT, Constants::CHAT_SOURCE_MANUAL, Constants::CHAT_SOURCE_MANUAL_SCAN, Constants::CHAT_SOURCE_PROXY, Constants::CHAT_SOURCE_UNDEF, Constants::DEFAULT_PORT_HTTP, Constants::DEFAULT_PORT_HTTPS, Constants::FINDING_TYPE_HINT, Constants::FINDING_TYPE_INFO, Constants::FINDING_TYPE_UNDEFINED, Constants::FINDING_TYPE_VULN, Constants::FIRST_TIME_FILE, Constants::GUI_REGULAR_FONT_SIZE, Constants::GUI_SMALL_FONT_SIZE, Constants::ICON_PATH, Constants::LOG_DEBUG, Constants::LOG_INFO, Constants::SCAN_CANCELED, Constants::SCAN_FINISHED, Constants::SCAN_PAUSED, Constants::SCAN_STARTED, Constants::TE_CHUNKED, Constants::TE_COMPRESS, Constants::TE_DEFLATE, Constants::TE_GZIP, Constants::TE_IDENTITY, Constants::TE_NONE, Constants::VULN_RATING_CRITICAL, Constants::VULN_RATING_HIGH, Constants::VULN_RATING_INFO, Constants::VULN_RATING_LOW, Constants::VULN_RATING_MEDIUM, Constants::VULN_RATING_UNDEFINED

Instance Attribute Summary collapse

Attributes inherited from Conversation

#file

Instance Method Summary collapse

Methods inherited from Conversation

#copyRequest

Constructor Details

#initialize(request, response, details = {}) ⇒ Finding



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/watobo/core/finding.rb', line 48

def initialize(request, response, details = {})
  super(request, response)
  @details = {
    :id => -1,
    :comment => '',
    :false_positive => false    # FalsePositive
  }

  @details.update details if details.is_a? Hash

  @@lock.synchronize{
  # enter critical section here ???
    if @details[:id] > 0 and @details[:id] > @@max_id
      @@max_id = @details[:id]
    elsif @details[:id] < 0
      @@max_id += 1
      @details[:id] = @@max_id
    end
    @@numFindings += 1

  }
#  extendRequest()
#  extendResponse()

end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



34
35
36
37
38
39
# File 'lib/watobo/core/finding.rb', line 34

def method_missing(name, *args, &block)
  if @details.has_key? name
    return @details[name]
  end
  super
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



10
11
12
# File 'lib/watobo/core/finding.rb', line 10

def details
  @details
end

#requestObject (readonly)

Returns the value of attribute request.



11
12
13
# File 'lib/watobo/core/finding.rb', line 11

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



12
13
14
# File 'lib/watobo/core/finding.rb', line 12

def response
  @response
end

Instance Method Details

#false_positive?Boolean



22
23
24
# File 'lib/watobo/core/finding.rb', line 22

def false_positive?
  @details[:false_positive]
end

#idObject



18
19
20
# File 'lib/watobo/core/finding.rb', line 18

def id()
  @details[:id]
end

#resetCountersObject



13
14
15
16
# File 'lib/watobo/core/finding.rb', line 13

def resetCounters()
  @@numFindings = 0
  @@max_id = 0
end

#set_false_positiveObject



26
27
28
# File 'lib/watobo/core/finding.rb', line 26

def set_false_positive
  @details[:false_positive] = true
end

#to_hObject



41
42
43
44
45
46
# File 'lib/watobo/core/finding.rb', line 41

def to_h
  h = { :details => @details }
  h[:request] = @request.to_a
  h[:response] = @response.to_a
  h
end

#unset_false_positiveObject



30
31
32
# File 'lib/watobo/core/finding.rb', line 30

def unset_false_positive
  @details[:false_positive] = false
end