freewifi 0.1.9 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/freewifi.iml +39 -1
- data/.idea/runConfigurations/get_iwag_data.xml +21 -0
- data/.idea/workspace.xml +239 -185
- data/Gemfile +1 -1
- data/freewifi.gemspec +23 -23
- data/lib/freewifi.rb +67 -34
- data/lib/freewifi/additional/additional_functions.rb +1 -1
- data/lib/freewifi/cisco/any/cisco_schemes_conf_gen.rb +2 -1
- data/lib/freewifi/cisco/iwag/get_iwag_data.rb +91 -0
- data/lib/freewifi/cisco/iwag/iwag_database_worker.rb +24 -0
- data/lib/freewifi/cisco/iwag/iwag_telnet_connector.rb +21 -7
- data/lib/freewifi/config.rb +2 -1
- data/lib/freewifi/general/wifi_portal_procedures.rb +774 -388
- data/lib/freewifi/mikrotik/automation/get_data_ssh_fun.rb +2 -0
- data/lib/freewifi/mikrotik/newhub_mtik_api.rb +4 -4
- data/lib/freewifi/mikrotik/newhub_mtik_ssh.rb +12 -12
- data/lib/freewifi/mikrotik/schemes_conf_gen.rb +2 -2
- data/lib/freewifi/version.rb +1 -1
- metadata +10 -6
@@ -12,6 +12,7 @@ class NEWhubWifiApi_1
|
|
12
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}
|
15
16
|
#region get additional information
|
16
17
|
|
17
18
|
subscribers_mac = subs_mac
|
@@ -30,7 +31,8 @@ def get_info_subs_from_mik_1(subs_mac, controllers_ip)
|
|
30
31
|
mikrot_connection1.get_reply('/caps-man/registration-table/getall') do |req, sentence|
|
31
32
|
|
32
33
|
req.reply.each do |reply|
|
33
|
-
if reply.key?('
|
34
|
+
if reply.key?('mac-address')
|
35
|
+
#p reply
|
34
36
|
if reply['mac-address'] == subscribers_mac
|
35
37
|
|
36
38
|
access_point = reply['interface']
|
@@ -88,9 +90,7 @@ def get_info_subs_from_mik_1(subs_mac, controllers_ip)
|
|
88
90
|
end
|
89
91
|
|
90
92
|
#endregion
|
91
|
-
|
92
|
-
|
93
|
-
return answ
|
93
|
+
subscribers_mac+ "---" + access_point + "---" + ssid_ap + "---" + tx_rate_set + "---"+ tx_rate + "---"+ rx_rate + "---"+ rx_signal + "---"+ uptime + "---"+ packets + "---"+ bytes
|
94
94
|
|
95
95
|
end
|
96
96
|
|
@@ -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
|
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
|
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 =>
|
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 =>
|
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 =>
|
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
|
|
@@ -243,9 +243,9 @@ class NEWhubWifi_1
|
|
243
243
|
conf_5ghz_name = "auto_cfg_5ghz_#{companyname}_#{wifissid}"
|
244
244
|
command_conf_5ghz = "/caps-man configuration add name=#{conf_5ghz_name} ssid=#{wifissid} country=belarus mode=ap hw-retries=15 channel=5_channel_5GHz_number1_power23 datapath=1_datapath_MTS_Local-forwarding security=security_without_passphrase_default_FREE-WiFi"
|
245
245
|
|
246
|
-
command_provisioning_24ghz = "/caps-man provisioning add hw-supported-modes=b,g,gn ip-address-ranges=#{ap_ip} action=create-dynamic-enabled master-configuration=#{conf_24ghz_name} name-format=identity"
|
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 master-configuration=#{
|
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] !=
|
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
|
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 =>
|
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
|
-
|
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
|
-
|
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",
|
data/lib/freewifi/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.4
|
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:
|
11
|
+
date: 2021-01-04 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,12 +219,15 @@ 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
|
224
227
|
- lib/freewifi/database/mysql/database_methods_wifi.rb
|
225
228
|
- lib/freewifi/general/wifi_portal_procedures.rb
|
226
229
|
- lib/freewifi/huawei/hua_controller_class.rb
|
230
|
+
- lib/freewifi/mikrotik/automation/get_data_ssh_fun.rb
|
227
231
|
- lib/freewifi/mikrotik/getsubscribermikrotik.rb
|
228
232
|
- lib/freewifi/mikrotik/newhub_mtik_api.rb
|
229
233
|
- lib/freewifi/mikrotik/newhub_mtik_ssh.rb
|
@@ -235,7 +239,7 @@ licenses:
|
|
235
239
|
- MIT
|
236
240
|
metadata:
|
237
241
|
allowed_push_host: https://rubygems.org/
|
238
|
-
post_install_message:
|
242
|
+
post_install_message:
|
239
243
|
rdoc_options: []
|
240
244
|
require_paths:
|
241
245
|
- lib
|
@@ -250,9 +254,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
254
|
- !ruby/object:Gem::Version
|
251
255
|
version: '0'
|
252
256
|
requirements: []
|
253
|
-
rubyforge_project:
|
257
|
+
rubyforge_project:
|
254
258
|
rubygems_version: 2.6.14
|
255
|
-
signing_key:
|
259
|
+
signing_key:
|
256
260
|
specification_version: 4
|
257
261
|
summary: gem for Public WiFi
|
258
262
|
test_files: []
|