freewifi 0.1.9 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
@@ -4,43 +4,43 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "freewifi/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "freewifi"
7
+ spec.name = 'freewifi'
8
8
  spec.version = Freewifi_1::VERSION
9
- spec.authors = ["Dzmitry Buynovskiy"]
10
- spec.email = ["imperituro.ard@gmail.com"]
9
+ spec.authors = ['Dzmitry Buynovskiy']
10
+ spec.email = ['imperituro.ard@gmail.com']
11
11
 
12
12
  spec.summary = %q{gem for Public WiFi}
13
13
  spec.description = %q{description for my gem}
14
- spec.homepage = "https://rubygems.org/gems/freewifi"
15
- spec.license = "MIT"
14
+ spec.homepage = 'https://rubygems.org/gems/freewifi'
15
+ spec.license = 'MIT'
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
18
  # to allow pushing to a single host or delete this section to allow pushing to any host.
19
19
  if spec.respond_to?(:metadata)
20
- spec.metadata["allowed_push_host"] = "https://rubygems.org/"
20
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
21
21
  else
22
- raise "RubyGems 2.0 or newer is required to protect against " \
23
- "public gem pushes."
22
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
23
+ 'public gem pushes.'
24
24
  end
25
25
 
26
26
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
27
  f.match(%r{^(test|spec|features)/})
28
28
  end
29
- spec.bindir = "exe"
29
+ spec.bindir = 'exe'
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ["lib"]
31
+ spec.require_paths = ['lib']
32
32
 
33
- spec.add_development_dependency "bundler", "2.1.4"
34
- spec.add_development_dependency "rake", "13.0.1"
35
- spec.add_development_dependency "minitest", "~> 5.0"
36
- spec.add_development_dependency "net-ssh", '4.0.1'
37
- spec.add_development_dependency "json", "2.3.0"
38
- spec.add_development_dependency "ipaddr", "1.2.2"
39
- spec.add_development_dependency "date", "3.0.0"
40
- spec.add_development_dependency "mysql2", "0.5.3"
41
- spec.add_development_dependency "mongo", "2.11.4"
42
- spec.add_development_dependency "translit", "0.1.5"
43
- spec.add_development_dependency "savon", "2.12.0"
44
- spec.add_development_dependency "net-telnet", "0.2.0"
45
- spec.add_development_dependency "mtik", "4.0.3"
33
+ spec.add_development_dependency 'bundler', '2.1.4'
34
+ spec.add_development_dependency 'rake', '13.0.1'
35
+ spec.add_development_dependency 'minitest', '~> 5.0'
36
+ spec.add_development_dependency 'net-ssh', '4.0.1'
37
+ spec.add_development_dependency 'json', '2.3.0'
38
+ spec.add_development_dependency 'ipaddr', '1.2.2'
39
+ spec.add_development_dependency 'date', '3.0.0'
40
+ spec.add_development_dependency 'mysql2', '0.5.3'
41
+ spec.add_development_dependency 'mongo', '2.11.4'
42
+ spec.add_development_dependency 'translit', '0.1.5'
43
+ spec.add_development_dependency 'savon', '2.12.0'
44
+ spec.add_development_dependency 'net-telnet', '0.2.0'
45
+ spec.add_development_dependency 'mtik', '4.0.3'
46
46
  end
@@ -1,10 +1,10 @@
1
1
  #$LOAD_PATH.unshift File.expand_path("../freewifi", __dir__)
2
- $LOAD_PATH.unshift File.expand_path("../mikrotik", __dir__)
3
- $LOAD_PATH.unshift File.expand_path("../database/mysql", __dir__)
4
- $LOAD_PATH.unshift File.expand_path("../database/mongo", __dir__)
5
- $LOAD_PATH.unshift File.expand_path("../additional", __dir__)
6
- $LOAD_PATH.unshift File.expand_path("../general", __dir__)
7
- $LOAD_PATH.unshift File.expand_path("../huawei", __dir__)
2
+ $LOAD_PATH.unshift File.expand_path('../mikrotik', __dir__)
3
+ $LOAD_PATH.unshift File.expand_path('../database/mysql', __dir__)
4
+ $LOAD_PATH.unshift File.expand_path('../database/mongo', __dir__)
5
+ $LOAD_PATH.unshift File.expand_path('../additional', __dir__)
6
+ $LOAD_PATH.unshift File.expand_path('../general', __dir__)
7
+ $LOAD_PATH.unshift File.expand_path('../huawei', __dir__)
8
8
 
9
9
  require "freewifi/version"
10
10
  require "freewifi/params"
@@ -66,8 +66,7 @@ module Freewifi_1
66
66
  capsman_password,
67
67
  hub_vip,
68
68
  ap_admin_password,
69
- capsman_ip_wifi
70
- )
69
+ capsman_ip_wifi)
71
70
 
72
71
  @mtik_hub1_ip = hub1ip
73
72
  @mtik_hub2_ip = hub2ip
@@ -87,8 +86,6 @@ module Freewifi_1
87
86
  @hub_vip = hub_vip
88
87
  @ap_admin_password = ap_admin_password
89
88
  @capsman_ip_wifi = capsman_ip_wifi
90
-
91
-
92
89
  end
93
90
 
94
91
 
@@ -138,7 +135,7 @@ module Freewifi_1
138
135
  :subscribers_contacts => subscribers_contacts,
139
136
  :wifi_ssid => wifi_ssid,
140
137
  :portalstyle => portalstyle,
141
- :ap => "MikroTik",
138
+ :ap => 'MikroTik',
142
139
  :ap_serial_number => ap_serial_number,
143
140
  :ap_model => ap_model,
144
141
  :description => description,
@@ -149,7 +146,7 @@ module Freewifi_1
149
146
  }
150
147
 
151
148
  mongo_response = mongo_connector_wifi_1.data_ap_auto_created_insert_1(data)
152
- if mongo_response[:code]==200
149
+ if mongo_response[:code] == 200
153
150
 
154
151
  newcapsman1 = NEWhubWifi_1.new
155
152
  threads_1 = []
@@ -160,27 +157,27 @@ module Freewifi_1
160
157
 
161
158
  input_intern_data = {:wifi_ssid_processed => wifi_ssid_processed, :company_name_processed => company_name_processed, :capsman => capsman}
162
159
 
163
- mongo_connector_wifi_1.audit_logger_wifi_1("add_mikrotik_ap_mobile_1", remote_ip, input_intern_data, nil, real_ip, subscriber_ip)
160
+ mongo_connector_wifi_1.audit_logger_wifi_1('add_mikrotik_ap_mobile_1', remote_ip, input_intern_data, nil, real_ip, subscriber_ip)
164
161
 
165
162
  newcapsman1.set_capsman_config_1(wifi_ssid_processed, capsman, capsman_user, capsman_password, sim_ipaddress, company_name_processed)
166
163
  end
167
164
  end
168
165
  threads_1.each(&:join)
169
166
 
170
- output_params = {:code => 200, :result => "Request completed successfully", :body => {:tunnel_id => tunnel_addition[:body][:eoip_tunnel_id], :tunnel_name => tunnel_addition[:body][:eoip_tunnel_name]}}
167
+ output_params = {:code => 200, :result => 'Request completed successfully', :body => {:tunnel_id => tunnel_addition[:body][:eoip_tunnel_id], :tunnel_name => tunnel_addition[:body][:eoip_tunnel_name]}}
171
168
  else
172
- output_params = {:code => 400, :result => "Something wrong with insertion to mongo"}
169
+ output_params = {:code => 400, :result => 'Something wrong with insertion to mongo'}
173
170
  end
174
171
  else
175
172
  output_params = {:code => 401, :result => tunnel_addition[:result]}
176
173
  end
177
174
  else
178
- output_params = {:code => 202, :result => "AP exists", :body => {:tunnel_id => ap_state[:tunnel_id].to_s}}
175
+ output_params = {:code => 202, :result => 'AP exists', :body => {:tunnel_id => ap_state[:tunnel_id].to_s}}
179
176
  end
180
177
  rescue
181
- output_params = {:code => 507, :result => "Unknown SDK error"}
178
+ output_params = {:code => 507, :result => 'Unknown SDK error'}
182
179
  end
183
- mongo_connector_wifi_1.audit_logger_wifi_1("add_mikrotik_ap_mobile_1", remote_ip, input_params, output_params, real_ip, subscriber_ip)
180
+ mongo_connector_wifi_1.audit_logger_wifi_1('add_mikrotik_ap_mobile_1', remote_ip, input_params, output_params, real_ip, subscriber_ip)
184
181
  #additional_func.printer_texter({:input_params => input_params, :output_params => output_params, :procedure => "add_mikrotik_ap_mobile", :file => "freewifi.rb"}, "info")
185
182
  output_params
186
183
  end
@@ -214,9 +211,9 @@ module Freewifi_1
214
211
  output_params = {:code => res[:code], :result => res[:result], :body => {:ap_configuration => conf_1}}
215
212
 
216
213
  rescue
217
- output_params = {:code => 507, :result => "Unknown SDK error"}
214
+ output_params = {:code => 507, :result => 'Unknown SDK error'}
218
215
  end
219
- mongo_connector_wifi_1.audit_logger_wifi_1("mtik_sch1_config_gen_1", remote_ip, input_params, conf_1, real_ip, subscriber_ip)
216
+ mongo_connector_wifi_1.audit_logger_wifi_1('mtik_sch1_config_gen_1', remote_ip, input_params, conf_1, real_ip, subscriber_ip)
220
217
  output_params
221
218
  end
222
219
 
@@ -246,10 +243,11 @@ module Freewifi_1
246
243
  def test()
247
244
  newcapsman1 = NEWhubWifi_1.new
248
245
 
246
+ capsman_ip = ['1.1.1.1']
249
247
  threads = []
250
248
  capsman_ip.each do |capsman|
251
249
  threads << Thread.new do
252
- newcapsman1.set_capsman_config_1("test_ss", capsman, capsman_user, capsman_password, "172.25.208.14", "test_company")
250
+ newcapsman1.set_capsman_config_1('test_ss', capsman, capsman_user, capsman_password, '172.25.208.14', 'test_company')
253
251
  end
254
252
  end
255
253
  threads.each(&:join)
@@ -273,8 +271,6 @@ class PortalFwifi_1
273
271
  :mtik_user,
274
272
  :mtik_password,
275
273
  :mongo_connector_wifi_1,
276
- :remote_ip,
277
- :real_ip,
278
274
  :telegram_api_url,
279
275
  :telegram_chat_id,
280
276
  :mongo_ip,
@@ -297,14 +293,17 @@ class PortalFwifi_1
297
293
  mongo_ip,
298
294
  mongo_port,
299
295
  mongo_database,
300
- remote_ip,
301
- real_ip,
302
296
  hua_wlc_1_ip,
303
297
  hua_wlc_2_ip,
304
298
  hua_wlc_login,
305
299
  hua_wlc_password,
306
300
  telegram_api_url,
307
- telegram_chat_id
301
+ telegram_chat_id,
302
+ iwag2_host,
303
+ iwag2_username,
304
+ iwag2_password,
305
+ iwag1_port=22,
306
+ iwag2_port=22
308
307
  )
309
308
 
310
309
  @general_procedures = WiFiPortal_1.new(apigw_wsdl,
@@ -315,19 +314,22 @@ class PortalFwifi_1
315
314
  iwag1_host,
316
315
  iwag_username,
317
316
  iwag_password,
317
+ iwag1_port,
318
318
  mtik_control_ips_get,
319
319
  mtik_user,
320
320
  mtik_password,
321
321
  hua_wlc_1_ip,
322
322
  hua_wlc_2_ip,
323
323
  hua_wlc_login,
324
- hua_wlc_password
324
+ hua_wlc_password,
325
+ iwag2_host,
326
+ iwag2_username,
327
+ iwag2_password,
328
+ iwag2_port
325
329
  )
326
330
  @mtik_control_ips_get = mtik_control_ips_get
327
331
  @mtik_user = mtik_user
328
332
  @mtik_password = mtik_password
329
- @remote_ip = remote_ip
330
- @real_ip = real_ip
331
333
  @additional_func_wifi_1 = InternalFunc_1.new
332
334
  @telegram_api_url = telegram_api_url
333
335
  @telegram_chat_id = telegram_chat_id
@@ -337,7 +339,7 @@ class PortalFwifi_1
337
339
  end
338
340
 
339
341
 
340
- def wifi_get_subs_info_return_1(ipaddress)
342
+ def wifi_get_subs_info_return_1(ipaddress, remote_ip, real_ip)
341
343
  input_params = {:ipaddress => ipaddress}
342
344
  output_params = {}
343
345
 
@@ -346,17 +348,48 @@ class PortalFwifi_1
346
348
  resp_procedure = general_procedures.get_subs_info_return_1(ipaddress)
347
349
  output_params = resp_procedure
348
350
  rescue
349
- output_params = {:code => 507, :result => "Unknown SDK error"}
351
+ output_params = {:code => 507, :result => 'Unknown SDK error'}
352
+ end
353
+ end
354
+ subs_info_ret_1_thr1.join
355
+
356
+ subs_info_ret_1_thr2 = Thread.new do
357
+ begin
358
+ p 'mongo'
359
+ #mongo_connector_wifi_1 = MongoWifiCl_1.new(mongo_ip, mongo_port, mongo_database)
360
+ #mongo_connector_wifi_1.audit_logger_wifi_portal_1("wifi_get_subs_info_return_1", remote_ip, input_params, output_params, real_ip)
361
+ rescue
362
+ additional_func_wifi_1.printer_texter_wifi_1({:input_params => input_params, :output_params => {:result => 'mongo failed'}, :procedure => 'wifi_get_subs_info_return_1', :file => 'freewifi.rb'}, 'debug')
363
+ additional_func_wifi_1.telegram_message_1("{:function => \"wifi_get_subs_info_return_1\", :result => \"failed communicate with mongo database\", :sdk => \"freewifi\"}", telegram_api_url, telegram_chat_id)
364
+ end
365
+ end
366
+ subs_info_ret_1_thr2.join
367
+
368
+ output_params
369
+ end
370
+
371
+
372
+ def wifi_get_subs_inf_ret_ssh_1(ipaddress, remote_ip, real_ip)
373
+ input_params = {:ipaddress => ipaddress}
374
+ output_params = {}
375
+
376
+ subs_info_ret_1_thr1 = Thread.new do
377
+ begin
378
+ resp_procedure = general_procedures.get_subs_info_ret_ssh_1(ipaddress)
379
+ output_params = resp_procedure
380
+ rescue
381
+ output_params = {:code => 507, :result => 'Unknown SDK error'}
350
382
  end
351
383
  end
352
384
  subs_info_ret_1_thr1.join
353
385
 
354
386
  subs_info_ret_1_thr2 = Thread.new do
355
387
  begin
356
- mongo_connector_wifi_1 = MongoWifiCl_1.new(mongo_ip, mongo_port, mongo_database)
357
- mongo_connector_wifi_1.audit_logger_wifi_portal_1("wifi_get_subs_info_return_1", remote_ip, input_params, output_params, real_ip)
388
+ p "mongo"
389
+ #mongo_connector_wifi_1 = MongoWifiCl_1.new(mongo_ip, mongo_port, mongo_database)
390
+ #mongo_connector_wifi_1.audit_logger_wifi_portal_1("wifi_get_subs_info_return_1", remote_ip, input_params, output_params, real_ip)
358
391
  rescue
359
- additional_func_wifi_1.printer_texter_wifi_1({:input_params => input_params, :output_params => {:result => "mongo failed"}, :procedure => "wifi_get_subs_info_return_1", :file => "freewifi.rb"}, "debug")
392
+ additional_func_wifi_1.printer_texter_wifi_1({:input_params => input_params, :output_params => {:result => "mongo failed"}, :procedure => "wifi_get_subs_info_return_1", :file => 'freewifi.rb'}, "debug")
360
393
  additional_func_wifi_1.telegram_message_1("{:function => \"wifi_get_subs_info_return_1\", :result => \"failed communicate with mongo database\", :sdk => \"freewifi\"}", telegram_api_url, telegram_chat_id)
361
394
  end
362
395
  end
@@ -27,7 +27,7 @@ class InternalFunc_1
27
27
  :body => {:telegram_resp => JSON.parse(body.to_s),
28
28
  :description => "Telegram message to telegram_chat_id: #{telegram_chat_id.to_s}"}}
29
29
  rescue
30
- return {:code => 507, :result => "Unknown SDK error"}
30
+ return {:code => 507, :result => 'Unknown SDK error'}
31
31
  end
32
32
  end
33
33
 
@@ -9,4 +9,5 @@ class CiscoSchemesGen_1
9
9
 
10
10
  end
11
11
 
12
- end
12
+ end
13
+
@@ -0,0 +1,91 @@
1
+ require 'net/ssh'
2
+
3
+ class IwagRequester
4
+
5
+ attr_accessor :iwag_host, :iwag_login, :iwag_password, :iwag_port
6
+
7
+ def initialize(iwag_host, iwag_login, iwag_password, iwag_port)
8
+ @iwag_host = iwag_host
9
+ @iwag_login = iwag_login
10
+ @iwag_password = iwag_password
11
+ @iwag_port = iwag_port
12
+ end
13
+
14
+ def mac_parse(mac)
15
+ a = mac.upcase
16
+ pos = a[0] + a[1]
17
+ if pos == "01"
18
+ subscribers_mac = a[2] + a[3] + ":" + a[5] + a[6] + ":" + a[7] + a[8] + ":" + a[10] + a[11] + ":" + a[12] + a[13] + ":" + a[15] + a[16]
19
+ else
20
+ subscribers_mac = a[0] + a[1] + ":" + a[2] + a[3] + ":" + a[5] + a[6] + ":" + a[7] + a[8] + ":" + a[10] + a[11] + ":" + a[12] + a[13]
21
+ end
22
+ subscribers_mac
23
+ end
24
+
25
+
26
+ def iwag_get_dhcp_binding_ssh(bind_ip)
27
+ mac = "Unknown"
28
+ accessinterface = "Unknown"
29
+ hostname = "Unknown"
30
+ ssid = "Unknown"
31
+ iwag_thr = Thread.new do
32
+ Net::SSH.start(iwag_host, iwag_login, :password => iwag_password, :port=>iwag_port) do |session|
33
+ answ_bind = session.exec!("show ip dhcp binding #{bind_ip}")
34
+ regexp_main = /\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\s{1,20}(\w{2,4}.\w{2,4}.\w{2,4}.\w{2,4})|\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\s{1,20}(\w{4}.\w{4}.\w{4})/
35
+ #regexp_main = /\r\n(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})\s+(\S{13,18})\s+Sep 18 2020 07:44 PM\s+Automatic\s+Active\s+Tunnel201\r\n/
36
+ ggg7 = answ_bind.match(regexp_main)
37
+ begin
38
+ if ggg7[1] != nil
39
+ mac = mac_parse(ggg7[1])
40
+ else
41
+ mac = mac_parse(ggg7[2])
42
+ end
43
+ rescue
44
+ mac = "Unknown"
45
+ end
46
+ regexp_remote_id = /Remote id :\s(\S{2,100})/
47
+ regexp_tunnel = /Active\s{2,40}(\S{2,40})|Selecting\s{2,40}(\S{2,40})/
48
+ regexp_curcuit_id = /Circuit id :\s(\S{2,100})/
49
+ ggg9 = answ_bind.match(regexp_tunnel)
50
+
51
+ begin
52
+ if ggg9[1] != nil
53
+ accessinterface = ggg9[1]
54
+ else
55
+ accessinterface = ggg9[2]
56
+ end
57
+ rescue
58
+ accessinterface = "Unknown"
59
+ end
60
+ ggg8 = answ_bind.match(regexp_remote_id)
61
+ ggg10 = answ_bind.match(regexp_curcuit_id)
62
+ begin
63
+ a1 = ggg8[1].split(":")
64
+ hostname = a1[0]
65
+ ssid = a1[1]
66
+ rescue
67
+ begin
68
+ if ggg8[1] != nil
69
+ if ggg8[1].include?("wireless_public_interface")
70
+ hostname = ggg10[1]
71
+ ssid = "Unknown"
72
+ else
73
+ hostname = ggg8[1]
74
+ ssid = "Unknown"
75
+ end
76
+ else
77
+ ssid = "Unknown"
78
+ hostname = "Unknown"
79
+ end
80
+ rescue
81
+ ssid = "Unknown"
82
+ hostname = "Unknown"
83
+ end
84
+ end
85
+ end
86
+ end
87
+ iwag_thr.join
88
+ {"mac": mac, "iwaginterface": accessinterface, "aphostname": hostname, "SSID": ssid}
89
+ end
90
+
91
+ end
@@ -0,0 +1,24 @@
1
+
2
+
3
+ class IwagDbCache
4
+
5
+ attr_accessor :db_host, :db_login, :db_password
6
+
7
+ def initialize(db_host, db_login, db_password)
8
+ @db_host = db_host
9
+ @db_login = db_login
10
+ @db_password = db_password
11
+ end
12
+
13
+ def check_db_exists(ip)
14
+
15
+ end
16
+
17
+
18
+ def insert_new_cache()
19
+
20
+ end
21
+
22
+
23
+ end
24
+
@@ -1,5 +1,6 @@
1
1
  require 'net-telnet'
2
2
  require 'net/ssh'
3
+ require 'date'
3
4
 
4
5
  class CSRtelnet_1
5
6
 
@@ -15,17 +16,19 @@ class CSRtelnet_1
15
16
 
16
17
  subscribers_mac = ""
17
18
 
18
- begin
19
+ #begin
19
20
 
20
21
  dump =""
21
- connection = Net::Telnet.new( "Host" => "172.24.247.183", "Timeout" => false, "Prompt" => /.*\#/ ) { |str| }
22
+ connection = Net::Telnet.new( "Host" => iwag1_host, "Timeout" => false, "Prompt" => /.*#/ ) { |str| }
22
23
  connection.login({ "Name" => iwag_username, "Password" => iwag_password, "LoginPrompt" => /Username:/ }) { |str| }
23
24
  connection.cmd("show ip dhcp binding #{ipaddress}") {
24
25
  |c|
26
+ p c
25
27
  dump << c
26
28
  }
27
29
  connection.close
28
30
  as = dump.split("\n")
31
+ p as
29
32
  reer = as[4].split(" ")
30
33
 
31
34
  ma = reer[1].to_s.upcase
@@ -37,15 +40,26 @@ class CSRtelnet_1
37
40
  end
38
41
 
39
42
 
40
- rescue
41
- subscribers_mac = "unknown"
42
- end
43
+ #rescue
44
+ # subscribers_mac = "unknown"
45
+ #end
43
46
 
44
47
  return subscribers_mac
45
48
 
46
49
  end
47
50
 
48
51
 
52
+ #test function. Not used
53
+ def get_iwag_info_ssh_1(ipaddress)
54
+ p DateTime.now
55
+ Net::SSH.start(iwag1_host, iwag_username, :password => iwag_password) do |ssh|
56
+ result = ssh.exec!("show ip dhcp binding #{ipaddress}\n")
57
+ p result
58
+ end
59
+ p DateTime.now
60
+ end
61
+
62
+
49
63
 
50
64
  def return_iwag_access_interface_1(ipaddress)
51
65
  host_iwag = iwag1_host
@@ -55,7 +69,7 @@ class CSRtelnet_1
55
69
 
56
70
  dump =""
57
71
  begin
58
- connection = Net::Telnet.new("Host" => host_iwag, "Timeout" => false, "Prompt" => /.*\#/) {|str| print str}
72
+ connection = Net::Telnet.new("Host" => host_iwag, "Timeout" => false, "Prompt" => /.*#/) {|str| print str}
59
73
  connection.login({"Name" => username_iwag, "Password" => password_iwag, "LoginPrompt" => /Username:/}) {|str| print str}
60
74
  connection.cmd("show ip dhcp binding #{ipaddress}") {
61
75
  |c|
@@ -73,7 +87,7 @@ class CSRtelnet_1
73
87
  end
74
88
  rescue
75
89
  begin
76
- connection = Net::Telnet.new("Host" => host_iwag, "Timeout" => false, "Prompt" => /.*\#/) {|str| print str}
90
+ connection = Net::Telnet.new("Host" => host_iwag, "Timeout" => false, "Prompt" => /.*#/) {|str| print str}
77
91
  connection.login({"Name" => username_iwag, "Password" => password_iwag, "LoginPrompt" => /Username:/}) {|str| print str}
78
92
  connection.cmd("show ip dhcp binding #{ipaddress}") {
79
93
  |c|