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.



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

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.



29
30
31
# File 'lib/watobo/gui/full_scan_dialog.rb', line 29

def active_policy
  @active_policy
end

#activeModulesObject (readonly)

Returns the value of attribute activeModules.



32
33
34
# File 'lib/watobo/gui/full_scan_dialog.rb', line 32

def activeModules
  @activeModules
end

#prefsObject (readonly)

Returns the value of attribute prefs.



31
32
33
# File 'lib/watobo/gui/full_scan_dialog.rb', line 31

def prefs
  @prefs
end

#scan_prefsObject (readonly)

Returns the value of attribute scan_prefs.



33
34
35
# File 'lib/watobo/gui/full_scan_dialog.rb', line 33

def scan_prefs
  @scan_prefs
end

#scopeObject (readonly)

Returns the value of attribute scope.



30
31
32
# File 'lib/watobo/gui/full_scan_dialog.rb', line 30

def scope
  @scope
end

Instance Method Details

#onAccept(sender, sel, event) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/watobo/gui/full_scan_dialog.rb', line 35

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



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

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