Class: Watobo::Plugin::Sslchecker::Gui::CipherTable

Inherits:
FXTable
  • Object
show all
Defined in:
plugins/sslchecker/gui/cipher_table.rb

Constant Summary collapse

CTF_NONE =
0x00
CTF_GOOD =
0x01
CTF_BAD =
0x02
CTF_NA =
0x04
CTF_ALL =
0x07

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, opts) ⇒ CipherTable

Returns a new instance of CipherTable.



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'plugins/sslchecker/gui/cipher_table.rb', line 144

def initialize(owner, opts)
  super(owner, :opts => TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
  @ciphers = []
  @min_bit_length = 128

  @columns = Hash.new
   @columns[:method] = { :label => "Method", :pos => 0, :width => 50 }
  @columns[:algo] = { :label => "Cipher", :pos => 1, :width => 250 }
  @columns[:bits] = { :label => "Bits", :pos => 2, :width => 100 }
  @columns[:support] = { :label => "Result", :pos => 3, :width => 50 }

  @filter = CTF_ALL

  init_icons
  initColumns()
  adjustCellWidth
end

Instance Attribute Details

#ciphersObject (readonly)

Returns the value of attribute ciphers.



78
79
80
# File 'plugins/sslchecker/gui/cipher_table.rb', line 78

def ciphers
  @ciphers
end

#filterObject

Returns the value of attribute filter.



80
81
82
# File 'plugins/sslchecker/gui/cipher_table.rb', line 80

def filter
  @filter
end

#min_bit_lengthObject

Returns the value of attribute min_bit_length.



79
80
81
# File 'plugins/sslchecker/gui/cipher_table.rb', line 79

def min_bit_length
  @min_bit_length
end

Instance Method Details

#add_cipher(cipher) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
# File 'plugins/sslchecker/gui/cipher_table.rb', line 113

def add_cipher( cipher )

  [ :method, :algo, :bits, :support ].each do |k|
    return false unless cipher.has_key? k
  end

  @ciphers.push cipher
  add_cipher_row(cipher)

  true
end

#clear_ciphersObject



138
139
140
141
142
# File 'plugins/sslchecker/gui/cipher_table.rb', line 138

def clear_ciphers
  self.clearItems
  initColumns
  @ciphers.clear
end

#setNewFont(font_type = nil, size = nil) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'plugins/sslchecker/gui/cipher_table.rb', line 94

def setNewFont(font_type=nil, size=nil)
  begin
    new_size = size.nil? ? GUI_REGULAR_FONT_SIZE : size
    new_font_type = font_type.nil? ? "helvetica" : font_type
    new_font = FXFont.new(getApp(), new_font_type, new_size)
    new_font.create

    self.font = new_font
    self.rowHeader.font = new_font
    self.defRowHeight = new_size+10

    updateTable()

  rescue => bang
    puts bang
    puts bang.backtrace if $DEBUG
  end
end

#show_allObject



125
126
127
# File 'plugins/sslchecker/gui/cipher_table.rb', line 125

def show_all
  @filter = CTF_ALL
end

#to_csvObject

this returns a comma seperated list of the table [string]



83
84
85
86
87
88
89
90
91
92
# File 'plugins/sslchecker/gui/cipher_table.rb', line 83

def to_csv
  csv = ""
 self.each_row do |c,b,r|
    csv << c.text.strip << ";"
    csv << b.text.strip << ";"
    csv << r.text.strip
    csv << "\n"
  end
  csv
end

#update_tableObject



129
130
131
132
133
134
135
136
# File 'plugins/sslchecker/gui/cipher_table.rb', line 129

def update_table
#  puts "update table: #{filter}"
  self.clearItems
  initColumns
  @ciphers.each do |c|
    add_cipher_row c
  end
end