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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# File 'lib/watobo/gui/interceptor_settings_dialog.rb', line 70
def initialize(owner, opts)
super(owner, opts)
scroller = FXScrollWindow.new(self, :opts => SCROLLERS_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y)
scroll_area = FXVerticalFrame.new(scroller, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
gbox = FXGroupBox.new(scroll_area, "Transparent Mode", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
gbox_frame = FXVerticalFrame.new(gbox, :opts => LAYOUT_SIDE_TOP)
@transparent_mode_chk = FXCheckButton.new(gbox_frame, "enable", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_LEFT)
@transparent_mode_chk.setCheck false
if RUBY_PLATFORM =~ /linux|bsd|solaris|hpux|darwin/i
@transparent_mode_chk.setCheck true if Watobo::Conf::Interceptor.proxy_mode == Watobo::Interceptor::MODE_TRANSPARENT
else
@transparent_mode_chk.disable
note = FXLabel.new(gbox_frame, "Transparent Mode Only Available On Linux Platform!")
note.textColor = FXColor::Red
end
gbox = FXGroupBox.new(scroll_area, "Listener", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
frame = FXMatrix.new(gbox, 2, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y)
FXLabel.new(frame, "Bind Address:")
@bind_addr_dt = FXDataTarget.new(0)
@bind_addr_dt.value = Watobo::Conf::Interceptor.bind_addr
bind_addr_txt = FXTextField.new(frame, 15, @bind_addr_dt, FXDataTarget::ID_VALUE, :opts => JUSTIFY_RIGHT|FRAME_GROOVE|FRAME_SUNKEN)
bind_addr_txt .handle(self, FXSEL(SEL_UPDATE, 0), nil)
FXLabel.new(frame, "Port:")
@port_dt = FXDataTarget.new(0)
@port_dt.value = Watobo::Conf::Interceptor.port
lport = FXTextField.new(frame, 5, @port_dt, FXDataTarget::ID_VALUE, :opts => JUSTIFY_RIGHT|FRAME_GROOVE|FRAME_SUNKEN)
lport.handle(self, FXSEL(SEL_UPDATE, 0), nil)
gbframe = FXGroupBox.new(scroll_area, "Pass-Through Content-Length", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
frame = FXVerticalFrame.new(gbframe, :opts => LAYOUT_FILL_X, :padding => 0)
fxtext = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP)
fxtext.backColor = fxtext.parent.backColor
fxtext.disable
text = "Define Content-Length threshold for Pass-Through. Responses which Content-Length exceed this size will be forwarded."
fxtext.setText(text)
input_frame = FXHorizontalFrame.new(frame, :opts => LAYOUT_FILL_X)
FXLabel.new(input_frame, "Max. Content-Length:")
@content_length_dt = FXDataTarget.new('')
@content_length_dt.value = Watobo::Conf::Interceptor.pass_through[:content_length]
content_length_field = FXTextField.new(input_frame, 7, :target => @content_length_dt, :selector => FXDataTarget::ID_VALUE, :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_LEFT)
content_length_field.handle(self, FXSEL(SEL_UPDATE, 0), nil)
gbframe = FXGroupBox.new(scroll_area, "Pass-Through Content-Types", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
frame = FXVerticalFrame.new(gbframe, :opts => LAYOUT_FILL_X, :padding => 0)
fxtext = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP)
fxtext.backColor = fxtext.parent.backColor
fxtext.disable
text = "Define Content-Types for Pass-Through. Responses which are forwarded will not be inspected by Passive-Checks. So you only should define Content-Types which in general contain binary data."
fxtext.setText(text)
input_frame = FXHorizontalFrame.new(frame, :opts => LAYOUT_FILL_X)
@ct_dt = FXDataTarget.new('')
@ct_field = FXTextField.new(input_frame, 20, :target => @ct_dt, :selector => FXDataTarget::ID_VALUE, :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_LEFT|LAYOUT_FILL_X)
@rem_ct_btn = FXButton.new(input_frame, "Remove" , :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
@add_ct_btn = FXButton.new(input_frame, "Add" , :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
list_frame = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|FRAME_SUNKEN, :padding => 0)
@ct_list = FXList.new(list_frame, :opts => LIST_EXTENDEDSELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
@ct_list.numVisible = 5
@ct_list.connect(SEL_COMMAND){ |sender, sel, item|
@ct_dt.value = sender.getItemText(item)
@ct_field.handle(self, FXSEL(SEL_UPDATE, 0), nil)
}
Watobo::Conf::Interceptor.pass_through[:content_types].each do |nup|
addItem(@ct_list, nup)
end
@rem_ct_btn.connect(SEL_COMMAND){ |sender, sel, item|
removePattern(@ct_list) if @ct_dt.value != ''
@ct_dt.value = ''
@ct_field.handle(self, FXSEL(SEL_UPDATE, 0), nil)
}
@add_ct_btn.connect(SEL_COMMAND){ |sender, sel, item|
addItem(@ct_list, @ct_dt.value) if @ct_dt.value != ''
@ct_dt.value = ''
@ct_field.handle(self, FXSEL(SEL_UPDATE, 0), nil)
}
@ct_dt.connect(SEL_COMMAND){ |sender, sel, item|
addItem(@ct_list, @ct_dt.value) if @ct_dt.value != ''
@ct_dt.value = ''
@ct_field.handle(self, FXSEL(SEL_UPDATE, 0), nil)
}
end
|