Class: Watobo::Chat

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

Overview

:nodoc: all

Constant Summary collapse

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

Constants included from Constants

Watobo::Constants::AC_GROUP_APACHE, Watobo::Constants::AC_GROUP_DOMINO, Watobo::Constants::AC_GROUP_ENUMERATION, Watobo::Constants::AC_GROUP_FILE_INCLUSION, Watobo::Constants::AC_GROUP_FLASH, Watobo::Constants::AC_GROUP_GENERIC, Watobo::Constants::AC_GROUP_JBOSS, Watobo::Constants::AC_GROUP_JOOMLA, Watobo::Constants::AC_GROUP_SAP, Watobo::Constants::AC_GROUP_SQL, Watobo::Constants::AC_GROUP_TYPO3, Watobo::Constants::AC_GROUP_XSS, Watobo::Constants::AUTH_TYPE_BASIC, Watobo::Constants::AUTH_TYPE_DIGEST, Watobo::Constants::AUTH_TYPE_NONE, Watobo::Constants::AUTH_TYPE_NTLM, Watobo::Constants::AUTH_TYPE_UNKNOWN, Watobo::Constants::CHAT_SOURCE_AUTO_SCAN, Watobo::Constants::CHAT_SOURCE_FUZZER, Watobo::Constants::CHAT_SOURCE_INTERCEPT, Watobo::Constants::CHAT_SOURCE_MANUAL, Watobo::Constants::CHAT_SOURCE_MANUAL_SCAN, Watobo::Constants::CHAT_SOURCE_PROXY, Watobo::Constants::CHAT_SOURCE_UNDEF, Watobo::Constants::DEFAULT_PORT_HTTP, Watobo::Constants::DEFAULT_PORT_HTTPS, Watobo::Constants::FINDING_TYPE_HINT, Watobo::Constants::FINDING_TYPE_INFO, Watobo::Constants::FINDING_TYPE_UNDEFINED, Watobo::Constants::FINDING_TYPE_VULN, Watobo::Constants::FIRST_TIME_FILE, Watobo::Constants::GUI_REGULAR_FONT_SIZE, Watobo::Constants::GUI_SMALL_FONT_SIZE, Watobo::Constants::ICON_PATH, Watobo::Constants::LOG_DEBUG, Watobo::Constants::LOG_INFO, Watobo::Constants::SCAN_CANCELED, Watobo::Constants::SCAN_FINISHED, Watobo::Constants::SCAN_PAUSED, Watobo::Constants::SCAN_STARTED, Watobo::Constants::TE_CHUNKED, Watobo::Constants::TE_COMPRESS, Watobo::Constants::TE_DEFLATE, Watobo::Constants::TE_GZIP, Watobo::Constants::TE_IDENTITY, Watobo::Constants::TE_NONE, Watobo::Constants::VULN_RATING_CRITICAL, Watobo::Constants::VULN_RATING_HIGH, Watobo::Constants::VULN_RATING_INFO, Watobo::Constants::VULN_RATING_LOW, Watobo::Constants::VULN_RATING_MEDIUM, Watobo::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, prefs = {}) ⇒ Chat

INITIALIZE ( request, response, prefs ) prefs:

:source - source of request/response CHAT_SOURCE
:id     - an initial id, if no id is given it will be set to the @@max_id, if id == 0 counters will be ignored.
:start  - starting time of request format is Time.now.to_f
:stop   - time of loading response has finished
:


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/watobo/core/chat.rb', line 72

def initialize(request, response, prefs = {})

  begin
    @settings = {
      :source => CHAT_SOURCE_UNDEF,
      :id => -1,
      :start => 0,
      :stop => -1,
      :comment => '',
      :tested => false
    }
    
    super(request, response)

   

    @settings.update prefs
    #  puts @settings[:id].to_s

    @@lock.synchronize{
    # enter critical section here ???
      if @settings[:id] > @@max_id
        @@max_id = @settings[:id]
      elsif @settings[:id] < 0
        @@max_id += 1
        @settings[:id] = @@max_id
      end
      @@numChats += 1
    # @comment = ''
    # leafe critical section here ???
    }

  rescue => bang
    puts bang
    puts bang.backtrace if $DEBUG
  end
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



4
5
6
# File 'lib/watobo/core/chat.rb', line 4

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/watobo/core/chat.rb', line 5

def response
  @response
end

#settingsObject (readonly)

Returns the value of attribute settings.



6
7
8
# File 'lib/watobo/core/chat.rb', line 6

def settings
  @settings
end

Instance Method Details

#commentObject



44
45
46
# File 'lib/watobo/core/chat.rb', line 44

def comment()
  @settings[:comment]
end

#comment=(c) ⇒ Object



40
41
42
# File 'lib/watobo/core/chat.rb', line 40

def comment=(c)
  @settings[:comment] = c
end

#idObject



36
37
38
# File 'lib/watobo/core/chat.rb', line 36

def id()
  @settings[:id]
end

#resetCountersObject



14
15
16
17
# File 'lib/watobo/core/chat.rb', line 14

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

#sourceObject



52
53
54
# File 'lib/watobo/core/chat.rb', line 52

def source()
  @settings[:source]
end

#tested=(truefalse) ⇒ Object



24
25
26
# File 'lib/watobo/core/chat.rb', line 24

def tested=(truefalse)
  @settings[:tested] = truefalse
end

#tested?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/watobo/core/chat.rb', line 19

def tested?()
  return false unless @settings.has_key?(:tested)
  return @settings[:tested]
end

#to_hObject



56
57
58
59
60
61
62
# File 'lib/watobo/core/chat.rb', line 56

def to_h
  h = {}
  h.update @settings
  h[:request] = @request.to_a
  h[:response] = @response.to_a
  h
end

#tstartObject



28
29
30
# File 'lib/watobo/core/chat.rb', line 28

def tstart()
  @settings[:tstart]
end

#tstopObject



32
33
34
# File 'lib/watobo/core/chat.rb', line 32

def tstop()
  @settings[:tstop]
end

#use_ssl?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/watobo/core/chat.rb', line 48

def use_ssl?
  request.proto =~ /https/
end