Class: Watobo::Gui::TranscoderWindow
- Inherits:
-
FXDialogBox
- Object
- FXDialogBox
- Watobo::Gui::TranscoderWindow
- Defined in:
- lib/watobo/gui/transcoder_window.rb
Constant Summary
Constants included from Icons
Icons::ICON_ADD_PROJECT, Icons::ICON_BROWSER_MEDIUM, Icons::ICON_BROWSER_SMALL, Icons::ICON_BTN_DOWN, Icons::ICON_BTN_UP, Icons::ICON_CB_CHECKED, Icons::ICON_CB_CHECKED_ORANGE, Icons::ICON_CB_UNCHECKED, Icons::ICON_CONVERSATION, Icons::ICON_DASHBOARD, Icons::ICON_DIFFER, Icons::ICON_FOLDER, Icons::ICON_FOLDER_SMALL, Icons::ICON_FUZZER, Icons::ICON_FUZZER_MEDIUM, Icons::ICON_FUZZER_SMALL, Icons::ICON_FUZZ_FILTER, Icons::ICON_FUZZ_GENERATOR, Icons::ICON_FUZZ_TAG, Icons::ICON_HINTS, Icons::ICON_HINTS_INFO, Icons::ICON_HINTS_INFO_SMALL, Icons::ICON_HINTS_SMALL, Icons::ICON_INFO, Icons::ICON_INFO_INFO, Icons::ICON_INFO_INFO_SMALL, Icons::ICON_INFO_SMALL, Icons::ICON_INFO_USER, Icons::ICON_INFO_USER_SMALL, Icons::ICON_INTERCEPTOR, Icons::ICON_LOGIN_WIZZARD, Icons::ICON_MANUAL_REQUEST, Icons::ICON_MANUAL_REQUEST_MEDIUM, Icons::ICON_MANUAL_REQUEST_SMALL, Icons::ICON_PAUSE, Icons::ICON_PLUGIN, Icons::ICON_PROJECT, Icons::ICON_PROJECT_SMALL, Icons::ICON_REPORT, Icons::ICON_REQUEST, Icons::ICON_REQUEST_SMALL, Icons::ICON_SEND_REQUEST, Icons::ICON_SITE, Icons::ICON_SITE_SMALL, Icons::ICON_START, Icons::ICON_STOP, Icons::ICON_TOKEN, Icons::ICON_TRANSCODER, Icons::ICON_VULN, Icons::ICON_VULN_BP, Icons::ICON_VULN_BP_SMALL, Icons::ICON_VULN_CRITICAL, Icons::ICON_VULN_CRITICAL_SMALL, Icons::ICON_VULN_HIGH, Icons::ICON_VULN_HIGH_SMALL, Icons::ICON_VULN_LOW, Icons::ICON_VULN_LOW_SMALL, Icons::ICON_VULN_MEDIUM, Icons::ICON_VULN_MEDIUM_SMALL, Icons::ICON_VULN_SMALL, Icons::ICON_WATOBO, Icons::SIBERAS_ICON, Icons::TBL_ICON_LOCK, Icons::WATOBO_LOGO
Constants included from Watobo::Gui
DIFF_TYPE_NEW, DIFF_TYPE_ORIG, SEL_TYPE_GREP, SEL_TYPE_HIGHLIGHT, TABLE_COL_COMMENT, TABLE_COL_COOKIE, TABLE_COL_HOST, TABLE_COL_METHOD, TABLE_COL_PARMS, TABLE_COL_PATH, TABLE_COL_SSL, TABLE_COL_STATUS
Constants included from Diff::LCS
Diff::LCS::BalancedCallbacks, Diff::LCS::PATCH_MAP, Diff::LCS::SequenceCallbacks, Diff::LCS::VERSION
Instance Method Summary collapse
-
#initialize(owner, text2transcode) ⇒ TranscoderWindow
constructor
A new instance of TranscoderWindow.
- #onDecodeB64(sender, sel, item) ⇒ Object
- #onDecodeHex(sender, sel, item) ⇒ Object
- #onDecodeURL(sender, sel, item) ⇒ Object
- #onEncodeB64(sender, sel, item) ⇒ Object
- #onEncodeHex(sender, sel, item) ⇒ Object
- #onEncodeURL(sender, sel, item) ⇒ Object
- #onHashMD5(sender, sel, item) ⇒ Object
- #onHashSHA1(sender, sel, item) ⇒ Object
- #onTextChanged(sender, sel, item) ⇒ Object
- #setText(raw_text) ⇒ Object
- #update_length_info ⇒ Object
Methods included from Utils
#addDecoder, #addEncoder, #addStringInfo, #cleanupHTTP, load_plugins, #removeTags, #replace_text
Methods included from Diff::LCS
LCS, __diff_direction, __inverse_vector, __lcs, __normalize_patchset, __position_hash, __replace_next_larger, diff, #diff, #lcs, patch, #patch, #patch!, patch!, sdiff, #sdiff, traverse_balanced, #traverse_balanced, traverse_sequences, #traverse_sequences, #unpatch, #unpatch!, unpatch!
Constructor Details
#initialize(owner, text2transcode) ⇒ TranscoderWindow
Returns a new instance of TranscoderWindow.
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 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/watobo/gui/transcoder_window.rb', line 106 def initialize(owner, text2transcode) # Invoke base class initialize function first super(owner, "Transcoder", :opts => DECOR_ALL,:width=>800, :height=>600) self.icon = ICON_TRANSCODER @text = text2transcode main = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y) info_frame = FXHorizontalFrame.new(main, :opts => FRAME_LINE|LAYOUT_FILL_X) main = FXVerticalFrame.new(main, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0) @tabBook = FXTabBook.new(main, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT) @lastTabIndex = 0 textviewer_tab = FXTabItem.new(@tabBook, "Text", nil) frame = FXVerticalFrame.new(@tabBook, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED) text_frame = FXVerticalFrame.new(frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0) #btn_frame = FXHorizontalFrame.new(main, :opts => FRAME_LINE|LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH, # :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20) btn_frame = FXHorizontalFrame.new(main, :opts => FRAME_SUNKEN|LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH) FXLabel.new(info_frame, "Length:" ) @len = FXLabel.new(info_frame, "0" ) hex_tab = FXTabItem.new(@tabBook, "Hex", nil ) frame = FXVerticalFrame.new(@tabBook, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED) @hexViewer = HexViewer.new(frame) @tabBook.connect(SEL_COMMAND) { case @tabBook.current when 0 # when 1 @hexViewer.setText(@text) end @lastTabIndex = @tabBook.current } base64Group = FXGroupBox.new(btn_frame, "Base64", LAYOUT_SIDE_TOP|FRAME_GROOVE, 0, 0, 0, 0) btn_decode_b64 = FXButton.new(base64Group, "Encode", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_LEFT) btn_decode_b64.connect(SEL_COMMAND, method(:onEncodeB64)) btn_decode_b64 = FXButton.new(base64Group, "Decode", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_LEFT) btn_decode_b64.connect(SEL_COMMAND, method(:onDecodeB64)) urlGroup = FXGroupBox.new(btn_frame, "URL", LAYOUT_SIDE_TOP|FRAME_GROOVE, 0, 0, 0, 0) btn_decode_b64 = FXButton.new(urlGroup, "Encode", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_LEFT) btn_decode_b64.connect(SEL_COMMAND, method(:onEncodeURL)) btn_decode_b64 = FXButton.new(urlGroup, "Decode", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_LEFT) btn_decode_b64.connect(SEL_COMMAND, method(:onDecodeURL)) hexGroup = FXGroupBox.new(btn_frame, "Hex", LAYOUT_SIDE_TOP|FRAME_GROOVE, 0, 0, 0, 0) btn_decode_b64 = FXButton.new(hexGroup, "Encode", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_LEFT) btn_decode_b64.connect(SEL_COMMAND, method(:onEncodeHex)) btn_decode_b64 = FXButton.new(hexGroup, "Decode", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_LEFT) btn_decode_b64.connect(SEL_COMMAND, method(:onDecodeHex)) hashGroup = FXGroupBox.new(btn_frame, "Hash", LAYOUT_SIDE_TOP|FRAME_GROOVE, 0, 0, 0, 0) btn_hash_md5 = FXButton.new(hashGroup, "MD5", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_LEFT|LAYOUT_FILL_X) btn_hash_md5.connect(SEL_COMMAND, method(:onHashMD5)) btn_hash_sha1 = FXButton.new(hashGroup, "SHA-1", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_LEFT|LAYOUT_FILL_X) btn_hash_sha1.connect(SEL_COMMAND, method(:onHashSHA1)) # @req_builder = FXText.new(req_editor, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) @textbox = FXText.new(text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP) #@textbox.textStyle |= TEXT_FIXEDWRAP @textbox.connect(SEL_CHANGED, method(:onTextChanged)) @textbox.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, event| unless event.moved? FXMenuPane.new(self) do || pos = @textbox.selStartPos len = @textbox.selEndPos - pos selection = @textbox.extractText(pos, len) addStringInfo(, sender) addDecoder(, sender) addEncoder(, sender) if @textbox.editable? FXMenuSeparator.new() FXMenuCaption.new(,"- Copy -") FXMenuSeparator.new() copyText = FXMenuCommand.new(,"copy text: #{selection}", nil, @textbox, FXText::ID_COPY_SEL) target = FXMenuCheck.new(, "word wrap" ) target.check = ( @textbox.textStyle & TEXT_WORDWRAP > 0 ) ? true : false target.connect(SEL_COMMAND) do |tsender, tsel, titem| if tsender.checked? @textbox.textStyle |= TEXT_WORDWRAP else @textbox.textStyle ^= TEXT_WORDWRAP end end .create .popup(nil, event.root_x, event.root_y) app.runModalWhileShown() end end end if text2transcode then @init_text = text2transcode @textbox.setText(@init_text) update_length_info() end end |
Instance Method Details
#onDecodeB64(sender, sel, item) ⇒ Object
70 71 72 73 74 |
# File 'lib/watobo/gui/transcoder_window.rb', line 70 def onDecodeB64(sender, sel, item) string2encode = @textbox.text string2encode.extend Watobo::Mixin::Transcoders setText(string2encode.b64decode) end |
#onDecodeHex(sender, sel, item) ⇒ Object
94 95 96 97 98 |
# File 'lib/watobo/gui/transcoder_window.rb', line 94 def onDecodeHex(sender, sel, item) string2encode = @textbox.text string2encode.extend Watobo::Mixin::Transcoders setText(string2encode.hexdecode) end |
#onDecodeURL(sender, sel, item) ⇒ Object
88 89 90 91 92 |
# File 'lib/watobo/gui/transcoder_window.rb', line 88 def onDecodeURL(sender,sel, item) string2encode = @textbox.text string2encode.extend Watobo::Mixin::Transcoders setText(string2encode.url_decode) end |
#onEncodeB64(sender, sel, item) ⇒ Object
76 77 78 79 80 |
# File 'lib/watobo/gui/transcoder_window.rb', line 76 def onEncodeB64(sender, sel, item) string2encode = @textbox.text string2encode.extend Watobo::Mixin::Transcoders setText(string2encode.b64encode) end |
#onEncodeHex(sender, sel, item) ⇒ Object
100 101 102 103 104 |
# File 'lib/watobo/gui/transcoder_window.rb', line 100 def onEncodeHex(sender, sel, item) string2encode = @textbox.text string2encode.extend Watobo::Mixin::Transcoders setText(string2encode.hexencode) end |
#onEncodeURL(sender, sel, item) ⇒ Object
82 83 84 85 86 |
# File 'lib/watobo/gui/transcoder_window.rb', line 82 def onEncodeURL(sender, sel, item) string2encode = @textbox.text string2encode.extend Watobo::Mixin::Transcoders setText(string2encode.url_encode) end |
#onHashMD5(sender, sel, item) ⇒ Object
57 58 59 60 61 |
# File 'lib/watobo/gui/transcoder_window.rb', line 57 def onHashMD5(sender, sel, item) text = @textbox.text setText(Digest::MD5.hexdigest(text)) update_length_info end |
#onHashSHA1(sender, sel, item) ⇒ Object
65 66 67 68 |
# File 'lib/watobo/gui/transcoder_window.rb', line 65 def onHashSHA1(sender, sel, item) text = @textbox.text setText(Digest::SHA1.hexdigest(text)) end |
#onTextChanged(sender, sel, item) ⇒ Object
49 50 51 52 53 |
# File 'lib/watobo/gui/transcoder_window.rb', line 49 def onTextChanged(sender, sel, item) @text = @textbox.to_s @hexViewer.setText(@text) update_length_info end |
#setText(raw_text) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/watobo/gui/transcoder_window.rb', line 33 def setText(raw_text) @text = raw_text @hexViewer.setText(raw_text) text = raw_text.gsub(/[^[:print:]]/,'.') @textbox.setText(text) update_length_info end |
#update_length_info ⇒ Object
43 44 45 |
# File 'lib/watobo/gui/transcoder_window.rb', line 43 def update_length_info @len.text = @textbox.to_s.length.to_s end |