Class: Watobo::Gui::LogViewer_UNUSED
- Inherits:
-
FXVerticalFrame
- Object
- FXVerticalFrame
- Watobo::Gui::LogViewer_UNUSED
show all
- Includes:
- Constants
- Defined in:
- lib/watobo/gui/log_viewer.rb
Constant Summary
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::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 Method Summary
collapse
Constructor Details
#initialize(parent, mode = :insert, opts) ⇒ LogViewer_UNUSED
Returns a new instance of LogViewer_UNUSED.
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# File 'lib/watobo/gui/log_viewer.rb', line 159
def initialize(parent, mode = :insert, opts)
opts[:padding] = 0
super(parent, opts)
@mode = mode
@log_message = nil
@lock = Mutex.new
@timer = nil
@textbox = FXText.new(self, nil, 0, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
@textbox.editable = false
start_update_timer
end
|
Instance Method Details
#destroy ⇒ Object
153
154
155
156
157
|
# File 'lib/watobo/gui/log_viewer.rb', line 153
def destroy
getApp().removeTimeout(@timer) unless @timer.nil?
super
1
end
|
#log(sender = nil, log_level, msg) ⇒ Object
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/watobo/gui/log_viewer.rb', line 107
def log(sender=nil, log_level, msg )
puts "#{sender.class} => #{msg}" if $DEBUG
begin
t = Time.now
now = t.strftime("%m/%d/%Y @ %H:%M:%S")
begin
log_text = case log_level
when LOG_INFO
"#{now}: #{msg}\n"
else
""
end
rescue => bang
puts bang
puts bang.backtrace if $DEBUG
end
@lock.synchronize do
log_text << @log_message unless @log_message.nil?
@log_message = log_text
end
rescue => bang
puts bang
puts bang.backtrace
end
end
|
#purge ⇒ Object
101
102
103
104
105
|
# File 'lib/watobo/gui/log_viewer.rb', line 101
def purge
@lock.synchronize do
@textbox.text = ''
end
end
|
#start_update_timer ⇒ Object
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
# File 'lib/watobo/gui/log_viewer.rb', line 135
def start_update_timer
@timer = FXApp.instance.addTimeout( 50, :repeat => true) {
@lock.synchronize do
unless @log_message.nil?
unless @log_message.empty?
case @mode
when :insert
@textbox.insertText(0,@log_message)
when :append
@textbox.appendText(@log_message)
end
end
@log_message = nil
end
end
}
end
|