Class: Watobo::Gui::ManualRequestEditor
- Inherits:
-
FXDialogBox
- Object
- FXDialogBox
- Watobo::Gui::ManualRequestEditor
- Defined in:
- lib/watobo/gui/manual_request_editor.rb
Overview
Constant Summary collapse
- SCANNER_IDLE =
ID_CTRL_S = ID_LAST ID_LAST = ID_CTRL_S + 1
0x00
- SCANNER_STARTED =
0x01
- SCANNER_FINISHED =
0x02
- SCANNER_CANCELED =
0x04
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_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 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
- #addHistoryItem(request, response, raw_request) ⇒ Object
- #clearEvents(event) ⇒ Object
-
#initialize(owner, project, chat) ⇒ ManualRequestEditor
constructor
A new instance of ManualRequestEditor.
-
#logger(message) ⇒ Object
def onShowPreview(sender, sel, item) @interface.showPreview(request, response) end.
- #notify(event, *args) ⇒ Object
- #onBtnQuickScan(sender, sel, item) ⇒ Object
- #onBtnSendClick(sender, sel, item) ⇒ Object
- #onPreviewClick(sender, sel, item) ⇒ Object
- #onRequestReset(sender, sel, item) ⇒ Object
- #openCSRFTokenDialog(sender, sel, item) ⇒ Object
- #showHistory(dist = 0, pos = nil) ⇒ Object
- #subscribe(event, &callback) ⇒ Object
Constructor Details
#initialize(owner, project, chat) ⇒ ManualRequestEditor
Returns a new instance of ManualRequestEditor.
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 674 def initialize(owner, project, chat) begin # Invoke base class initialize function first super(owner, "Manual Request Toolkit", :opts => DECOR_ALL,:width=>850, :height=>600) @event_dispatcher_listeners = Hash.new @request_sender = ManualRequestSender.new(project) @request_sender.subscribe(:follow_redirect){ |loc| logger( "follow redirect -> #{loc}")} @responseFilter = FXDataTarget.new("") @chat = chat @original_request = chat.copyRequest @project = project @csrf_requests = [] @tselect = "" @sel_pos = "" @sel_len = "" @last_request = nil @last_response = nil @history_size = 10 @history = [] @counter = 0 @scanner = nil @new_response = nil @new_request = nil @update_lock = Mutex.new @scan_status_lock = Mutex.new @scan_status = SCANNER_IDLE # shortcuts here #FXMAPFUNC(SEL_COMMAND, ID_CTRL_S, :on_ctrl_s) #accelTable.addAccel(fxparseAccel("Ctrl+S"), self, FXSEL(SEL_COMMAND, ID_CTRL_S)) # @scanlog_dir = @project.scanLogDirectory() self.icon = ICON_MANUAL_REQUEST # Construct some hilite styles hs_red = FXHiliteStyle.new hs_red.normalForeColor = FXRGBA(255,255,255,255) # FXColor::Red hs_red.normalBackColor = FXRGBA(255,0,0,1) # FXColor::White hs_red.style = FXText::STYLE_BOLD mr_splitter = FXSplitter.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_VERTICAL|SPLITTER_REVERSED|SPLITTER_TRACKING) # top = FXHorizontalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_SIDE_BOTTOM) top_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y||LAYOUT_FIX_HEIGHT|LAYOUT_BOTTOM,:height => 500) top_splitter = FXSplitter.new(top_frame, LAYOUT_FILL_X|SPLITTER_HORIZONTAL|LAYOUT_FILL_Y|SPLITTER_TRACKING) log_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM,:height => 100) #LAYOUT_FILL_X in combination with LAYOUT_FIX_WIDTH req_editor = FXVerticalFrame.new(top_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FIX_WIDTH|LAYOUT_FILL_Y|FRAME_GROOVE,:width=>400, :height=>500) req_edit_header = FXHorizontalFrame.new(req_editor, :opts => LAYOUT_FILL_X) #req_viewer = FXVerticalFrame.new(req_editor, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding=>0) @req_builder = RequestBuilder.new(req_editor, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding=>0) @req_builder.subscribe(:hotkey_ctrl_s) { simulatePressSendBtn() sendManualRequest() } @req_builder.subscribe(:hotkey_ctrl_enter) { simulatePressSendBtn() sendManualRequest() } @req_builder.subscribe(:error) { |msg| logger(msg)} @req_builder.setRequest(@original_request) = FXHorizontalFrame.new(req_edit_header, :opts => FRAME_NONE) FXLabel.new(, "History:", :opts => LAYOUT_CENTER_Y ) hback = FXButton.new(, "<", nil, nil, 0, FRAME_RAISED|FRAME_THICK) @history_pos_dt = FXDataTarget.new(0) @history_pos = FXTextField.new(, 2, @history_pos_dt, FXDataTarget::ID_VALUE, :opts => LAYOUT_FILL_X|FRAME_GROOVE|FRAME_SUNKEN) @history_pos.justify = JUSTIFY_RIGHT @history_pos.handle(self, FXSEL(SEL_UPDATE, 0), nil) hback.connect(SEL_COMMAND){ showHistory(-1)} hnext = FXButton.new(, ">", nil, nil, 0, FRAME_RAISED|FRAME_THICK) hnext.connect(SEL_COMMAND){ showHistory(1)} = FXMenuPane.new(self) FXMenuCommand.new(, "-> GET").connect(SEL_COMMAND, method(:trans2Get)) FXMenuCommand.new(, "-> POST").connect(SEL_COMMAND, method(:trans2Post)) # FXMenuCommand.new(menu, "POST <=> GET").connect(SEL_COMMAND, method(:switchMethod)) = FXButton.new(req_edit_header, "Reset", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_FILL_Y) .connect(SEL_COMMAND, method(:onRequestReset)) # Button to pop menu FXMenuButton.new(req_edit_header, "&Transform", nil, , (MENUBUTTON_DOWN|FRAME_RAISED|FRAME_THICK|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_FILL_Y)) # req_reset_button = FXButton.new(request_frame, "POST -> GET", nil, nil, 0, FRAME_RAISED|FRAME_THICK) # req_reset_button.connect(SEL_COMMAND, method(:switchMethod)) #request_frame = FXHorizontalFrame.new(req_edit_header, :opts => FRAME_GROOVE|LAYOUT_RIGHT) # FXLabel.new(request_frame, "Request:", :opts => LAYOUT_CENTER_Y ) frame = FXHorizontalFrame.new(req_editor, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM, :padding => 0) = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) #eq_options = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM) #opt = FXGroupBox.new(req_options, "Request Options", LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0) @settings_tab = FXTabBook.new(, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT) resp_tab = FXTabItem.new(@settings_tab, "Request Options", nil) opt= FXVerticalFrame.new(@settings_tab, :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y) # opt = FXVerticalFrame.new(frame,:opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0) # btn = FXVerticalFrame.new(frame,:opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0) #FXCheckButton.new(rob, "URL Encoding", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP) @updateContentLength = FXCheckButton.new(opt, "Update Content-Length", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP) @updateContentLength.checkState = true @followRedirect = FXCheckButton.new(opt, "Follow Redirects", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP) @followRedirect.checkState = false @logChat = FXCheckButton.new(opt, "Log Chat", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP) @logChat.checkState = false # scan_tab = FXTabItem.new(@settings_tab, "QuickScan Options", nil) sess_tab = FXTabItem.new(@settings_tab, "Session Settings", nil) session_frame = FXVerticalFrame.new(@settings_tab, :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y) @updateSID = FXCheckButton.new(session_frame, "Update SID Cache", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP) @updateSID.checkState = false @updateSession = FXCheckButton.new(session_frame, "Update Session", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP) @updateSession.checkState = true @updateSession.connect(SEL_COMMAND) do |sender, sel, item| @runLogin.enabled = @updateSession.checked? end @runLogin = FXCheckButton.new(session_frame, "Run Login", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP) @runLogin.checkState = false csrf_frame = FXHorizontalFrame.new(session_frame,:opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP, :padding => 0) @updateCSRF = FXCheckButton.new(csrf_frame, "Update One-Time-Tokens", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP) @updateCSRF.checkState = false @csrf_settings_btn = FXButton.new(csrf_frame, "O-T-T Settings") @csrf_settings_btn.connect(SEL_COMMAND, method(:openCSRFTokenDialog)) @updateCSRF.connect(SEL_COMMAND) do |sender, sel, item| if @updateCSRF.checked? then @csrf_settings_btn.enable else @csrf_settings_btn.disable end end ################################################## ################################################## = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_Y|LAYOUT_FIX_WIDTH|LAYOUT_RIGHT, :width => 100) send_frame = FXVerticalFrame.new(, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_X, :padding => 2) send_frame.backColor = FXColor::Red #btn_send = FXButton.new(frame, "\nSEND", ICON_SEND_REQUEST, nil, 0, :opts => ICON_ABOVE_TEXT|FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_Y|LAYOUT_FIX_WIDTH|LAYOUT_RIGHT, :width => 100) @btn_send = FXButton.new(send_frame, "\nSEND", ICON_SEND_REQUEST, nil, 0, :opts => ICON_ABOVE_TEXT|FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_Y|LAYOUT_FILL_X|LAYOUT_RIGHT) btn_prev = FXButton.new(, "preview >>", nil, nil, 0, :opts => LAYOUT_FILL_X|FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT) btn_prev.connect(SEL_COMMAND,method(:onPreviewClick)) frame = FXHorizontalFrame.new(req_editor, :opts => LAYOUT_FILL_X|FRAME_GROOVE) @btn_quickscan = FXButton.new(frame, "QuickScan", nil, nil, 0, FRAME_RAISED|FRAME_THICK) @btn_quickscan.connect(SEL_COMMAND, method(:onBtnQuickScan)) @pbar = FXProgressBar.new(frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_HORIZONTAL) #@pbar.create @pbar.connect(SEL_CHANGED) { print ":" } @pbar.progress = 0 @pbar.total = 0 @pbar.=0 @pbar. = 'grey' #FXRGB(255,0,0) # TODO: Implement font sizing #@req_builder.font = FXFont.new(app, "courier" , 14, :encoding=>FONTENCODING_ISO_8859_1) result_viewer = FXVerticalFrame.new(top_splitter, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE|LAYOUT_FIX_WIDTH, :width => 400) # log_viewer = FXVerticalFrame.new(bottom_frame, :opts => LAYOUT_FILL_X|FRAME_GROOVE|LAYOUT_BOTTOM) @tabBook = FXTabBook.new(result_viewer, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT) resp_tab = FXTabItem.new(@tabBook, "Response", nil) frame = FXVerticalFrame.new(@tabBook, :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0) @response_viewer = Watobo::Gui::ResponseViewer.new(frame, LAYOUT_FILL_X|LAYOUT_FILL_Y) #@response_viewer.ma @response_viewer.max_len = 0 = FXHorizontalFrame.new(frame, :opts => LAYOUT_FILL_X) frame = FXHorizontalFrame.new(, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN) frame.backColor = FXColor::White label = FXLabel.new(frame, "MD5: ", :opts => LAYOUT_FILL_Y|JUSTIFY_CENTER_Y) label.backColor = FXColor::White @responseMD5 = FXLabel.new(frame, "-N/A-", :opts => LAYOUT_FILL_Y|JUSTIFY_CENTER_Y) @responseMD5.backColor = FXColor::White = FXButton.new(, "Browser-View", ICON_BROWSER_MEDIUM, nil, 0, :opts => BUTTON_NORMAL|LAYOUT_RIGHT) .connect(SEL_COMMAND) { begin if @last_request and @last_response then #@interface.openBrowser(@last_request, @last_response) notify(:show_browser_preview, @last_request, @last_response) end rescue => bang puts bang end } req_tab = FXTabItem.new(@tabBook, "Request", nil) @request_viewer = Watobo::Gui::RequestViewer.new(@tabBook, FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y) diff_tab = FXTabItem.new(@tabBook, "Differ", nil) @diff_frame = DiffFrame.new(@tabBook, :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y) # log_frame_header = FXHorizontalFrame.new(log_frame, :opts => LAYOUT_FILL_X) # FXLabel.new(log_frame_header, "Logs:" ) log_text_frame = FXVerticalFrame.new(log_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding=>0) @log_viewer = LogViewer.new(log_text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) #-------------------------------------------------------------------------------- @btn_send.connect(SEL_COMMAND, method(:onBtnSendClick)) add_update_timer(50) rescue => bang puts bang puts bang.backtrace if $DEBUG end end |
Instance Method Details
#addHistoryItem(request, response, raw_request) ⇒ Object
520 521 522 523 524 525 526 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 520 def addHistoryItem(request, response, raw_request) @history.push HistoryItem.new(request, response, eval(YAML.load(YAML.dump(raw_request.inspect)))) @history.shift if @history.length > @history_size @diff_frame.updateHistory(@history) end |
#clearEvents(event) ⇒ Object
493 494 495 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 493 def clearEvents(event) @event_dispatcher_listener[event].clear end |
#logger(message) ⇒ Object
def onShowPreview(sender, sel, item) @interface.showPreview(request, response) end
513 514 515 516 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 513 def logger() @log_viewer.log( LOG_INFO, ) puts "[#{self.class.to_s}] #{}" if $DEBUG end |
#notify(event, *args) ⇒ Object
497 498 499 500 501 502 503 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 497 def notify(event, *args) if @event_dispatcher_listeners[event] @event_dispatcher_listeners[event].each do |m| m.call(*args) if m.respond_to? :call end end end |
#onBtnQuickScan(sender, sel, item) ⇒ Object
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 528 def onBtnQuickScan(sender, sel, item) dlg = Watobo::Gui::QuickScanDialog.new(self, @project, :target_chat => @chat, :enable_one_time_tokens => @updateCSRF.checked?) scan_chats = [] if sender.text =~ /Cancel/i @scanner.cancel() if @scanner logger("QuickScan canceled by user") @pbar.progress = 0 sender.text = "QuickScan" return end if dlg.execute != 0 then scan_modules = [] sender.text = "Cancel" = dlg. # puts quick_scan_options.to_yaml if [:use_orig_request] == true then req = @original_request else req = @req_builder.parseRequest() end scan_chats.push Chat.new(req, [""], :id => @chat.id, :run_passive_checks => false) end unless scan_chats.empty? then # we only need array of selected class names scan_modules = dlg.selectedModules().map{ |m| m.class.to_s } acc = @project.active_checks.select do |ac| scan_modules.include? ac.class.to_s end scan_prefs = @project.getScanPreferences # we don't want logout detection during a QuickScan # TODO: let this decide the user! scan_prefs[:logout_signatures] = [] if [:detect_logout] == false # scan_prefs[:csrf_requests] = @project.getCSRFRequests(@original_request) if quick_scan_options[:update_csrf_tokens] == true scan_prefs[:run_passive_checks] = false # logging required ? if [:enable_logging] and [:scanlog_name] scan_prefs[:scanlog_name] = [:scanlog_name] end if $DEBUG puts "* creating scanner ..." puts .to_yaml puts "- - - - - - - - -" puts scan_prefs.to_yaml end @scanner = Watobo::Scanner2.new(scan_chats, acc, @project.passive_checks, scan_prefs) @pbar.total = @scanner.numTotalChecks @pbar.progress = 0 @pbar. = FXRGB(255,0,0) @scanner.subscribe(:progress) { |m| # print "=" @pbar.increment(1) } @scanner.subscribe(:new_finding) { |f| @project.addFinding(f) } csrf_requests = [] if [:update_csrf_tokens] == true @project.getCSRFRequestIDs(req).each do |id| chat = @project.getChat(id) csrf_requests.push chat.copyRequest end puts "* Got No CSRF Requests!!" if csrf_requests.empty? end run_prefs = { :update_sids => @updateSID.checked?, :update_session => @updateSession.checked?, :csrf_requests => csrf_requests, :csrf_patterns => scan_prefs[:csrf_patterns], :www_auth => scan_prefs[:www_auth], :follow_redirect => [:follow_redirect], } logger("Scan Started ...") @scan_status = SCANNER_STARTED Thread.new(run_prefs) { |rp| begin # puts "* starting scanner ..." # puts run_prefs.to_yaml @scanner.run( rp ) #sender.text = "QuickScan" rescue => bang puts bang puts bang.backtrace if $DEBUG ensure logger("Scan finished!") @scan_status_lock.synchronize do @scan_status |= SCANNER_FINISHED end end } end # return 0 end |
#onBtnSendClick(sender, sel, item) ⇒ Object
642 643 644 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 642 def onBtnSendClick(sender,sel,item) sendManualRequest() end |
#onPreviewClick(sender, sel, item) ⇒ Object
646 647 648 649 650 651 652 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 646 def onPreviewClick(sender,sel,item) @request_viewer.setText('') new_request = @req_builder.parseRequest # puts "new request: #{new_request}" @request_viewer.setText(new_request) @tabBook.current = 1 end |
#onRequestReset(sender, sel, item) ⇒ Object
505 506 507 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 505 def onRequestReset(sender,sel,item) @req_builder.setRequest(@original_request) end |
#openCSRFTokenDialog(sender, sel, item) ⇒ Object
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 469 def openCSRFTokenDialog(sender, sel, item) csrf_dlg = CSRFTokenDialog.new(self, @project, @chat) if csrf_dlg.execute != 0 then csrf_ids = csrf_dlg.getTokenScriptIds() csrf_patterns = csrf_dlg.getTokenPatterns() # puts csrf_ids.to_yaml # puts "= = =" # puts csrf_patterns.to_yaml @project.setCSRFRequest(@original_request, csrf_ids, csrf_patterns) @csrf_requests = [] csrf_ids.each do |id| chat = @project.getChat(id) @csrf_requests.push chat.copyRequest end # save settings # saveProjectSettings(@active_project) # saveSessionSettings(@active_project) end end |
#showHistory(dist = 0, pos = nil) ⇒ Object
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 654 def showHistory(dist=0, pos=nil) if @history.length > 0 current_pos = @history_pos_dt.value new_pos = current_pos + dist new_pos = 1 if new_pos <= 0 new_pos = @history.length if new_pos > @history.length @req_builder.setRequest(@history[new_pos-1].raw_request) @req_builder.highlight("(%%[^%]*%%)") @response_viewer.setText(@history[new_pos-1].response) @history_pos_dt.value = new_pos @history_pos.handle(self, FXSEL(SEL_UPDATE, 0), nil) return new_pos end return 0 if dist == 0 and not pos end |
#subscribe(event, &callback) ⇒ Object
465 466 467 |
# File 'lib/watobo/gui/manual_request_editor.rb', line 465 def subscribe(event, &callback) (@event_dispatcher_listeners[event] ||= []) << callback end |