Class: SSHScan::KeyExchangeInit
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- SSHScan::KeyExchangeInit
- Defined in:
- lib/ssh_scan/protocol.rb
Overview
SSHv2 KexInit
Class Method Summary collapse
-
.from_hash(opts) ⇒ SSHScan::KeyExchangeInit
Generate a KeyExchangeInit object from given Ruby hash.
Instance Method Summary collapse
- #compression_algorithms_client_to_server ⇒ Object
- #compression_algorithms_client_to_server=(data) ⇒ Object
- #compression_algorithms_server_to_client ⇒ Object
- #compression_algorithms_server_to_client=(data) ⇒ Object
- #cookie ⇒ Object
- #cookie=(string) ⇒ Object
- #encryption_algorithms_client_to_server ⇒ Object
- #encryption_algorithms_client_to_server=(data) ⇒ Object
- #encryption_algorithms_server_to_client ⇒ Object
- #encryption_algorithms_server_to_client=(data) ⇒ Object
- #key_algorithms ⇒ Object
- #key_algorithms=(data) ⇒ Object
- #languages_client_to_server ⇒ Object
- #languages_client_to_server=(data) ⇒ Object
- #languages_server_to_client ⇒ Object
- #languages_server_to_client=(data) ⇒ Object
- #mac_algorithms_client_to_server ⇒ Object
- #mac_algorithms_client_to_server=(data) ⇒ Object
- #mac_algorithms_server_to_client ⇒ Object
- #mac_algorithms_server_to_client=(data) ⇒ Object
- #padding ⇒ Object
- #padding=(string) ⇒ Object
- #parse_string_or_array(data) ⇒ Object
- #recalc_packet_length ⇒ Object
- #server_host_key_algorithms ⇒ Object
- #server_host_key_algorithms=(data) ⇒ Object
-
#to_hash ⇒ Hash
Summarize as Hash.
-
#to_json ⇒ String
Summarize as JSON.
Class Method Details
.from_hash(opts) ⇒ SSHScan::KeyExchangeInit
Generate a SSHScan::KeyExchangeInit object from given Ruby hash.
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/ssh_scan/protocol.rb', line 228 def self.from_hash(opts) kex_init = SSHScan::KeyExchangeInit.new() kex_init. = opts[:cookie] kex_init.padding = opts[:padding] kex_init.key_algorithms = opts[:key_algorithms] kex_init.server_host_key_algorithms = opts[:server_host_key_algorithms] kex_init.encryption_algorithms_client_to_server = opts[:encryption_algorithms_client_to_server] kex_init.encryption_algorithms_server_to_client = opts[:encryption_algorithms_server_to_client] kex_init.mac_algorithms_client_to_server = opts[:mac_algorithms_client_to_server] kex_init.mac_algorithms_server_to_client = opts[:mac_algorithms_server_to_client] kex_init.compression_algorithms_client_to_server = opts[:compression_algorithms_client_to_server] kex_init.compression_algorithms_server_to_client = opts[:compression_algorithms_server_to_client] kex_init.languages_client_to_server = opts[:languages_client_to_server] kex_init.languages_server_to_client = opts[:languages_server_to_client] return kex_init end |
Instance Method Details
#compression_algorithms_client_to_server ⇒ Object
154 155 156 |
# File 'lib/ssh_scan/protocol.rb', line 154 def compression_algorithms_client_to_server self.compression_algorithms_client_to_server_string.split(",") end |
#compression_algorithms_client_to_server=(data) ⇒ Object
158 159 160 161 162 163 |
# File 'lib/ssh_scan/protocol.rb', line 158 def compression_algorithms_client_to_server=(data) string = parse_string_or_array(data) self.compression_algorithms_client_to_server_string = string self.compression_algorithms_client_to_server_length = string.size recalc_packet_length end |
#compression_algorithms_server_to_client ⇒ Object
165 166 167 |
# File 'lib/ssh_scan/protocol.rb', line 165 def compression_algorithms_server_to_client self.compression_algorithms_server_to_client_string.split(",") end |
#compression_algorithms_server_to_client=(data) ⇒ Object
169 170 171 172 173 174 |
# File 'lib/ssh_scan/protocol.rb', line 169 def compression_algorithms_server_to_client=(data) string = parse_string_or_array(data) self.compression_algorithms_server_to_client_string = string self.compression_algorithms_server_to_client_length = string.size recalc_packet_length end |
#cookie ⇒ Object
59 60 61 |
# File 'lib/ssh_scan/protocol.rb', line 59 def self. end |
#cookie=(string) ⇒ Object
63 64 65 |
# File 'lib/ssh_scan/protocol.rb', line 63 def (string) self. = string end |
#encryption_algorithms_client_to_server ⇒ Object
110 111 112 |
# File 'lib/ssh_scan/protocol.rb', line 110 def encryption_algorithms_client_to_server self.encryption_algorithms_client_to_server_string.split(",") end |
#encryption_algorithms_client_to_server=(data) ⇒ Object
114 115 116 117 118 119 |
# File 'lib/ssh_scan/protocol.rb', line 114 def encryption_algorithms_client_to_server=(data) string = parse_string_or_array(data) self.encryption_algorithms_client_to_server_string = string self.encryption_algorithms_client_to_server_length = string.size recalc_packet_length end |
#encryption_algorithms_server_to_client ⇒ Object
121 122 123 |
# File 'lib/ssh_scan/protocol.rb', line 121 def encryption_algorithms_server_to_client self.encryption_algorithms_server_to_client_string.split(",") end |
#encryption_algorithms_server_to_client=(data) ⇒ Object
125 126 127 128 129 130 |
# File 'lib/ssh_scan/protocol.rb', line 125 def encryption_algorithms_server_to_client=(data) string = parse_string_or_array(data) self.encryption_algorithms_server_to_client_string = string self.encryption_algorithms_server_to_client_length = string.size recalc_packet_length end |
#key_algorithms ⇒ Object
75 76 77 |
# File 'lib/ssh_scan/protocol.rb', line 75 def key_algorithms self.key_algorithms_string.split(",") end |
#key_algorithms=(data) ⇒ Object
92 93 94 95 96 97 |
# File 'lib/ssh_scan/protocol.rb', line 92 def key_algorithms=(data) string = parse_string_or_array(data) self.key_algorithms_string = string self.kex_algorithms_length = string.size recalc_packet_length end |
#languages_client_to_server ⇒ Object
176 177 178 |
# File 'lib/ssh_scan/protocol.rb', line 176 def languages_client_to_server self.languages_client_to_server_string.split(",") end |
#languages_client_to_server=(data) ⇒ Object
180 181 182 183 184 185 |
# File 'lib/ssh_scan/protocol.rb', line 180 def languages_client_to_server=(data) string = parse_string_or_array(data) self.languages_client_to_server_string = string self.languages_client_to_server_length = string.size recalc_packet_length end |
#languages_server_to_client ⇒ Object
187 188 189 |
# File 'lib/ssh_scan/protocol.rb', line 187 def languages_server_to_client self.languages_server_to_client_string.split(",") end |
#languages_server_to_client=(data) ⇒ Object
191 192 193 194 195 196 |
# File 'lib/ssh_scan/protocol.rb', line 191 def languages_server_to_client=(data) string = parse_string_or_array(data) self.languages_server_to_client_string = string self.languages_server_to_client_length = string.size recalc_packet_length end |
#mac_algorithms_client_to_server ⇒ Object
132 133 134 |
# File 'lib/ssh_scan/protocol.rb', line 132 def mac_algorithms_client_to_server self.mac_algorithms_client_to_server_string.split(",") end |
#mac_algorithms_client_to_server=(data) ⇒ Object
136 137 138 139 140 141 |
# File 'lib/ssh_scan/protocol.rb', line 136 def mac_algorithms_client_to_server=(data) string = parse_string_or_array(data) self.mac_algorithms_client_to_server_string = string self.mac_algorithms_client_to_server_length = string.size recalc_packet_length end |
#mac_algorithms_server_to_client ⇒ Object
143 144 145 |
# File 'lib/ssh_scan/protocol.rb', line 143 def mac_algorithms_server_to_client self.mac_algorithms_server_to_client_string.split(",") end |
#mac_algorithms_server_to_client=(data) ⇒ Object
147 148 149 150 151 152 |
# File 'lib/ssh_scan/protocol.rb', line 147 def mac_algorithms_server_to_client=(data) string = parse_string_or_array(data) self.mac_algorithms_server_to_client_string = string self.mac_algorithms_server_to_client_length = string.size recalc_packet_length end |
#padding ⇒ Object
67 68 69 |
# File 'lib/ssh_scan/protocol.rb', line 67 def padding self.padding_string end |
#padding=(string) ⇒ Object
71 72 73 |
# File 'lib/ssh_scan/protocol.rb', line 71 def padding=(string) self.padding_string = string end |
#parse_string_or_array(data) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/ssh_scan/protocol.rb', line 79 def parse_string_or_array(data) case data when String string = data when Array string = data.join(",") else raise ArgumentError end return string end |
#recalc_packet_length ⇒ Object
198 199 200 |
# File 'lib/ssh_scan/protocol.rb', line 198 def recalc_packet_length self.packet_length = self.to_binary_s.size - self.padding_length end |
#server_host_key_algorithms ⇒ Object
99 100 101 |
# File 'lib/ssh_scan/protocol.rb', line 99 def server_host_key_algorithms self.server_host_key_algorithms_string.split(",") end |
#server_host_key_algorithms=(data) ⇒ Object
103 104 105 106 107 108 |
# File 'lib/ssh_scan/protocol.rb', line 103 def server_host_key_algorithms=(data) string = parse_string_or_array(data) self.server_host_key_algorithms_string = string self.server_host_key_algorithms_length = string.size recalc_packet_length end |
#to_hash ⇒ Hash
Summarize as Hash
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/ssh_scan/protocol.rb', line 204 def to_hash { :cookie => self..hexify, :key_algorithms => key_algorithms, :server_host_key_algorithms => server_host_key_algorithms, :encryption_algorithms_client_to_server => encryption_algorithms_client_to_server, :encryption_algorithms_server_to_client => encryption_algorithms_server_to_client, :mac_algorithms_client_to_server => mac_algorithms_client_to_server, :mac_algorithms_server_to_client => mac_algorithms_server_to_client, :compression_algorithms_client_to_server => compression_algorithms_client_to_server, :compression_algorithms_server_to_client => compression_algorithms_server_to_client, :languages_client_to_server => languages_client_to_server, :languages_server_to_client => languages_server_to_client, } end |
#to_json ⇒ String
Summarize as JSON
253 254 255 |
# File 'lib/ssh_scan/protocol.rb', line 253 def to_json self.to_hash.to_json end |