This repository has been archived by the owner on Jul 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
core.py
394 lines (351 loc) · 23 KB
/
core.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
#!/usr/bin/python3
###############################################################################
# Copyright (C) 2020 Eric Craw, KF7EEL <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
##
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
###############################################################################
# Modified 04-28-2020, by Eric, KF7EEL
# Core Functions
#from config
import sys, os, ast
##sys.path.append('..')
PACKAGE_PARENT = '..'
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
from config import *
sys.path.append(hblink_loc)
from rules_web import *
from functions import *
from configparser import ConfigParser
hblink_system = 'SYSTEM'
hblink_ts = 'TS'
hblink_tgid = 'TGID'
hblink_active = 'ACTIVE'
hblink_timeout = 'TIMEOUT'
hblink_to_type = 'TO_TYPE'
hblink_on = 'ON'
hblink_off = 'OFF'
hblink_reset = 'RESET'
def add_bridge_rule(bridge_name, system, ts, tgid, active, timeout, to_type, on, off, reset):
## if on == None:
## on_tg = []
## else:
## on_tg == [int(on)]
## if off is None:
## off_tg == []
## else:
## off_tg = [int(off)]
## if reset is None:
## reset_tg == []
## else:
## reset_tg = [int(on)]
## if tgid.islower() or tgid.isupper() in tgid:
## tgid_value = eval_code(tgid)
## else:
## tgid_value = int(tgid)
##
if type(reset) == str: #or tgid.isupper() in tgid:
reset = eval(reset)
if type(on) == str: #or tgid.isupper() in tgid:
on = eval(on)
if type(off) == str: #or tgid.isupper() in tgid:
off = eval(off)
#else:
# reset = int(reset)
new_entry = {hblink_system: str(system), hblink_ts: int(ts), hblink_tgid: int(tgid), hblink_active: active, hblink_timeout: int(timeout), hblink_to_type: str(to_type), hblink_on: on, hblink_off: off, hblink_reset: reset}
#tgid_value = eval_code(tgid)
#BRIDGES[bridgename] =
if str(bridge_name) in str(BRIDGES):
BRIDGES[bridge_name].append(new_entry)
# print(BRIDGES[bridge_name])
#print('its equal')
else:
BRIDGES[bridge_name] = [{hblink_system: str(system), hblink_ts: int(ts), hblink_tgid: int(tgid), hblink_active: active, hblink_timeout: int(timeout), hblink_to_type: str(to_type), hblink_on: on, hblink_off: off, hblink_reset: reset}]
#print(BRIDGES[bridge_name])
def bridge_write_file():
with open(rule_file, 'w') as file:
file.write('BRIDGES = ' + str(BRIDGES))
def add_bridge(name, system, ts, tgid, active, timeout, to_type, on, off, reset):
BRIDGES[name] = [{hblink_system: str(system), hblink_ts: int(ts), hblink_tgid: int(tgid), hblink_active: active, hblink_timeout: int(timeout), hblink_to_type: str(to_type), hblink_on: [int(on)], hblink_off: [int(off)], hblink_reset: [int(reset)]}]
def html_bridge_view_all():
for line in BRIDGES:
print('''
<p> </p>
<h3><strong>''' + str(line) + '''</strong></h3>
<table style="width: 100%; height: 30px;" border="5">''')
bridge_list(line)
print('</table>')
def delete_bridge_rule(bridge, rule):
del BRIDGES[bridge][rule]
#print(BRIDGES[bridge][rule])
def delete_bridge(bridge):
del BRIDGES[bridge]
def bridge_rule_index(bridge):
for key in BRIDGES[bridge]:
print(type(key))
print(BRIDGES[bridge].index(key))
def html_core_list_master():
#print(hblink_config)
parser = ConfigParser()
parser.read(hblink_loc + 'hblink.cfg')
for section_name in parser.sections():
try:
## config_table = '''
##<table style="float: left;" width: 300px border="5" cellspacing="5" cellpadding="5">
##<tbody>
##<tr><td><strong>System: </strong></td><td>''' + section_name + '''</td>
##<td>''' + server_type + '''</td></tr>
##</tbody>
##</table>
##<p> </p>
##'''
if parser.get(section_name, 'MODE') == 'MASTER':
server_type = 'Master'
print('''
<table style="width: 50%; margin-left: auto; margin-right: auto;" border="5" cellspacing="5" cellpadding="5">
<tbody>
<tr>
<td><strong>System Type:</strong></td>
<td>''' + parser.get(section_name, 'MODE') + '''</td>
</tr>
<tr>
<td><strong>Name:</strong></td>
<td>''' + section_name + '''</td>
</tr>
<tr>
<td><strong>Status:</strong></td>
<td><strong>''' + parser.get(section_name, 'ENABLED') + '''</strong></td>
</tr>
<tr>
<td><strong>Repeat:</strong></td>
<td>''' + parser.get(section_name, 'REPEAT') + '''</td>
</tr>
<tr>
<td><strong>Max Peers:</strong></td>
<td>''' + parser.get(section_name, 'MAX_PEERS') + '''</td>
</tr>
<tr>
<td><strong>IP:</strong></td>
<td>''' + parser.get(section_name, 'IP') + '''</td>
</tr>
<tr>
<td><strong>Port:</strong></td>
<td>''' + parser.get(section_name, 'PORT') + '''</td>
</tr>
<tr>
<td><strong>Passphrase:</strong></td>
<td>''' + parser.get(section_name, 'PASSPHRASE') + '''</td>
</tr>
<tr>
<td><strong>Group Hangtime:</strong></td>
<td>''' + parser.get(section_name, 'GROUP_HANGTIME') + '''</td>
</tr>
</tbody>
</table>
<p> </p>
''')
#print('''<tr><td><strong>System: </strong></td><td>''' + section_name + '''</td><td>''' + server_type + '''</td></tr>''')
if parser.get(section_name, 'MODE') == 'PEER':
server_type = 'Peer'
print('''
<table style="width: 50%; margin-left: auto; margin-right: auto;" border="5" cellspacing="5" cellpadding="5">
<tbody>
<tr>
<td><strong>System Type:</strong></td>
<td>''' + parser.get(section_name, 'MODE') + '''</td>
</tr>
<tr>
<td><strong>Name:</strong></td>
<td>''' + section_name + '''</td>
</tr>
<tr>
<td><strong>Status:</strong></td>
<td><strong><select name="enabled">
<option selected="selected" value="''' + parser.get(section_name, 'ENABLED') + '''">Enabled? ''' + parser.get(section_name, 'ENABLED') + '''</option>
<option selected="selected" value="True">Enabled</option>
<option selected="selected" value="False">Disabled</option>
</select></strong></td>
</tr>
<tr>
<td><strong>Callsign:</strong></td>
<td>''' + parser.get(section_name, 'CALLSIGN') + '''</td>
</tr>
<tr>
<td><strong>DMR ID:</strong></td>
<td>''' + parser.get(section_name, 'RADIO_ID') + '''</td>
</tr>
<tr>
<td><strong>Color Code:</strong></td>
<td>''' + parser.get(section_name, 'COLORCODE') + '''</td>
</tr>
<tr>
<td><strong>Slots:</strong></td>
<td>''' + parser.get(section_name, 'SLOTS') + '''</td>
</tr>
<tr>
<td><strong>Master IP:</strong></td>
<td>''' + parser.get(section_name, 'MASTER_IP') + '''</td>
</tr>
<tr>
<td><strong>Master Port:</strong></td>
<td>''' + parser.get(section_name, 'MASTER_PORT') + '''</td>
</tr>
<tr>
<td><strong>Passphrase:</strong></td>
<td>''' + parser.get(section_name, 'PASSPHRASE') + '''</td>
</tr>
<tr>
<td><strong>Description:</strong></td>
<td>''' + parser.get(section_name, 'DESCRIPTION') + '''</td>
</tr>
</tbody>
</table>
<p> </p>
''')
#print('''<tr><td><strong>System: </strong></td><td>''' + section_name + '''</td><td>''' + server_type + '''</td></tr>''')
if parser.get(section_name, 'MODE') == 'OPENBRIDGE':
server_type = 'Openbridge'
print('''
<table style="width: 50%; margin-left: auto; margin-right: auto;" border="5" cellspacing="5" cellpadding="5">
<tbody>
<tr>
<td><strong>System Type:</strong></td>
<td>''' + parser.get(section_name, 'MODE') + '''</td>
</tr>
<tr>
<td><strong>Name:</strong></td>
<td>''' + section_name + '''</td>
</tr>
<tr>
<td><strong>Status:</strong></td>
<td><strong>''' + parser.get(section_name, 'ENABLED') + '''</strong></td>
</tr>
<tr>
<td><strong>Network ID:</strong></td>
<td>''' + parser.get(section_name, 'NETWORK_ID') + '''</td>
</tr>
<tr>
<td><strong>Passphrase:</strong></td>
<td>''' + parser.get(section_name, 'PASSPHRASE') + '''</td>
</tr>
<tr>
<td><strong>Target IP:</strong></td>
<td>''' + parser.get(section_name, 'TARGET_IP') + '''</td>
</tr>
<tr>
<td><strong>Target Port:</strong></td>
<td>''' + parser.get(section_name, 'TARGET_PORT') + '''</td>
</tr>
</tbody>
</table>
<p> </p>
''')
#print('''<tr><td><strong>System: </strong></td><td>''' + section_name + '''</td><td>''' + server_type + '''</td></tr>''')
if parser.get(section_name, 'MODE') == 'XLXPEER':
server_type = 'XLX Peer'
print('''<tr><td><strong>System: </strong></td><td>''' + section_name + '''</td><td>''' + server_type + '''</td></tr>''')
#print(parser.get(section_name, 'MODE'))
except Exception as Exc:
#print(Exc)
#print('')
pass
def bridge_list(bridge):
# with open(rule_file) as BRIDGES:
for key in BRIDGES[bridge]:
print('''
<tr>
<td style="width: 33px;"><strong>Rule: </strong>''' + str(BRIDGES[bridge].index(key)) + '''</td>
<td style="width: 51px;"><strong>System: </strong>''' + str(key[hblink_system]) + '''</td>
<td style="width: 52px;"><strong>Timeslot: </strong>''' + str(key[hblink_ts]) + '''</td>
<td style="width: 10px;"><strong>Talkgroup: </strong>''' + str(key[hblink_tgid]) + '''</td>
<td style="width: 70px;"><strong>Activate on start: </strong>''' + str(key[hblink_active]) + '''</td>
<td style="width: 10px;"><strong>Timer time: </strong>''' + str(key[hblink_timeout]) + '''</td>
<td style="width: 40px;"><strong>Timer type: </strong>''' + str(key[hblink_to_type]) + '''</td>
<td style="width: 40px;"><strong>Trigger ON: </strong>''' + str(key[hblink_on]) + '''</td>
<td style="width: 40px;"><strong>Trigger OFF: </strong>''' + str(key[hblink_off]) + '''</td>
<td style="width: 40px;"><strong>Trigger RESET: </strong>''' + str(key[hblink_reset]) + '''</td>
</tr>
''')
header = '''
<html>
<head>
<title>HBLink Web Administration</title>
<style>
body {
background: white;
}
.content {
max-width: 1400px;
margin: auto;
background: white;
padding: 10px;
}
</style>
</head>
<body>
<div class="content">
<p><a href="view.py" target="_blank" rel="noopener"><img style="display: block; margin-left: auto; margin-right: auto;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASsAAABACAYAAABC4FGZAAANW3pUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZlplhs5DoT/8xRzBO7LcUgAfG9uMMefDymVl7Ldbc90qV2pSqWYIAKICGQH+8+/b/gXP6XNGGobs6/eIz911ZU3b2Z8/eznd4r1+f385PN+l74/H+r7OzFzqnAsrz9nf583zmeuz+/z8jqmzfn2zULL3h+c7z/Y74XyfN/gff7jRiW9bhDfC4f9Xqjk953fIZ7XtmJfc3y7BXlff9+fP2ngX/BftYzcW0+j8rvmOEZfvJ851kHe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wuWId7F3/dEh9KjdQRS+GE+PHNmcszRTyXXyOxmW1FSpL/jxFl/CgLkFjS/lRk+Vlc6VnWtwAehdTtBqjS/jE5ortBuZXJV1GBT5Po5yI8Bsa+BEF7OBz7FY0PYVyBJdilBkIszB8SoxTuZaPRezcOytW+SRY/0oxR3E9AX6IAD61YMWqx5A8bboPAVDDKnGYKTMbB10sVqy6MX/bfFJqlAr6cCkRTkaI5GLUSW2h5/mTCkGI6wE2mwQPB+azed065NxzO/Xw3B4tVh1qlIfxXclhm83172grHmkjLu3Csu2ue2ivzLQb4snnNtid5fSlF6vDyehsvpuLe9YOGhuHU2Ek5W/qKzWO9GPftZPKtDvv4VB52tG8zVU8+dr2vkg55eqhekTx//JAHDJIlwA6AAAAAElFTkSu" /></a></p>
<hr />
<h2 class="content" style="text-align: center;">HBLink Web Administration Panel </h2>
<hr />
<table style="width: 100%; height: 30px;" border="5" cellspacing="5" cellpadding="5"><caption> </caption>
<tbody>
<tr>
<td><a href="view.py"><strong>View Rules</strong></a></td>
<td><a href="add.py"><strong>Add Rule</strong></a></td>
<td><a href="delete.py"><strong>Delete Rule</strong></a></td>
<td><a href="add_config.py"><strong>Add Configuration</strong></a></td>
<td><a href="edit_config.py"><strong>View/Edit Configuration</strong></a></td>
<td><a href="adv_edit.py"><strong>Advanced Edit Configuration</strong></a></td>
<td><a href="log.py"><strong>Logs</strong></a></td>
<td><a href="hbmonitor.py"><strong>HB Monitor</strong></a></td>
<td><a href="restart_hblink.py"><strong>Restart HBLink</strong></a></td>
</tr>
</tbody>
</table>
<p> </p>
<hr />'''
footer = '''
<p> </p>
<hr />
<p>Web Administration Panel, Copyright (C) 2020, by Eric - KF7EEL, <a href="mailto:[email protected]. ">[email protected]. </a><br />HBLink is Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS <a href="mailto:[email protected]">[email protected]</a>.</p>
<hr />
</div>
</body>
</html>
'''
redirect = '''
<strong>Window closing in 3 seconds.</strong>
<script type="text/javascript">
setTimeout(
function ( )
{
self.close();
}, 3000 );
</script>
'''
# Templates
#view_home = '''
## <th class="tg-cly1">Rule: <br></th>
## <th class="tg-cly1">System: ''' + key[hblink_system] + '''<br></th>
## <th class="tg-0lax">Timeslot: ''' + str(key[hblink_ts]) + '''</th>
## <th class="tg-0lax">Talkgroup: ''' + str(key[hblink_tgid]) + '''</th>
## <th class="tg-0lax">Activate at start: ''' + str(key[hblink_active]) + '''</th>
## <th class="tg-0lax">Timer time: ''' + str(key[hblink_timeout]) + '''</th>
## <th class="tg-0lax">Timer type: ''' + str(key[hblink_to_type]) + '''</th>
## <th class="tg-0lax">Trigger on TGs: ''' + str(key[hblink_on]) + '''</th>
## <th class="tg-0lax">Trigger off TGs: ''' + str(key[hblink_off]) + '''</th>
## <th class="tg-0lax">Trigger timer reset TGs: ''' + str(key[hblink_reset]) + '''</th>
## </tr>