freewifi 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/workspace.xml +71 -41
- data/lib/freewifi/general/wifi_portal_procedures.rb +14 -33
- data/lib/freewifi/mikrotik/newhub_mtik_api.rb +74 -171
- data/lib/freewifi/version.rb +1 -1
- data/lib/freewifi.rb +2 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb8c1514a29307c8e8c4fc5197f4221414d09b6b
|
4
|
+
data.tar.gz: 40379b6242051f3159426d91c157a5f9f9451c57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c598529ab03167805ae6738bcb8a2f35425f69b01256c75b33ed4541e4d11c7aadb7484a0235204ed63228c38fc95153be54bcf91087dd88c74550ba5c23abd6
|
7
|
+
data.tar.gz: 9362d375ebfbcdfd76f8e4f93c9c861309f30488cbc5b4e9c25343840625da9501c6eca6b720a48d6a6a7eb333cafa5f35c96ba9b8ebd168e124e714ae25698b
|
data/.idea/workspace.xml
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
<SUITE FILE_PATH="coverage/freewifi@ssh_mtik_2.coverage" NAME="ssh_mtik_2 Coverage Results" MODIFIED="1645285472334" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" MODULE_NAME="freewifi" />
|
55
55
|
<SUITE FILE_PATH="coverage/freewifi@test2.coverage" NAME="test2 Coverage Results" MODIFIED="1617284278277" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" MODULE_NAME="freewifi" />
|
56
56
|
<SUITE FILE_PATH="coverage/freewifi@sql_delete_not_necc.coverage" NAME="sql_delete_not_necc Coverage Results" MODIFIED="1600631885005" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" MODULE_NAME="freewifi" />
|
57
|
-
<SUITE FILE_PATH="coverage/freewifi@test_wifi1.coverage" NAME="test_wifi1 Coverage Results" MODIFIED="
|
57
|
+
<SUITE FILE_PATH="coverage/freewifi@test_wifi1.coverage" NAME="test_wifi1 Coverage Results" MODIFIED="1645296873944" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" MODULE_NAME="freewifi" />
|
58
58
|
<SUITE FILE_PATH="coverage/freewifi@test_helper.coverage" NAME="test_helper Coverage Results" MODIFIED="1645287186567" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" MODULE_NAME="freewifi" />
|
59
59
|
<SUITE FILE_PATH="coverage/freewifi@test.coverage" NAME="test Coverage Results" MODIFIED="1587924491650" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" MODULE_NAME="freewifi" />
|
60
60
|
<SUITE FILE_PATH="coverage/freewifi@wifi_portal_procedures.coverage" NAME="wifi_portal_procedures Coverage Results" MODIFIED="1588069407762" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/lib/freewifi/general" MODULE_NAME="freewifi" />
|
@@ -65,11 +65,11 @@
|
|
65
65
|
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
66
66
|
<component name="FileEditorManager">
|
67
67
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
68
|
-
<file leaf-file-name="freewifi.rb" pinned="false" current-in-tab="
|
68
|
+
<file leaf-file-name="freewifi.rb" pinned="false" current-in-tab="true">
|
69
69
|
<entry file="file://$PROJECT_DIR$/lib/freewifi.rb">
|
70
70
|
<provider selected="true" editor-type-id="text-editor">
|
71
|
-
<state relative-caret-position="
|
72
|
-
<caret line="
|
71
|
+
<state relative-caret-position="459">
|
72
|
+
<caret line="391" column="16" lean-forward="false" selection-start-line="391" selection-start-column="11" selection-end-line="391" selection-end-column="16" />
|
73
73
|
<folding />
|
74
74
|
</state>
|
75
75
|
</provider>
|
@@ -85,7 +85,7 @@
|
|
85
85
|
</provider>
|
86
86
|
</entry>
|
87
87
|
</file>
|
88
|
-
<file leaf-file-name="test_wifi1.rb" pinned="false" current-in-tab="
|
88
|
+
<file leaf-file-name="test_wifi1.rb" pinned="false" current-in-tab="false">
|
89
89
|
<entry file="file://$PROJECT_DIR$/test/test_wifi1.rb">
|
90
90
|
<provider selected="true" editor-type-id="text-editor">
|
91
91
|
<state relative-caret-position="338">
|
@@ -95,6 +95,36 @@
|
|
95
95
|
</provider>
|
96
96
|
</entry>
|
97
97
|
</file>
|
98
|
+
<file leaf-file-name="version.rb" pinned="false" current-in-tab="false">
|
99
|
+
<entry file="file://$PROJECT_DIR$/lib/freewifi/version.rb">
|
100
|
+
<provider selected="true" editor-type-id="text-editor">
|
101
|
+
<state relative-caret-position="45">
|
102
|
+
<caret line="3" column="0" lean-forward="true" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
|
103
|
+
<folding />
|
104
|
+
</state>
|
105
|
+
</provider>
|
106
|
+
</entry>
|
107
|
+
</file>
|
108
|
+
<file leaf-file-name="freewifi.gemspec" pinned="false" current-in-tab="false">
|
109
|
+
<entry file="file://$PROJECT_DIR$/freewifi.gemspec">
|
110
|
+
<provider selected="true" editor-type-id="text-editor">
|
111
|
+
<state relative-caret-position="645">
|
112
|
+
<caret line="43" column="47" lean-forward="false" selection-start-line="43" selection-start-column="47" selection-end-line="43" selection-end-column="47" />
|
113
|
+
<folding />
|
114
|
+
</state>
|
115
|
+
</provider>
|
116
|
+
</entry>
|
117
|
+
</file>
|
118
|
+
<file leaf-file-name="Gemfile" pinned="false" current-in-tab="false">
|
119
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
120
|
+
<provider selected="true" editor-type-id="text-editor">
|
121
|
+
<state relative-caret-position="90">
|
122
|
+
<caret line="6" column="0" lean-forward="true" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
123
|
+
<folding />
|
124
|
+
</state>
|
125
|
+
</provider>
|
126
|
+
</entry>
|
127
|
+
</file>
|
98
128
|
<file leaf-file-name="freewifi_test.rb" pinned="false" current-in-tab="false">
|
99
129
|
<entry file="file://$PROJECT_DIR$/test/freewifi_test.rb">
|
100
130
|
<provider selected="true" editor-type-id="text-editor">
|
@@ -160,11 +190,11 @@
|
|
160
190
|
<option value="$PROJECT_DIR$/lib/freewifi/additional/additional_functions.rb" />
|
161
191
|
<option value="$PROJECT_DIR$/test/test_helper.rb" />
|
162
192
|
<option value="$PROJECT_DIR$/freewifi.gemspec" />
|
163
|
-
<option value="$PROJECT_DIR$/lib/freewifi/version.rb" />
|
164
193
|
<option value="$PROJECT_DIR$/lib/freewifi/mikrotik/newhub_mtik_api.rb" />
|
165
194
|
<option value="$PROJECT_DIR$/lib/freewifi/general/wifi_portal_procedures.rb" />
|
166
195
|
<option value="$PROJECT_DIR$/lib/freewifi.rb" />
|
167
196
|
<option value="$PROJECT_DIR$/test/test_wifi1.rb" />
|
197
|
+
<option value="$PROJECT_DIR$/lib/freewifi/version.rb" />
|
168
198
|
</list>
|
169
199
|
</option>
|
170
200
|
</component>
|
@@ -537,12 +567,12 @@
|
|
537
567
|
<workItem from="1645294796817" duration="412000" />
|
538
568
|
<workItem from="1645295265784" duration="23000" />
|
539
569
|
<workItem from="1645295326630" duration="743000" />
|
540
|
-
<workItem from="1645296175448" duration="
|
570
|
+
<workItem from="1645296175448" duration="895000" />
|
541
571
|
</task>
|
542
572
|
<servers />
|
543
573
|
</component>
|
544
574
|
<component name="TimeTrackingManager">
|
545
|
-
<option name="totallyTimeSpent" value="
|
575
|
+
<option name="totallyTimeSpent" value="129192000" />
|
546
576
|
</component>
|
547
577
|
<component name="ToolWindowManager">
|
548
578
|
<frame x="0" y="25" width="1440" height="834" extended-state="6" />
|
@@ -554,7 +584,7 @@
|
|
554
584
|
<window_info id="Inspection Results" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32676056" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
|
555
585
|
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
556
586
|
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.329602" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
557
|
-
<window_info id="Run" active="
|
587
|
+
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.35774648" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
558
588
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
559
589
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24964234" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
560
590
|
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
@@ -781,22 +811,6 @@
|
|
781
811
|
</state>
|
782
812
|
</provider>
|
783
813
|
</entry>
|
784
|
-
<entry file="file://$PROJECT_DIR$/Gemfile">
|
785
|
-
<provider selected="true" editor-type-id="text-editor">
|
786
|
-
<state relative-caret-position="90">
|
787
|
-
<caret line="6" column="0" lean-forward="false" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
788
|
-
<folding />
|
789
|
-
</state>
|
790
|
-
</provider>
|
791
|
-
</entry>
|
792
|
-
<entry file="file://$PROJECT_DIR$/freewifi.gemspec">
|
793
|
-
<provider selected="true" editor-type-id="text-editor">
|
794
|
-
<state relative-caret-position="645">
|
795
|
-
<caret line="43" column="47" lean-forward="false" selection-start-line="43" selection-start-column="47" selection-end-line="43" selection-end-column="47" />
|
796
|
-
<folding />
|
797
|
-
</state>
|
798
|
-
</provider>
|
799
|
-
</entry>
|
800
814
|
<entry file="file://$PROJECT_DIR$/LICENSE.txt">
|
801
815
|
<provider selected="true" editor-type-id="text-editor">
|
802
816
|
<state relative-caret-position="0">
|
@@ -855,14 +869,6 @@
|
|
855
869
|
</state>
|
856
870
|
</provider>
|
857
871
|
</entry>
|
858
|
-
<entry file="file://$PROJECT_DIR$/lib/freewifi/version.rb">
|
859
|
-
<provider selected="true" editor-type-id="text-editor">
|
860
|
-
<state relative-caret-position="45">
|
861
|
-
<caret line="3" column="0" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
|
862
|
-
<folding />
|
863
|
-
</state>
|
864
|
-
</provider>
|
865
|
-
</entry>
|
866
872
|
<entry file="file://$PROJECT_DIR$/lib/freewifi/mikrotik/newhub_mtik_api.rb">
|
867
873
|
<provider selected="true" editor-type-id="text-editor">
|
868
874
|
<state relative-caret-position="150">
|
@@ -895,14 +901,6 @@
|
|
895
901
|
</state>
|
896
902
|
</provider>
|
897
903
|
</entry>
|
898
|
-
<entry file="file://$PROJECT_DIR$/lib/freewifi.rb">
|
899
|
-
<provider selected="true" editor-type-id="text-editor">
|
900
|
-
<state relative-caret-position="142">
|
901
|
-
<caret line="381" column="51" lean-forward="true" selection-start-line="381" selection-start-column="44" selection-end-line="381" selection-end-column="67" />
|
902
|
-
<folding />
|
903
|
-
</state>
|
904
|
-
</provider>
|
905
|
-
</entry>
|
906
904
|
<entry file="file://$PROJECT_DIR$/lib/freewifi/general/wifi_portal_procedures.rb">
|
907
905
|
<provider selected="true" editor-type-id="text-editor">
|
908
906
|
<state relative-caret-position="-15535">
|
@@ -919,5 +917,37 @@
|
|
919
917
|
</state>
|
920
918
|
</provider>
|
921
919
|
</entry>
|
920
|
+
<entry file="file://$PROJECT_DIR$/lib/freewifi/version.rb">
|
921
|
+
<provider selected="true" editor-type-id="text-editor">
|
922
|
+
<state relative-caret-position="45">
|
923
|
+
<caret line="3" column="0" lean-forward="true" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
|
924
|
+
<folding />
|
925
|
+
</state>
|
926
|
+
</provider>
|
927
|
+
</entry>
|
928
|
+
<entry file="file://$PROJECT_DIR$/freewifi.gemspec">
|
929
|
+
<provider selected="true" editor-type-id="text-editor">
|
930
|
+
<state relative-caret-position="645">
|
931
|
+
<caret line="43" column="47" lean-forward="false" selection-start-line="43" selection-start-column="47" selection-end-line="43" selection-end-column="47" />
|
932
|
+
<folding />
|
933
|
+
</state>
|
934
|
+
</provider>
|
935
|
+
</entry>
|
936
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
937
|
+
<provider selected="true" editor-type-id="text-editor">
|
938
|
+
<state relative-caret-position="90">
|
939
|
+
<caret line="6" column="0" lean-forward="true" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
940
|
+
<folding />
|
941
|
+
</state>
|
942
|
+
</provider>
|
943
|
+
</entry>
|
944
|
+
<entry file="file://$PROJECT_DIR$/lib/freewifi.rb">
|
945
|
+
<provider selected="true" editor-type-id="text-editor">
|
946
|
+
<state relative-caret-position="459">
|
947
|
+
<caret line="391" column="16" lean-forward="false" selection-start-line="391" selection-start-column="11" selection-end-line="391" selection-end-column="16" />
|
948
|
+
<folding />
|
949
|
+
</state>
|
950
|
+
</provider>
|
951
|
+
</entry>
|
922
952
|
</component>
|
923
953
|
</project>
|
@@ -21,9 +21,7 @@ class WiFiPortal_1
|
|
21
21
|
:mtik_api_connector,
|
22
22
|
:hua_controller_connector,
|
23
23
|
:iwag_connector1,
|
24
|
-
:iwag_connector2
|
25
|
-
:protocol_mtik,
|
26
|
-
:mtik_capsman_list
|
24
|
+
:iwag_connector2
|
27
25
|
|
28
26
|
def initialize(apigw_wsdl,
|
29
27
|
apigw_endpoint,
|
@@ -44,9 +42,7 @@ class WiFiPortal_1
|
|
44
42
|
iwag2_host,
|
45
43
|
iwag2_username,
|
46
44
|
iwag2_password,
|
47
|
-
iwag2_port
|
48
|
-
protocol_mtik,
|
49
|
-
mtik_capsman_list
|
45
|
+
iwag2_port
|
50
46
|
)
|
51
47
|
@iwag_telnet_connector = CSRtelnet_1.new(iwag1_host, iwag1_username, iwag1_password)
|
52
48
|
@ard_api_gw_connector_wifi = Savon.client do
|
@@ -70,8 +66,6 @@ class WiFiPortal_1
|
|
70
66
|
@iwag_connector1 = IwagRequester.new(iwag1_host, iwag1_username, iwag1_password, iwag1_port)
|
71
67
|
@iwag_connector2 = IwagRequester.new(iwag2_host, iwag2_username, iwag2_password, iwag2_port)
|
72
68
|
|
73
|
-
@protocol_mtik = protocol_mtik
|
74
|
-
@mtik_capsman_list = mtik_capsman_list
|
75
69
|
end
|
76
70
|
|
77
71
|
|
@@ -256,11 +250,15 @@ class WiFiPortal_1
|
|
256
250
|
end
|
257
251
|
|
258
252
|
|
259
|
-
|
260
|
-
|
261
253
|
def get_subs_add_info4new_1(access_interface, subscribers_mac)
|
262
254
|
|
263
|
-
capsman_list =
|
255
|
+
capsman_list = [
|
256
|
+
"172.24.247.15",
|
257
|
+
"172.24.214.155",
|
258
|
+
"172.24.214.140",
|
259
|
+
"172.24.214.105",
|
260
|
+
"172.24.223.105"
|
261
|
+
]
|
264
262
|
|
265
263
|
answer = ""
|
266
264
|
|
@@ -273,27 +271,11 @@ class WiFiPortal_1
|
|
273
271
|
capsman_list.each do |capsman|
|
274
272
|
threads_mikro_wlc << Thread.new do
|
275
273
|
begin
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
p answer
|
282
|
-
end
|
283
|
-
elsif protocol_mtik == 'ssh'
|
284
|
-
p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_ssh(subscribers_mac, capsman)
|
285
|
-
splitting5 = mikr_info5.split("---")
|
286
|
-
if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil
|
287
|
-
answer = mikr_info5
|
288
|
-
p answer
|
289
|
-
end
|
290
|
-
else
|
291
|
-
p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, capsman)
|
292
|
-
splitting5 = mikr_info5.split("---")
|
293
|
-
if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil
|
294
|
-
answer = mikr_info5
|
295
|
-
p answer
|
296
|
-
end
|
274
|
+
p mikr_info5 = mtik_api_connector.get_info_subs_from_mik_1(subscribers_mac, capsman)
|
275
|
+
splitting5 = mikr_info5.split("---")
|
276
|
+
if splitting5[1] != "not on mikrotik controller" && splitting5[1]!="unknown" && splitting5[1]!=nil
|
277
|
+
answer = mikr_info5
|
278
|
+
p answer
|
297
279
|
end
|
298
280
|
rescue
|
299
281
|
p "thr0 wrong"
|
@@ -309,7 +291,6 @@ class WiFiPortal_1
|
|
309
291
|
answer
|
310
292
|
end
|
311
293
|
|
312
|
-
|
313
294
|
def proc_100_71_0_0(ip_address)
|
314
295
|
begin
|
315
296
|
p access_int = iwag_telnet_connector.return_iwag_access_interface_1(ip_address)
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'mtik'
|
2
|
-
require 'net/ssh'
|
3
2
|
|
4
3
|
class NEWhubWifiApi_1
|
5
4
|
|
@@ -12,183 +11,87 @@ class NEWhubWifiApi_1
|
|
12
11
|
end
|
13
12
|
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
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']
|
49
47
|
end
|
50
48
|
end
|
51
49
|
end
|
52
|
-
|
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
|
95
|
-
|
96
50
|
end
|
97
51
|
|
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
|
98
63
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
bytes = ""
|
114
|
-
|
115
|
-
begin
|
116
|
-
Net::SSH.start(controllers_ip, mtik_user, :password => mtik_password) do |ssh|
|
117
|
-
#result = ssh.exec!("/interface eoip print where tunnel-id=#{tunnel_id}")
|
118
|
-
#p result
|
119
|
-
result = ssh.exec!("/caps-man registration-table print detail value-list where mac-address=#{subs_mac}")
|
120
|
-
p result
|
121
|
-
access_point_reg = /interface:\s(.+)\r\n/
|
122
|
-
access_point = result.scan(access_point_reg)[0][0]
|
123
|
-
ssid_reg = /ssid:\s(.+)\r\n/
|
124
|
-
ssid_ap = result.scan(ssid_reg)[0][0]
|
125
|
-
|
126
|
-
tx_rate_set = "unknown"
|
127
|
-
tx_rate = "0"
|
128
|
-
rx_rate = "0"
|
129
|
-
rx_signal = "0"
|
130
|
-
uptime = "0"
|
131
|
-
packets = "0"
|
132
|
-
bytes = "0"
|
133
|
-
|
134
|
-
p access_point
|
135
|
-
p ssid_ap
|
136
|
-
#regimsi = /\s+name="(.+)"\s+/
|
137
|
-
#m1 = regimsi.match(result)[1]
|
138
|
-
|
139
|
-
#result2 = ssh.exec!("interface bridge port add bridge=#{bridge_name} interface=#{tunnel_name}")
|
140
|
-
end
|
141
|
-
#Net::SSH.stop
|
142
|
-
rescue
|
143
|
-
nil
|
144
|
-
end
|
145
|
-
|
146
|
-
p "1111111111111111111"
|
147
|
-
|
148
|
-
if access_point=="" || ssid_ap=="" || packets==""
|
149
|
-
access_point = "not on mikrotik controller"
|
150
|
-
ssid_ap = "unknown"
|
151
|
-
tx_rate_set = "unknown"
|
152
|
-
tx_rate = "0"
|
153
|
-
rx_rate = "0"
|
154
|
-
rx_signal = "0"
|
155
|
-
uptime = "0"
|
156
|
-
packets = "0"
|
157
|
-
bytes = "0"
|
158
|
-
end
|
159
|
-
|
160
|
-
if access_point==nil || access_point==''
|
161
|
-
access_point= "unknown"
|
162
|
-
end
|
163
|
-
if ssid_ap==nil || ssid_ap==''
|
164
|
-
ssid_ap= "unknown"
|
165
|
-
end
|
166
|
-
if tx_rate_set==nil || tx_rate_set==''
|
167
|
-
tx_rate_set= "unknown"
|
168
|
-
end
|
169
|
-
if tx_rate==nil || tx_rate==''
|
170
|
-
tx_rate= "unknown"
|
171
|
-
end
|
172
|
-
if rx_rate==nil || rx_rate==''
|
173
|
-
rx_rate= "unknown"
|
174
|
-
end
|
175
|
-
if rx_signal==nil || rx_signal==''
|
176
|
-
rx_signal= "unknown"
|
177
|
-
end
|
178
|
-
if uptime==nil || uptime==''
|
179
|
-
uptime= "unknown"
|
180
|
-
end
|
181
|
-
if packets==nil || packets==''
|
182
|
-
packets= "unknown"
|
183
|
-
end
|
184
|
-
if bytes==nil || bytes==''
|
185
|
-
bytes= "unknown"
|
186
|
-
end
|
187
|
-
|
188
|
-
#endregion
|
189
|
-
subscribers_mac+ "---" + access_point + "---" + ssid_ap + "---" + tx_rate_set + "---"+ tx_rate + "---"+ rx_rate + "---"+ rx_signal + "---"+ uptime + "---"+ packets + "---"+ bytes
|
190
|
-
|
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"
|
191
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
|
+
end
|
91
|
+
|
92
|
+
#endregion
|
93
|
+
subscribers_mac+ "---" + access_point + "---" + ssid_ap + "---" + tx_rate_set + "---"+ tx_rate + "---"+ rx_rate + "---"+ rx_signal + "---"+ uptime + "---"+ packets + "---"+ bytes
|
192
94
|
|
95
|
+
end
|
193
96
|
|
194
97
|
end
|
data/lib/freewifi/version.rb
CHANGED
data/lib/freewifi.rb
CHANGED
@@ -303,9 +303,7 @@ class PortalFwifi_1
|
|
303
303
|
iwag2_username,
|
304
304
|
iwag2_password,
|
305
305
|
iwag1_port=22,
|
306
|
-
iwag2_port=22
|
307
|
-
protocol_mtik='api',
|
308
|
-
mtik_capsman_list=['172.24.247.15', '172.24.214.155', '172.24.214.140', '172.24.214.105', '172.24.223.105']
|
306
|
+
iwag2_port=22
|
309
307
|
)
|
310
308
|
|
311
309
|
@general_procedures = WiFiPortal_1.new(apigw_wsdl,
|
@@ -327,9 +325,7 @@ class PortalFwifi_1
|
|
327
325
|
iwag2_host,
|
328
326
|
iwag2_username,
|
329
327
|
iwag2_password,
|
330
|
-
iwag2_port
|
331
|
-
protocol_mtik,
|
332
|
-
mtik_capsman_list
|
328
|
+
iwag2_port
|
333
329
|
)
|
334
330
|
@mtik_control_ips_get = mtik_control_ips_get
|
335
331
|
@mtik_user = mtik_user
|