Class: Watobo::Gui::FullScanDialog

Inherits:
FXDialogBox
  • Object
show all
Includes:
Responder
Defined in:
lib/watobo/gui/full_scan_dialog.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, project, prefs) ⇒ FullScanDialog

Returns a new instance of FullScanDialog.



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
# File 'lib/watobo/gui/full_scan_dialog.rb', line 57

def initialize(owner, project, prefs)
  super(owner, "Start Full Scan", DECOR_TITLE|DECOR_BORDER, :width => 300, :height => 425)
  @project = project
  @scope = Hash.new
  
  @scan_prefs = nil
  
  @selectedProxy = @project.settings[:proxy]
  @selectedProxyList = @project.settings[:proxy_list]
  
  @login_chat_ids = @project.getLoginChatIds  
  @sid_patterns = @project.getSidPatterns
  @logout_signatures = @project.getLogoutSignatures
  
  
  
  FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
  
  base_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
  
  @switcher = FXSwitcher.new(base_frame,LAYOUT_FILL_X|LAYOUT_FILL_Y)   
  
  @defineScopeFrame = DefineScopeFrame.new(@switcher, prefs)
  
  @policyBase = FXVerticalFrame.new(@switcher, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
  smf = FXHorizontalFrame.new(@policyBase, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP|FRAME_GROOVE)
  FXLabel.new(smf, "Select Checks")
  
  @policyFrame = ChecksPolicyFrame.new(@policyBase, @project.getScanPolicy)
  
#  @scannerOptions = ScannerSettingsFrame.new(@switcher, @project.getScanPreferences(),:opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
  @scannerOptions = ScannerSettingsFrame.new(@switcher, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
  
  #   @advancedFrame = AdvancedSettingsFrame.new(@switcher, @project, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
  
  
  
  buttons_frame = FXHorizontalFrame.new(base_frame,
                                        :opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP)
  
  @finishButton = FXButton.new(buttons_frame, "Start" ,  nil, nil, :opts => BUTTON_NORMAL|LAYOUT_RIGHT)  
  @finishButton.disable
  @finishButton.connect(SEL_COMMAND) do |sender, sel, item|
    #self.handle(self, FXSEL(SEL_COMMAND, ID_CANCEL), nil)
    self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
  end 
  
  @nextButton = FXButton.new(buttons_frame, "Next" ,  nil, nil, :opts => BUTTON_NORMAL|LAYOUT_RIGHT)  
  @nextButton.enable
  @nextButton.connect(SEL_COMMAND) do |sender, sel, item|
    if @switcher.current < @switcher.numChildren-1
      @switcher.current = @switcher.current+1
      
    end
    setButtons(@switcher.current)
  end 
  
  @backButton = FXButton.new(buttons_frame, "Back" ,  nil, nil, :opts => BUTTON_NORMAL|LAYOUT_RIGHT)  
  @backButton.disable
  @backButton.connect(SEL_COMMAND) do |sender, sel, item|
    if @switcher.current > 0
      @switcher.current = @switcher.current-1
      
    end
    setButtons(@switcher.current)
  end 
  
  @cancelButton = FXButton.new(buttons_frame, "Cancel" ,
  :target => self, :selector => FXDialogBox::ID_CANCEL,
  :opts => BUTTON_NORMAL|LAYOUT_RIGHT)  
  
  
end

Instance Attribute Details

#active_policyObject (readonly)

Returns the value of attribute active_policy.



8
9
10
# File 'lib/watobo/gui/full_scan_dialog.rb', line 8

def active_policy
  @active_policy
end

#activeModulesObject (readonly)

Returns the value of attribute activeModules.



11
12
13
# File 'lib/watobo/gui/full_scan_dialog.rb', line 11

def activeModules
  @activeModules
end

#prefsObject (readonly)

Returns the value of attribute prefs.



10
11
12
# File 'lib/watobo/gui/full_scan_dialog.rb', line 10

def prefs
  @prefs
end

#scan_prefsObject (readonly)

Returns the value of attribute scan_prefs.



12
13
14
# File 'lib/watobo/gui/full_scan_dialog.rb', line 12

def scan_prefs
  @scan_prefs
end

#scopeObject (readonly)

Returns the value of attribute scope.



9
10
11
# File 'lib/watobo/gui/full_scan_dialog.rb', line 9

def scope
  @scope
end

Instance Method Details

#onAccept(sender, sel, event) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/watobo/gui/full_scan_dialog.rb', line 14

def onAccept(sender, sel, event)
  
  @scope = @defineScopeFrame.getScope() 
  @activeModules = @policyFrame.getSelectedModules()
  
  @scan_prefs = @scannerOptions.getSettings()
  
  getApp().stopModal(self, 1)
  self.hide()
  return 1
end

#setButtons(index) ⇒ Object



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
# File 'lib/watobo/gui/full_scan_dialog.rb', line 26

def setButtons(index)
  case index
    when 0 
    @nextButton.enable
    @backButton.disable
    @finishButton.disable
    
    when 1
    # select session screen
    @nextButton.enable
    @backButton.enable
    @finishButton.enable
    
    when 2
    # select session screen
    @nextButton.disable
    @backButton.enable
    @finishButton.enable
    
    when 3
      puts "3"
    @nextButton.disable
    @backButton.enable
    @finishButton.enable
    
    
  end
end