freewifi 0.2.2 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
File without changes
data/CODE_OF_CONDUCT.md CHANGED
File without changes
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
 
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
data/freewifi.gemspec CHANGED
@@ -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
@@ -23,11 +23,11 @@ class InternalFunc_1
23
23
  response_mess = https_connector.request(request_mess)
24
24
  body = response_mess.body
25
25
  return {:code => 200,
26
- :result => "Request completed successfully",
26
+ :result => 'Request completed successfully',
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
 
File without changes
@@ -2,12 +2,13 @@ require 'net/ssh'
2
2
 
3
3
  class IwagRequester
4
4
 
5
- attr_accessor :iwag_host, :iwag_login, :iwag_password
5
+ attr_accessor :iwag_host, :iwag_login, :iwag_password, :iwag_port
6
6
 
7
- def initialize(iwag_host, iwag_login, iwag_password)
7
+ def initialize(iwag_host, iwag_login, iwag_password, iwag_port)
8
8
  @iwag_host = iwag_host
9
9
  @iwag_login = iwag_login
10
10
  @iwag_password = iwag_password
11
+ @iwag_port = iwag_port
11
12
  end
12
13
 
13
14
  def mac_parse(mac)
@@ -28,7 +29,7 @@ class IwagRequester
28
29
  hostname = "Unknown"
29
30
  ssid = "Unknown"
30
31
  iwag_thr = Thread.new do
31
- Net::SSH.start(iwag_host, iwag_login, :password => iwag_password) do |session|
32
+ Net::SSH.start(iwag_host, iwag_login, :password => iwag_password, :port=>iwag_port) do |session|
32
33
  answ_bind = session.exec!("show ip dhcp binding #{bind_ip}")
33
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})/
34
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/
@@ -88,12 +89,3 @@ class IwagRequester
88
89
  end
89
90
 
90
91
  end
91
-
92
-
93
- hhh = IwagRequester.new("172.24.223.149", "soapgw2", "eb5Swd8Yhq2Snd3eD")
94
-
95
- p hhh.iwag_get_dhcp_binding_ssh("100.75.15.127")
96
-
97
-
98
-
99
-
@@ -15,6 +15,10 @@ class IwagDbCache
15
15
  end
16
16
 
17
17
 
18
+ def insert_new_cache()
19
+
20
+ end
21
+
18
22
 
19
23
  end
20
24
 
@@ -19,7 +19,7 @@ class CSRtelnet_1
19
19
  #begin
20
20
 
21
21
  dump =""
22
- connection = Net::Telnet.new( "Host" => iwag1_host, "Timeout" => false, "Prompt" => /.*\#/ ) { |str| }
22
+ connection = Net::Telnet.new( "Host" => iwag1_host, "Timeout" => false, "Prompt" => /.*#/ ) { |str| }
23
23
  connection.login({ "Name" => iwag_username, "Password" => iwag_password, "LoginPrompt" => /Username:/ }) { |str| }
24
24
  connection.cmd("show ip dhcp binding #{ipaddress}") {
25
25
  |c|
@@ -69,7 +69,7 @@ class CSRtelnet_1
69
69
 
70
70
  dump =""
71
71
  begin
72
- 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}
73
73
  connection.login({"Name" => username_iwag, "Password" => password_iwag, "LoginPrompt" => /Username:/}) {|str| print str}
74
74
  connection.cmd("show ip dhcp binding #{ipaddress}") {
75
75
  |c|
@@ -87,7 +87,7 @@ class CSRtelnet_1
87
87
  end
88
88
  rescue
89
89
  begin
90
- 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}
91
91
  connection.login({"Name" => username_iwag, "Password" => password_iwag, "LoginPrompt" => /Username:/}) {|str| print str}
92
92
  connection.cmd("show ip dhcp binding #{ipaddress}") {
93
93
  |c|
@@ -1,5 +1,5 @@
1
1
  module Freewifi_1
2
- LOGLEVEL_1 = "debug"
2
+ LOGLEVEL_1 = 'debug'
3
3
 
4
4
  end
5
5
 
File without changes
File without changes
@@ -21,49 +21,58 @@ class WiFiPortal_1
21
21
  :mtik_api_connector,
22
22
  :hua_controller_connector,
23
23
  :iwag_connector1,
24
- :iwag_connector2
25
-
26
- def initialize(apigw_wsdl,
27
- apigw_endpoint,
28
- apigw_namespace,
29
- apigw_wsse_aut_log,
30
- apigw_wsse_aut_pass,
31
- iwag1_host,
32
- iwag_username,
33
- iwag_password,
34
- mtik_control_ips_get,
35
- mtik_user,
36
- mtik_password,
37
- hua_wlc_1_ip,
38
- hua_wlc_2_ip,
39
- hua_wlc_login,
40
- hua_wlc_password,
41
- iwag2_host,
42
- iwag2_username,
43
- iwag2_password)
44
- @iwag_telnet_connector = CSRtelnet_1.new(iwag1_host, iwag_username, iwag_password)
45
- @ard_api_gw_connector_wifi = Savon.client do
46
- #ssl_verify_mode :none
47
- wsdl apigw_wsdl
48
- endpoint apigw_endpoint
49
- namespace apigw_namespace
50
- wsse_auth(apigw_wsse_aut_log, apigw_wsse_aut_pass, :digest)
51
- encoding 'UTF-8'
52
- headers = {"Accept-Encoding" => "gzip, deflate", "Connection" => "Keep-Alive"}
53
- end
24
+ :iwag_connector2,
25
+ :protocol_mtik,
26
+ :mtik_capsman_list
27
+
28
+ def initialize(apigw_wsdl,
29
+ apigw_endpoint,
30
+ apigw_namespace,
31
+ apigw_wsse_aut_log,
32
+ apigw_wsse_aut_pass,
33
+ iwag1_host,
34
+ iwag1_username,
35
+ iwag1_password,
36
+ iwag1_port,
37
+ mtik_control_ips_get,
38
+ mtik_user,
39
+ mtik_password,
40
+ hua_wlc_1_ip,
41
+ hua_wlc_2_ip,
42
+ hua_wlc_login,
43
+ hua_wlc_password,
44
+ iwag2_host,
45
+ iwag2_username,
46
+ iwag2_password,
47
+ iwag2_port,
48
+ protocol_mtik,
49
+ mtik_capsman_list
50
+ )
51
+ @iwag_telnet_connector = CSRtelnet_1.new(iwag1_host, iwag1_username, iwag1_password)
52
+ @ard_api_gw_connector_wifi = Savon.client do
53
+ #ssl_verify_mode :none
54
+ wsdl apigw_wsdl
55
+ endpoint apigw_endpoint
56
+ namespace apigw_namespace
57
+ wsse_auth(apigw_wsse_aut_log, apigw_wsse_aut_pass, :digest)
58
+ encoding 'UTF-8'
59
+ headers = {"Accept-Encoding" => "gzip, deflate", "Connection" => "Keep-Alive"}
60
+ end
54
61
 
55
- @iwag1_host = iwag1_host
56
- @iwag_username = iwag_username
57
- @iwag_password = iwag_password
62
+ @iwag1_host = iwag1_host
63
+ @iwag_username = iwag1_username
64
+ @iwag_password = iwag1_password
58
65
 
59
- @mtik_api_connector = NEWhubWifiApi_1.new(mtik_control_ips_get, mtik_user, mtik_password)
66
+ @mtik_api_connector = NEWhubWifiApi_1.new(mtik_control_ips_get, mtik_user, mtik_password)
60
67
 
61
- @hua_controller_connector = HuaWifi_1.new(hua_wlc_1_ip, hua_wlc_2_ip, hua_wlc_login, hua_wlc_password)
68
+ @hua_controller_connector = HuaWifi_1.new(hua_wlc_1_ip, hua_wlc_2_ip, hua_wlc_login, hua_wlc_password)
62
69
 
63
- @iwag_connector1 = IwagRequester.new(iwag1_host, iwag_username, iwag_password)
64
- @iwag_connector2 = IwagRequester.new(iwag2_host, iwag2_username, iwag2_password)
70
+ @iwag_connector1 = IwagRequester.new(iwag1_host, iwag1_username, iwag1_password, iwag1_port)
71
+ @iwag_connector2 = IwagRequester.new(iwag2_host, iwag2_username, iwag2_password, iwag2_port)
65
72
 
66
- end
73
+ @protocol_mtik = protocol_mtik
74
+ @mtik_capsman_list = mtik_capsman_list
75
+ end
67
76
 
68
77
 
69
78
  def python_mac_iwag1_1(ipaddress)
@@ -122,7 +131,7 @@ class WiFiPortal_1
122
131
  begin
123
132
 
124
133
  dump =""
125
- connection = Net::Telnet.new("Host" => "172.24.247.183", "Timeout" => false, "Prompt" => /.*\#/) {|str|}
134
+ connection = Net::Telnet.new("Host" => "172.24.247.183", "Timeout" => false, "Prompt" => /.*#/) {|str|}
126
135
  connection.login({"Name" => iwag_username, "Password" => iwag_password, "LoginPrompt" => /Username:/}) {|str|}
127
136
  connection.cmd("show ip dhcp binding #{ipaddress}") {
128
137
  |c|
@@ -249,13 +258,7 @@ class WiFiPortal_1
249
258
 
250
259
  def get_subs_add_info4new_1(access_interface, subscribers_mac)
251
260
 
252
- capsman_list = [
253
- "172.24.247.15",
254
- "172.24.214.155",
255
- "172.24.214.140",
256
- "172.24.214.105",
257
- "172.24.223.105"
258
- ]
261
+ capsman_list = mtik_capsman_list
259
262
 
260
263
  answer = ""
261
264
 
@@ -268,11 +271,27 @@ class WiFiPortal_1
268
271
  capsman_list.each do |capsman|
269
272
  threads_mikro_wlc << Thread.new do
270
273
  begin
271
- p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, capsman)
272
- splitting5 = mikr_info5.split("---")
273
- if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil
274
- answer = mikr_info5
275
- p answer
274
+ if protocol_mtik == 'api'
275
+ p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, capsman)
276
+ splitting5 = mikr_info5.split("---")
277
+ if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil
278
+ answer = mikr_info5
279
+ p answer
280
+ end
281
+ elsif protocol_mtik == 'ssh'
282
+ p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_ssh(subscribers_mac, capsman)
283
+ splitting5 = mikr_info5.split("---")
284
+ if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil
285
+ answer = mikr_info5
286
+ p answer
287
+ end
288
+ else
289
+ p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, capsman)
290
+ splitting5 = mikr_info5.split("---")
291
+ if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil
292
+ answer = mikr_info5
293
+ p answer
294
+ end
276
295
  end
277
296
  rescue
278
297
  p "thr0 wrong"
File without changes
File without changes
File without changes
@@ -1,4 +1,5 @@
1
1
  require 'mtik'
2
+ require 'net/ssh'
2
3
 
3
4
  class NEWhubWifiApi_1
4
5
 
@@ -11,89 +12,184 @@ class NEWhubWifiApi_1
11
12
  end
12
13
 
13
14
 
14
- def get_info_subs_from_mik_1(subs_mac, controllers_ip)
15
- input_parameters = {:subs_mac => subs_mac, :controllers_ip => controllers_ip}
16
- #region get additional information
17
-
18
- subscribers_mac = subs_mac
19
- access_point =""
20
- ssid_ap =""
21
- tx_rate_set = ""
22
- tx_rate = ""
23
- rx_rate = ""
24
- rx_signal = ""
25
- uptime = ""
26
- packets = ""
27
- bytes = ""
28
-
29
- MTik::verbose = false
30
- mikrot_connection1 = MTik::Connection.new :host => controllers_ip, :user => mtik_user, :pass => mtik_password, :conn_timeout => 7, :cmd_timeout => 7
31
- mikrot_connection1.get_reply('/caps-man/registration-table/getall') do |req, sentence|
32
-
33
- req.reply.each do |reply|
34
- if reply.key?('mac-address')
35
- #p reply
36
- if reply['mac-address'] == subscribers_mac
37
-
38
- access_point = reply['interface']
39
- ssid_ap = reply['ssid']
40
- tx_rate = reply['tx-rate']
41
- rx_rate = reply['rx-rate']
42
- rx_signal = reply['rx-signal']
43
- uptime = reply['uptime']
44
- packets = reply['packets']
45
- bytes = reply['bytes']
46
- tx_rate_set = reply['tx-rate-set']
15
+ def get_info_subs_from_mik_1(subs_mac, controllers_ip)
16
+ input_parameters = {:subs_mac => subs_mac, :controllers_ip => controllers_ip}
17
+ #region get additional information
18
+
19
+ subscribers_mac = subs_mac
20
+ access_point =""
21
+ ssid_ap =""
22
+ tx_rate_set = ""
23
+ tx_rate = ""
24
+ rx_rate = ""
25
+ rx_signal = ""
26
+ uptime = ""
27
+ packets = ""
28
+ bytes = ""
29
+
30
+ MTik::verbose = false
31
+ mikrot_connection1 = MTik::Connection.new :host => controllers_ip, :user => mtik_user, :pass => mtik_password, :conn_timeout => 7, :cmd_timeout => 7
32
+ mikrot_connection1.get_reply('/caps-man/registration-table/getall') do |req, sentence|
33
+
34
+ req.reply.each do |reply|
35
+ if reply.key?('mac-address')
36
+ #p reply
37
+ if reply['mac-address'] == subscribers_mac
38
+
39
+ access_point = reply['interface']
40
+ ssid_ap = reply['ssid']
41
+ tx_rate = reply['tx-rate']
42
+ rx_rate = reply['rx-rate']
43
+ rx_signal = reply['rx-signal']
44
+ uptime = reply['uptime']
45
+ packets = reply['packets']
46
+ bytes = reply['bytes']
47
+ tx_rate_set = reply['tx-rate-set']
48
+ end
47
49
  end
48
50
  end
49
51
  end
50
- end
51
52
 
52
- if access_point=="" || ssid_ap=="" || packets==""
53
- access_point = "not on mikrotik controller"
54
- ssid_ap = "unknown"
55
- tx_rate_set = "unknown"
56
- tx_rate = "0"
57
- rx_rate = "0"
58
- rx_signal = "0"
59
- uptime = "0"
60
- packets = "0"
61
- bytes = "0"
62
- end
53
+ if access_point=="" || ssid_ap=="" || packets==""
54
+ access_point = "not on mikrotik controller"
55
+ ssid_ap = "unknown"
56
+ tx_rate_set = "unknown"
57
+ tx_rate = "0"
58
+ rx_rate = "0"
59
+ rx_signal = "0"
60
+ uptime = "0"
61
+ packets = "0"
62
+ bytes = "0"
63
+ end
64
+
65
+ if access_point==nil
66
+ access_point= "unknown"
67
+ end
68
+ if ssid_ap==nil
69
+ ssid_ap= "unknown"
70
+ end
71
+ if tx_rate_set==nil
72
+ tx_rate_set= "unknown"
73
+ end
74
+ if tx_rate==nil
75
+ tx_rate= "unknown"
76
+ end
77
+ if rx_rate==nil
78
+ rx_rate= "unknown"
79
+ end
80
+ if rx_signal==nil
81
+ rx_signal= "unknown"
82
+ end
83
+ if uptime==nil
84
+ uptime= "unknown"
85
+ end
86
+ if packets==nil
87
+ packets= "unknown"
88
+ end
89
+ if bytes==nil
90
+ bytes= "unknown"
91
+ end
92
+
93
+ #endregion
94
+ subscribers_mac+ "---" + access_point + "---" + ssid_ap + "---" + tx_rate_set + "---"+ tx_rate + "---"+ rx_rate + "---"+ rx_signal + "---"+ uptime + "---"+ packets + "---"+ bytes
63
95
 
64
- if access_point==nil
65
- access_point= "unknown"
66
- end
67
- if ssid_ap==nil
68
- ssid_ap= "unknown"
69
- end
70
- if tx_rate_set==nil
71
- tx_rate_set= "unknown"
72
- end
73
- if tx_rate==nil
74
- tx_rate= "unknown"
75
- end
76
- if rx_rate==nil
77
- rx_rate= "unknown"
78
- end
79
- if rx_signal==nil
80
- rx_signal= "unknown"
81
- end
82
- if uptime==nil
83
- uptime= "unknown"
84
- end
85
- if packets==nil
86
- packets= "unknown"
87
- end
88
- if bytes==nil
89
- bytes= "unknown"
90
96
  end
91
97
 
92
- #endregion
93
- answ = subscribers_mac+ "---" + access_point + "---" + ssid_ap + "---" + tx_rate_set + "---"+ tx_rate + "---"+ rx_rate + "---"+ rx_signal + "---"+ uptime + "---"+ packets + "---"+ bytes
94
98
 
95
- answ
96
99
 
97
- end
100
+ def get_info_subs_from_mik_ssh(subs_mac, controllers_ip)
101
+ input_parameters = {:subs_mac => subs_mac, :controllers_ip => controllers_ip}
102
+ #region get additional information
103
+
104
+
105
+ subscribers_mac = subs_mac
106
+ access_point =""
107
+ ssid_ap =""
108
+ tx_rate_set = ""
109
+ tx_rate = ""
110
+ rx_rate = ""
111
+ rx_signal = ""
112
+ uptime = ""
113
+ packets = ""
114
+ bytes = ""
115
+
116
+ begin
117
+ Net::SSH.start(controllers_ip, mtik_user, :password => mtik_password) do |ssh|
118
+ #result = ssh.exec!("/interface eoip print where tunnel-id=#{tunnel_id}")
119
+ #p result
120
+ result = ssh.exec!("/caps-man registration-table print detail value-list where mac-address=#{subs_mac}")
121
+ p result
122
+ access_point_reg = /interface:\s(.+)\r\n/
123
+ access_point = result.scan(access_point_reg)[0][0]
124
+ ssid_reg = /ssid:\s(.+)\r\n/
125
+ ssid_ap = result.scan(ssid_reg)[0][0]
126
+
127
+ tx_rate_set = "unknown"
128
+ tx_rate = "0"
129
+ rx_rate = "0"
130
+ rx_signal = "0"
131
+ uptime = "0"
132
+ packets = "0"
133
+ bytes = "0"
134
+
135
+ p access_point
136
+ p ssid_ap
137
+ #regimsi = /\s+name="(.+)"\s+/
138
+ #m1 = regimsi.match(result)[1]
139
+
140
+ #result2 = ssh.exec!("interface bridge port add bridge=#{bridge_name} interface=#{tunnel_name}")
141
+ end
142
+ #Net::SSH.stop
143
+ rescue
144
+ nil
145
+ end
146
+
147
+ p "1111111111111111111"
148
+
149
+ if access_point=="" || ssid_ap=="" || packets==""
150
+ access_point = "not on mikrotik controller"
151
+ ssid_ap = "unknown"
152
+ tx_rate_set = "unknown"
153
+ tx_rate = "0"
154
+ rx_rate = "0"
155
+ rx_signal = "0"
156
+ uptime = "0"
157
+ packets = "0"
158
+ bytes = "0"
159
+ end
160
+
161
+ if access_point==nil || access_point==''
162
+ access_point= "unknown"
163
+ end
164
+ if ssid_ap==nil || ssid_ap==''
165
+ ssid_ap= "unknown"
166
+ end
167
+ if tx_rate_set==nil || tx_rate_set==''
168
+ tx_rate_set= "unknown"
169
+ end
170
+ if tx_rate==nil || tx_rate==''
171
+ tx_rate= "unknown"
172
+ end
173
+ if rx_rate==nil || rx_rate==''
174
+ rx_rate= "unknown"
175
+ end
176
+ if rx_signal==nil || rx_signal==''
177
+ rx_signal= "unknown"
178
+ end
179
+ if uptime==nil || uptime==''
180
+ uptime= "unknown"
181
+ end
182
+ if packets==nil || packets==''
183
+ packets= "unknown"
184
+ end
185
+ if bytes==nil || bytes==''
186
+ bytes= "unknown"
187
+ end
188
+
189
+ #endregion
190
+ subscribers_mac+ "---" + access_point + "---" + ssid_ap + "---" + tx_rate_set + "---"+ tx_rate + "---"+ rx_rate + "---"+ rx_signal + "---"+ uptime + "---"+ packets + "---"+ bytes
191
+
192
+ end
193
+
98
194
 
99
195
  end