Class: Watobo::Gui::InterceptEditor
- Inherits:
-
FXVerticalFrame
- Object
- FXVerticalFrame
- Watobo::Gui::InterceptEditor
show all
- Includes:
- Constants, Utils, Interceptor
- Defined in:
- lib/watobo/gui/interceptor_gui.rb
Constant Summary
Constants included
from Interceptor
Interceptor::INTERCEPT_BOTH, Interceptor::INTERCEPT_DEFAULT_PORT, Interceptor::INTERCEPT_NONE, Interceptor::INTERCEPT_REQUEST, Interceptor::INTERCEPT_RESPONSE, Interceptor::MODE_REGULAR, Interceptor::MODE_TRANSPARENT, Interceptor::REWRITE_BOTH, Interceptor::REWRITE_NONE, Interceptor::REWRITE_REQUEST, Interceptor::REWRITE_RESPONSE
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 Method Summary
collapse
Methods included from Utils
#addDecoder, #addEncoder, #addStringInfo, #cleanupHTTP, load_plugins, #removeTags, #replace_text
active?, intercept_mode, intercept_mode=, intercept_requests?, intercept_responses?, proxy, proxy_mode, proxy_mode=, rewrite_mode, rewrite_mode=, rewrite_requests?, rewrite_responses?, start, stop, transparent?
Constructor Details
Returns a new instance of InterceptEditor.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
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
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
134
135
136
137
138
|
# File 'lib/watobo/gui/interceptor_gui.rb', line 10
def initialize(owner, opts)
super(owner, opts)
@lock = Mutex.new
@text = nil
@event_dispatcher_listeners = Hash.new
= FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM|LAYOUT_FIX_HEIGHT, :height => 24, :padding => 0)
@pmatch_btn = FXButton.new(, "<", nil, nil, 0, FRAME_RAISED|LAYOUT_FILL_Y)
@pmatch_btn.disable
@pmatch_btn.connect(SEL_COMMAND) {
if @textbox.numMatches > 0
@match_pos_label.textColor = 'black'
pos = @textbox.showPrevMatch() + 1
@match_pos_label.text = "#{pos}/#{@textbox.numMatches}"
else
@match_pos_label.textColor = 'grey'
end
}
@match_pos_label = FXLabel.new(, "0/0", :opts => LAYOUT_FILL_Y)
@match_pos_label.textColor = 'grey'
@nmatch_btn = FXButton.new(, ">", nil, nil, 0, FRAME_RAISED|LAYOUT_FILL_Y)
@nmatch_btn.disable
@nmatch_btn.connect(SEL_COMMAND) {
@textbox.showNextMatch()
if @textbox.numMatches > 0
@match_pos_label.textColor = 'black'
pos = @textbox.showNextMatch() + 1
@match_pos_label.text = "#{pos}/#{@textbox.numMatches}"
else
@match_pos_label.textColor = 'grey'
end
}
@filter_dt = FXDataTarget.new('')
@filter_text = FXComboBox.new(, 20, @filter_dt, 0, FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
@filter_text.connect(SEL_COMMAND) {
applyFilter()
addFilterHistory()
}
@filter_text.connect(SEL_CHANGED) {
applyFilter()
}
inputFieldHotkeyHandler(@filter_text)
@auto_select_cbtn = FXCheckButton.new(, "auto-select", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_RIGHT|LAYOUT_FILL_Y)
reset_button = FXButton.new(, "&Reset", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_Y)
reset_button.connect(SEL_COMMAND) { resetTextbox() }
text_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
@textbox_dt = FXDataTarget.new('')
@textbox = Watobo::Gui::TextView2.new(text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
@textbox.textStyle -= TEXT_WORDWRAP
@textbox.extend Watobo::Mixins::RequestParser
@textbox.editable = true
@markers = []
@record_input = false
@last_cursor_pos = 0
@start_selection_pos = 0
@input_start = 0
@input_len = 0
@textbox.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, event|
unless event.moved?
FXMenuPane.new(self) do ||
addStringInfo(, sender)
addDecoder(, sender)
addEncoder(, sender)
FXMenuSeparator.new()
target = FXMenuCheck.new(, "word wrap")
target.check = (@textbox.textStyle & TEXT_WORDWRAP > 0) ? true : false
target.connect(SEL_COMMAND) { |tsender, tsel, titem|
if tsender.checked?
@textbox.textStyle |= TEXT_WORDWRAP
else
@textbox.textStyle ^= TEXT_WORDWRAP
end
}
.create
.(nil, event.root_x, event.root_y)
app.runModalWhileShown()
end
end
end
@ctrl_pressed = false
@textbox.connect(SEL_KEYPRESS, method(:initEditKeys))
@textbox.connect(SEL_KEYRELEASE) do |sender, sel, event|
@ctrl_pressed = false if event.code == KEY_Control_L or event.code == KEY_Control_R
false
end
end
|
Instance Method Details
#clear ⇒ Object
152
153
154
|
# File 'lib/watobo/gui/interceptor_gui.rb', line 152
def clear
@textbox.setText('')
end
|
#clearEvents(event) ⇒ Object
144
145
146
|
# File 'lib/watobo/gui/interceptor_gui.rb', line 144
def clearEvents(event)
@event_dispatcher_listener[event].clear
end
|
#empty? ⇒ Boolean
148
149
150
|
# File 'lib/watobo/gui/interceptor_gui.rb', line 148
def empty?
@textbox.to_s.empty?
end
|
#parseRequest(prefs = {}) ⇒ Object
176
177
178
179
180
181
182
183
184
185
186
187
188
|
# File 'lib/watobo/gui/interceptor_gui.rb', line 176
def parseRequest(prefs={})
begin
return @textbox.to_request(prefs)
rescue SyntaxError, LocalJumpError, NameError
notify(:error, "#{$!}")
rescue => bang
puts bang
puts bang.backtrace if $DEBUG
notify(:error, "Could not parse request: #{$!}")
end
return nil
end
|
#setText(text = nil) ⇒ Object
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# File 'lib/watobo/gui/interceptor_gui.rb', line 156
def setText(text=nil)
return false if text.nil?
if text.is_a? Array
new_text = text.join
else
new_text = "#{text}"
end
@lock.synchronize do
@text = new_text.strip.gsub(/\r/, '')
unless @text.empty?
@textbox.setText @text
end
end
end
|
#subscribe(event, &callback) ⇒ Object
140
141
142
|
# File 'lib/watobo/gui/interceptor_gui.rb', line 140
def subscribe(event, &callback)
(@event_dispatcher_listeners[event] ||= []) << callback
end
|
#to_response(prefs = {}) ⇒ Object
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
# File 'lib/watobo/gui/interceptor_gui.rb', line 190
def to_response(prefs={})
begin
return @textbox.to_response(prefs)
rescue SyntaxError, LocalJumpError, NameError
notify(:error, "#{$!}")
rescue => bang
puts bang
notify(:error, "Could not parse request: #{$!}")
end
return nil
end
|