freewifi 0.2.1 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -25,7 +25,7 @@ class NEWhubWifi_1
25
25
  #result = ssh.exec!("/interface eoip print where tunnel-id=#{tunnel_id}")
26
26
  #p result
27
27
  result = ssh.exec!("/interface eoip print where tunnel-id=#{tunnel_id}")
28
- regimsi = /\s+name=\"(.+)\"\s+/
28
+ regimsi = /\s+name="(.+)"\s+/
29
29
  m1 = regimsi.match(result)[1]
30
30
  sleep 0.2
31
31
  result2 = ssh.exec!("/interface bridge port remove [/interface bridge port find interface=#{m1}]")
@@ -42,7 +42,7 @@ class NEWhubWifi_1
42
42
  begin
43
43
  Net::SSH.start(hub2, user_hub, :password => password_hub) do |ssh|
44
44
  result = ssh.exec!("/interface eoip print where tunnel-id=#{tunnel_id}")
45
- regimsi = /\s+name=\"(.+)\"\s+/
45
+ regimsi = /\s+name="(.+)"\s+/
46
46
  m1 = regimsi.match(result)[1]
47
47
  sleep 0.2
48
48
  result2 = ssh.exec!("/interface bridge port remove [/interface bridge port find interface=#{m1}]")
@@ -222,12 +222,12 @@ class NEWhubWifi_1
222
222
  end
223
223
  end
224
224
  end
225
- output_params = {:code => 200, :result => "check_pool_range_includes_1: Request processed", :body => {:result => res}}
225
+ output_params = {:code => 200, :result => 'check_pool_range_includes_1: Request processed', :body => {:result => res}}
226
226
  rescue
227
- output_params = {:code => 507, :result => "check_pool_range_includes_1: Unknown SDK error"}
227
+ output_params = {:code => 507, :result => 'check_pool_range_includes_1: Unknown SDK error'}
228
228
  end
229
229
 
230
- additional_func_wifi_1.printer_texter_wifi_1({:input_params => input_params, :output_params => output_params, :procedure => "check_pool_range_includes_1", :file => "freewifi/mikrotik/newhub_mtik_ssh.rb", :sdk => "freewifi"}, "debug")
230
+ additional_func_wifi_1.printer_texter_wifi_1({:input_params => input_params, :output_params => output_params, :procedure => 'check_pool_range_includes_1', :file => 'freewifi/mikrotik/newhub_mtik_ssh.rb', :sdk => 'freewifi'}, 'debug')
231
231
  output_params
232
232
  end
233
233
 
@@ -245,7 +245,7 @@ class NEWhubWifi_1
245
245
 
246
246
  command_provisioning_24ghz = "/caps-man provisioning add hw-supported-modes=b,g,gn ip-address-ranges=#{ap_ip} action=create-dynamic-enabled place-before=30 master-configuration=#{conf_24ghz_name} name-format=identity"
247
247
 
248
- command_provisioning_5ghz = "/caps-man provisioning add hw-supported-modes=a,ac,an ip-address-ranges=#{ap_ip} action=create-dynamic-enabled place-before=30 master-configuration=#{conf_24ghz_name} name-format=identity"
248
+ command_provisioning_5ghz = "/caps-man provisioning add hw-supported-modes=a,ac,an ip-address-ranges=#{ap_ip} action=create-dynamic-enabled place-before=30 master-configuration=#{conf_5ghz_name} name-format=identity"
249
249
 
250
250
  Net::SSH.start(capsman1, capsman_user1, :password => capsman_pass1) do |ssh|
251
251
  result = ssh.exec!(command_conf_24ghz)
@@ -270,8 +270,8 @@ class NEWhubWifi_1
270
270
  result = ssh.exec!(command)
271
271
  s1 = result.split("\r\n\r\n")
272
272
  for a in s1
273
- a1 = a.gsub("\r\n", "")
274
- a2 = a1.gsub(", ", ",")
273
+ a1 = a.gsub("\r\n", '')
274
+ a2 = a1.gsub(', ', ',')
275
275
  reg_addr_range = / (\d) .+ ip-address-ranges=(\d{1,3}.+\.\d{1,3}|\d{1,3}.+\.\d{1,3}\/\d{1,2})\s+/
276
276
  m1 = a2.scan(reg_addr_range)
277
277
  num = m1[0][0]
@@ -280,7 +280,7 @@ class NEWhubWifi_1
280
280
  final_provision_old << triplet
281
281
  exists_check = self.check_pool_range_includes_1(triplet[1], ap_ip)
282
282
 
283
- if exists_check[:body][:result] != "exists"
283
+ if exists_check[:body][:result] != 'exists'
284
284
  #self.capsman_set_ip_range_1(capsman1, capsman_user1, capsman_pass1, ap_ip)
285
285
  #set data to capsman
286
286
  rewrite_ip_command = "/caps-man provisioning set numbers=#{triplet[0]} ip-address-ranges=#{triplet[1]},#{ap_ip}"
@@ -314,7 +314,7 @@ class NEWhubWifi_1
314
314
  else
315
315
  p result
316
316
  conf_names = []
317
- reg_config_name = /name=\"(\S+)\"/
317
+ reg_config_name = /name="(\S+)"/
318
318
  m1 = result.scan(reg_config_name)
319
319
  for a1 in m1
320
320
  if a1[0] != []
@@ -326,7 +326,7 @@ class NEWhubWifi_1
326
326
  end
327
327
  end
328
328
  rescue
329
- output_params = {:code => 507, :result => "set_capsman_config_1: Unknown SDK error"}
329
+ output_params = {:code => 507, :result => 'set_capsman_config_1: Unknown SDK error'}
330
330
  end
331
331
 
332
332
  additional_func_wifi_1.printer_texter_wifi_1({:input_params => input_params, :output_params => output_params, :procedure => "set_capsman_config_1", :file => "freewifi/mikrotik/newhub_mtik_ssh.rb", :sdk => "freewifi"}, "debug")
@@ -15,9 +15,9 @@ class MtikSchemesGen_1
15
15
 
16
16
  [
17
17
  "/system identity set name=#{hostname}",
18
- "/interface bridge add name=bridge_tunnel",
18
+ '/interface bridge add name=bridge_tunnel',
19
19
  "/interface eoip add remote-address=#{hub_vip.to_s} tunnel-id=#{tunnel_id.to_s} name=tunnel_to_hub",
20
- "/interface bridge port add interface=tunnel_to_hub bridge=bridge_tunnel",
20
+ '/interface bridge port add interface=tunnel_to_hub bridge=bridge_tunnel',
21
21
  "/interface bridge port add interface=wlan1 bridge=bridge_tunnel",
22
22
  "/interface wireless set wlan1 mode=ap-bridge ssid=#{ap_ssid} disabled=no name=wireless_public_interface frequency=2442",
23
23
  "/interface ppp-client set ppp-out1 apn=vpn pin=1111 disabled=no",
File without changes
@@ -1,3 +1,3 @@
1
1
  module Freewifi_1
2
- VERSION = "0.2.1"
2
+ VERSION = '0.2.5'
3
3
  end
data/lib/freewifi.rb CHANGED
@@ -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)
@@ -300,7 +298,14 @@ class PortalFwifi_1
300
298
  hua_wlc_login,
301
299
  hua_wlc_password,
302
300
  telegram_api_url,
303
- telegram_chat_id
301
+ telegram_chat_id,
302
+ iwag2_host,
303
+ iwag2_username,
304
+ iwag2_password,
305
+ iwag1_port=22,
306
+ iwag2_port=22,
307
+ protocol_mtik='api',
308
+ mtik_capsman_list
304
309
  )
305
310
 
306
311
  @general_procedures = WiFiPortal_1.new(apigw_wsdl,
@@ -311,13 +316,20 @@ class PortalFwifi_1
311
316
  iwag1_host,
312
317
  iwag_username,
313
318
  iwag_password,
319
+ iwag1_port,
314
320
  mtik_control_ips_get,
315
321
  mtik_user,
316
322
  mtik_password,
317
323
  hua_wlc_1_ip,
318
324
  hua_wlc_2_ip,
319
325
  hua_wlc_login,
320
- hua_wlc_password
326
+ hua_wlc_password,
327
+ iwag2_host,
328
+ iwag2_username,
329
+ iwag2_password,
330
+ iwag2_port,
331
+ protocol_mtik,
332
+ mtik_capsman_list
321
333
  )
322
334
  @mtik_control_ips_get = mtik_control_ips_get
323
335
  @mtik_user = mtik_user
@@ -340,18 +352,48 @@ class PortalFwifi_1
340
352
  resp_procedure = general_procedures.get_subs_info_return_1(ipaddress)
341
353
  output_params = resp_procedure
342
354
  rescue
343
- output_params = {:code => 507, :result => "Unknown SDK error"}
355
+ output_params = {:code => 507, :result => 'Unknown SDK error'}
344
356
  end
345
357
  end
346
358
  subs_info_ret_1_thr1.join
347
359
 
348
360
  subs_info_ret_1_thr2 = Thread.new do
349
361
  begin
350
- p "mongo"
362
+ p 'mongo'
351
363
  #mongo_connector_wifi_1 = MongoWifiCl_1.new(mongo_ip, mongo_port, mongo_database)
352
364
  #mongo_connector_wifi_1.audit_logger_wifi_portal_1("wifi_get_subs_info_return_1", remote_ip, input_params, output_params, real_ip)
353
365
  rescue
354
- 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")
366
+ 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')
367
+ 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)
368
+ end
369
+ end
370
+ subs_info_ret_1_thr2.join
371
+
372
+ output_params
373
+ end
374
+
375
+
376
+ def wifi_get_subs_inf_ret_ssh_1(ipaddress, remote_ip, real_ip)
377
+ input_params = {:ipaddress => ipaddress}
378
+ output_params = {}
379
+
380
+ subs_info_ret_1_thr1 = Thread.new do
381
+ begin
382
+ resp_procedure = general_procedures.get_subs_info_ret_ssh_1(ipaddress)
383
+ output_params = resp_procedure
384
+ rescue
385
+ output_params = {:code => 507, :result => 'Unknown SDK error'}
386
+ end
387
+ end
388
+ subs_info_ret_1_thr1.join
389
+
390
+ subs_info_ret_1_thr2 = Thread.new do
391
+ begin
392
+ p "mongo"
393
+ #mongo_connector_wifi_1 = MongoWifiCl_1.new(mongo_ip, mongo_port, mongo_database)
394
+ #mongo_connector_wifi_1.audit_logger_wifi_portal_1("wifi_get_subs_info_return_1", remote_ip, input_params, output_params, real_ip)
395
+ rescue
396
+ 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")
355
397
  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)
356
398
  end
357
399
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freewifi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dzmitry Buynovskiy
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-04 00:00:00.000000000 Z
11
+ date: 2022-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -204,6 +204,7 @@ files:
204
204
  - ".idea/inspectionProfiles/Project_Default.xml"
205
205
  - ".idea/misc.xml"
206
206
  - ".idea/modules.xml"
207
+ - ".idea/runConfigurations/get_iwag_data.xml"
207
208
  - ".idea/vcs.xml"
208
209
  - ".idea/workspace.xml"
209
210
  - ".travis.yml"
@@ -218,6 +219,8 @@ files:
218
219
  - lib/freewifi.rb
219
220
  - lib/freewifi/additional/additional_functions.rb
220
221
  - lib/freewifi/cisco/any/cisco_schemes_conf_gen.rb
222
+ - lib/freewifi/cisco/iwag/get_iwag_data.rb
223
+ - lib/freewifi/cisco/iwag/iwag_database_worker.rb
221
224
  - lib/freewifi/cisco/iwag/iwag_telnet_connector.rb
222
225
  - lib/freewifi/config.rb
223
226
  - lib/freewifi/database/mongo/mongoconnector.rb
@@ -236,7 +239,7 @@ licenses:
236
239
  - MIT
237
240
  metadata:
238
241
  allowed_push_host: https://rubygems.org/
239
- post_install_message:
242
+ post_install_message:
240
243
  rdoc_options: []
241
244
  require_paths:
242
245
  - lib
@@ -251,9 +254,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
254
  - !ruby/object:Gem::Version
252
255
  version: '0'
253
256
  requirements: []
254
- rubyforge_project:
257
+ rubyforge_project:
255
258
  rubygems_version: 2.6.14
256
- signing_key:
259
+ signing_key:
257
260
  specification_version: 4
258
261
  summary: gem for Public WiFi
259
262
  test_files: []