Compare commits
329 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4633f4d518 | |||
| bb8763bd45 | |||
| f306c6587d | |||
| a5634ac0c9 | |||
| 8ce5427406 | |||
| fbbf4c4b50 | |||
| 7e1ea37142 | |||
| 3892dca12a | |||
| 4016371447 | |||
| 85d197b762 | |||
| eced139c70 | |||
| ce94f102ca | |||
| 213d85d052 | |||
| 19013c6da2 | |||
| 1847f13471 | |||
| f5f1f9b91f | |||
| 69b8570ee2 | |||
| 3b8dff4c03 | |||
| 4fcafa1927 | |||
| f63b782cdf | |||
| e8e6e04f60 | |||
| 9dc5693dd6 | |||
| 857c397693 | |||
| d53743e171 | |||
| 55c0651795 | |||
| c08fa3badd | |||
| ceb42fac61 | |||
| 0e03ad4f03 | |||
| 85a16ffe08 | |||
| f16dc601ca | |||
| ee4f13c6dd | |||
| d2a20b2354 | |||
| 207ad07345 | |||
| e37013d7a7 | |||
| 2c6c36dff1 | |||
| 4e98ed8513 | |||
| 2f8350ecc0 | |||
| 2d3185f94f | |||
| 19db51b1f6 | |||
| 6541aa61b6 | |||
| 88d4447bae | |||
| 75625510c9 | |||
| dd521eb385 | |||
| c1e867721b | |||
| 370c4694ac | |||
| 9690cdf98c | |||
| 73c5ec938f | |||
| 0b9d70b141 | |||
| 3028682ac0 | |||
| 61372e74d1 | |||
| 651ced5ebd | |||
| bad9ad53ae | |||
| 97bb174bf6 | |||
| 698ae71223 | |||
| 620374e4e7 | |||
| 432c356c24 | |||
| 0200789b1b | |||
| c8d2d932a9 | |||
| 35c5afafff | |||
| 3678ca107e | |||
| d347c72e3d | |||
| 87bb1aa6d1 | |||
| 2a556d5b9b | |||
| c123b94618 | |||
| 901b9ee933 | |||
| 651ef0b0d2 | |||
| d0783fc31e | |||
| 72f2bf7d7d | |||
| ce2a45a9a0 | |||
| c414edab99 | |||
| e72682800a | |||
| 8c05948c2f | |||
| e4524965d1 | |||
| 8874c304bf | |||
| bd464b4954 | |||
| 716acefb1e | |||
| 2269b57b5c | |||
| 3692621c6d | |||
| 5b290bf1b8 | |||
| af345335b7 | |||
| 1cee45de63 | |||
| a50901f9c0 | |||
| 38375688f2 | |||
| 95c71f7c87 | |||
| 98e7169f34 | |||
| 4a76abbb5d | |||
| 89cf62e360 | |||
| e2760f8f80 | |||
| b8b8e09cae | |||
| 15ddbbff88 | |||
| 7e7a31e309 | |||
| f30aa4f722 | |||
| 803d2e13f9 | |||
| eb62034ea5 | |||
| 58215d9a3e | |||
| c7eb288f78 | |||
| df9f376ec5 | |||
| 0152b4f190 | |||
| b7102bab4a | |||
| f5f57d7607 | |||
| 6ff7372743 | |||
| 1e1284b982 | |||
| d70fad9815 | |||
| 8866058467 | |||
| 3e5cdf2f51 | |||
| 77744c7b82 | |||
| 601656b448 | |||
| 2d23f9521f | |||
| 2f2053a236 | |||
| eeaa092858 | |||
| f7fd25fdc3 | |||
| aeaea3a135 | |||
| 8aee058e73 | |||
| 1865a4e36a | |||
| aa86b5344c | |||
| 756443f7af | |||
| f91a85b241 | |||
| ea1c04528c | |||
| e55c1395f6 | |||
| b7b29a4402 | |||
| 3c461363a4 | |||
| c761e740bc | |||
| 7db02fcb4b | |||
| b382ffa21f | |||
| e971fb0f50 | |||
| 54f038a0c4 | |||
| 9980d65f57 | |||
| e128e10dcc | |||
| 5c73861c69 | |||
| 59ac3a693e | |||
| 3fd29ab75c | |||
| b5843dfed1 | |||
| a81679a3db | |||
| ce6ba7c5dc | |||
| 82213561b8 | |||
| 82d54848ee | |||
| d7ba7e73f4 | |||
| 4d9502e828 | |||
| cd76853928 | |||
| be1f0c836d | |||
| 2b8ede347d | |||
| 4685686053 | |||
| b3f12587c1 | |||
| 1d93ef13ea | |||
| 6d093b4b08 | |||
| 7429db3a03 | |||
| ea39d5fa6a | |||
| 5f57ceae66 | |||
| 434c9a8e80 | |||
| 38a1ee2c0f | |||
| 6362b8cd5a | |||
| 275af6168d | |||
| ccc5801b59 | |||
| d7266ac387 | |||
| 2503e448c6 | |||
| 6258ccc074 | |||
| 3ce2e2c683 | |||
| 017f55eef3 | |||
| ccaee1015b | |||
| e71c2046d1 | |||
| 7bea2fbe18 | |||
| 3be127d0f4 | |||
| 9267fef2cb | |||
| 413044aba8 | |||
| de08cc897e | |||
| ac7b827c36 | |||
| 3f3b980b98 | |||
| c16036b58d | |||
| f94d68ae81 | |||
| d87c67acb0 | |||
| 06cc28fe82 | |||
| 92e0e2e405 | |||
| a03a9e1018 | |||
| c9436e54ec | |||
| eb0a6b49d4 | |||
| d8e4351ad3 | |||
| 1b9bb3a83f | |||
| 886a15945d | |||
| 90aa470bb9 | |||
| 37af7aab2a | |||
| dd0825c005 | |||
| 6ac2ffe091 | |||
| b6f1a92a60 | |||
| cb81326da2 | |||
| d1a7faf29c | |||
| 257232078a | |||
| 09e1fca1cb | |||
| aa9e68ae5a | |||
| ed31308b26 | |||
| 6827cda57a | |||
| fa11f3bdf4 | |||
| 7d890bc504 | |||
| df1b69612a | |||
| a60e1b2cac | |||
| 5915463b71 | |||
| 080b88d43f | |||
| c362e3e675 | |||
| 2af99e7f46 | |||
| 52ac438fcc | |||
| bda66fbdde | |||
| 16744c61e5 | |||
| 2159d09525 | |||
| 6ddfb2b1c1 | |||
| 8adb80f188 | |||
| 3ed20d48ac | |||
| bc2b146f79 | |||
| f1541c7d7d | |||
| 912d875d11 | |||
| 213a5c6d8f | |||
| a93a61d05b | |||
| 72d0ca87e5 | |||
| 1902234e87 | |||
| 5de722fcf1 | |||
| bfff0abacd | |||
| 04e220de86 | |||
| 948a2a7bbc | |||
| 951f39f3db | |||
| 4b9864671e | |||
| d0d496b232 | |||
| 51ecece8dc | |||
| ce494a4a18 | |||
| 819c3bae30 | |||
| a16e426c55 | |||
| a12b144c7c | |||
| c8e1d88ecc | |||
| 89040e7c14 | |||
| d68241918b | |||
| ccfd862a0a | |||
| 24dca2e6ad | |||
| 8c1e9e5185 | |||
| a2c0bb54c6 | |||
| 03f9c81d3a | |||
| fdbfbf2362 | |||
| b48e522f85 | |||
| f00d29e8a0 | |||
| 08f6669bd3 | |||
| 8497bb1462 | |||
| ac87c44917 | |||
| 8f0a3d02a5 | |||
| d31c6f7fe7 | |||
| e1174e6aba | |||
| e8f838b3d6 | |||
| 7f7f8bdf74 | |||
| 21c6bf9281 | |||
| 4e3a13daaf | |||
| 9e2876dfae | |||
| c246f3e5db | |||
| 21f9c680be | |||
| 50387c2133 | |||
| 41f04dc28b | |||
| d44a181c06 | |||
| 383ba7e0ae | |||
| 7fc4ce0495 | |||
| 4aa5210f5b | |||
| 3d9aa41fcb | |||
| 2fa615dd37 | |||
| 35ba251e71 | |||
| 30ed93aa30 | |||
| 508b9c7197 | |||
| ed2a1ca549 | |||
| e6949e65ec | |||
| 9ac426aa2d | |||
| 94afc15d7a | |||
| b5e77e64b1 | |||
| 8c2b35ece0 | |||
| bb4356e027 | |||
| 63604a5b38 | |||
| 4643ea47b7 | |||
| 877e1c6c65 | |||
| 364ead81ec | |||
| 717e802b9b | |||
| 857c4d09d0 | |||
| 2e09350ad2 | |||
| 836c655739 | |||
| 281860db0b | |||
| 0f38427f2f | |||
| 112143ec05 | |||
| 887657aa16 | |||
| 7bf0a77e16 | |||
| 28f006b493 | |||
| 99c76b44de | |||
| b9dc33dae5 | |||
| 58c84cf43a | |||
| ef4514b8e0 | |||
| 96514de5cc | |||
| cdae79e0ee | |||
| 429287452a | |||
| 3cb00bc5bd | |||
| d68d3582da | |||
| 3d5437e9a0 | |||
| e00a98f7d2 | |||
| 053914a68b | |||
| 76143f718c | |||
| 83d120c101 | |||
| 0a2edc09a5 | |||
| ab1a536147 | |||
| e6d25534b5 | |||
| 9219b4b2ee | |||
| da607cd542 | |||
| 83299312cc | |||
| 8bbd9ee850 | |||
| 999bbbf5f7 | |||
| 76bb7f1140 | |||
| ece48f3a50 | |||
| 1bc57b5ea4 | |||
| 9e2d2315da | |||
| 3893e12fca | |||
| 8a45e927ae | |||
| f98c12096c | |||
| e5eafeec3e | |||
| d8bfdc7068 | |||
| d689a876aa | |||
| 31c23ae7a0 | |||
| 3878c82513 | |||
| 96b029a927 | |||
| 2ef0dfcd74 | |||
| 1b265d8368 | |||
| 84800d690a | |||
| 9ba975bfff | |||
| e570adbef0 | |||
| 99d0b49559 | |||
| d3a5ee2221 | |||
| 557b21c022 | |||
| 553bcba3a2 | |||
| 101a6e4a11 | |||
| 55a546a239 | |||
| 64a685cd80 | |||
| aefedca6ee | |||
| be13083729 |
Regular → Executable
@@ -90,7 +90,6 @@ ENV/
|
||||
|
||||
.DS_Store
|
||||
hblink.cfg
|
||||
deconstructor.cfg
|
||||
*.config
|
||||
*.bak
|
||||
rules.py
|
||||
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
FROM python:3.7-slim-stretch
|
||||
|
||||
RUN apt update && \
|
||||
apt install -y git && \
|
||||
cd /usr/src/ && \
|
||||
git clone https://github.com/n0mjs710/dmr_utils3 && \
|
||||
cd /usr/src/dmr_utils3 && \
|
||||
./install.sh && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
cd /opt && \
|
||||
rm -rf /usr/src/dmr_utils3 && \
|
||||
git clone https://github.com/n0mjs710/hblink3
|
||||
|
||||
RUN cd /opt/hblink3/ && \
|
||||
sed -i s/.*python.*//g requirements.txt && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
|
||||
ADD entrypoint /entrypoint
|
||||
|
||||
RUN adduser -u 54000 radio && \
|
||||
adduser radio radio && \
|
||||
chmod 755 /entrypoint && \
|
||||
chown radio:radio /entrypoint && \
|
||||
chown radio /opt/hblink3
|
||||
|
||||
RUN chmod 755 /entrypoint
|
||||
|
||||
USER radio
|
||||
EXPOSE 54000
|
||||
|
||||
ENTRYPOINT [ "/entrypoint" ]
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
+245
@@ -0,0 +1,245 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
inkscape:version="1.0beta1 (d565813, 2019-09-28)"
|
||||
sodipodi:docname="HBlink.svg"
|
||||
id="svg877"
|
||||
height="411.17413"
|
||||
width="1042.9242"
|
||||
viewBox="49.656 217.125 1042.9242 411.17414"
|
||||
version="1.1">
|
||||
<sodipodi:namedview
|
||||
inkscape:current-layer="svg877"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:window-y="23"
|
||||
inkscape:window-x="583"
|
||||
inkscape:cy="48.366866"
|
||||
inkscape:cx="574.39926"
|
||||
inkscape:zoom="1"
|
||||
fit-margin-left="5"
|
||||
fit-margin-bottom="5"
|
||||
fit-margin-right="5"
|
||||
fit-margin-top="5"
|
||||
units="px"
|
||||
inkscape:pagecheckerboard="true"
|
||||
showgrid="false"
|
||||
id="namedview879"
|
||||
inkscape:window-height="1348"
|
||||
inkscape:window-width="1943"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0"
|
||||
guidetolerance="10"
|
||||
gridtolerance="10"
|
||||
objecttolerance="10"
|
||||
borderopacity="1"
|
||||
inkscape:document-rotation="0"
|
||||
bordercolor="#666666"
|
||||
pagecolor="#ffffff" />
|
||||
<defs
|
||||
id="defs837">
|
||||
<font-face
|
||||
overline-thickness="0"
|
||||
overline-position="0"
|
||||
strikethrough-thickness="0"
|
||||
strikethrough-position="0"
|
||||
v-hanging="0"
|
||||
v-mathematical="0"
|
||||
v-alphabetic="0"
|
||||
v-ideographic="0"
|
||||
hanging="0"
|
||||
mathematical="0"
|
||||
alphabetic="0"
|
||||
ideographic="0"
|
||||
accent-height="0"
|
||||
stemh="0"
|
||||
stemv="0"
|
||||
id="font-face833"
|
||||
font-weight="400"
|
||||
descent="-255.00488"
|
||||
ascent="945.0073"
|
||||
cap-height="669"
|
||||
x-height="669"
|
||||
slope="0"
|
||||
underline-thickness="20"
|
||||
underline-position="-133"
|
||||
units-per-em="1000"
|
||||
panose-1="2 0 6 0 0 0 0 0 0 0"
|
||||
font-size="96"
|
||||
font-family="Ethnocentric">
|
||||
<font-face-src>
|
||||
<font-face-name
|
||||
name="EthnocentricRg-Regular" />
|
||||
</font-face-src>
|
||||
</font-face>
|
||||
<font-face
|
||||
overline-thickness="0"
|
||||
overline-position="0"
|
||||
strikethrough-thickness="0"
|
||||
strikethrough-position="0"
|
||||
v-hanging="0"
|
||||
v-mathematical="0"
|
||||
v-alphabetic="0"
|
||||
v-ideographic="0"
|
||||
hanging="0"
|
||||
mathematical="0"
|
||||
alphabetic="0"
|
||||
ideographic="0"
|
||||
accent-height="0"
|
||||
stemh="0"
|
||||
stemv="0"
|
||||
id="font-face835"
|
||||
font-weight="400"
|
||||
descent="-255.00488"
|
||||
ascent="945.0073"
|
||||
cap-height="669"
|
||||
x-height="669"
|
||||
slope="0"
|
||||
underline-thickness="20"
|
||||
underline-position="-133"
|
||||
units-per-em="1000"
|
||||
panose-1="2 0 6 0 0 0 0 0 0 0"
|
||||
font-size="48"
|
||||
font-family="Ethnocentric">
|
||||
<font-face-src>
|
||||
<font-face-name
|
||||
name="EthnocentricRg-Regular" />
|
||||
</font-face-src>
|
||||
</font-face>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata839"> Produced by OmniGraffle 7.12.1
|
||||
<dc:date>2018-03-14 13:37:44 +0000</dc:date>
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="matrix(3.5262508,0,0,3.5262508,-159.40153,-655.56235)"
|
||||
stroke-opacity="1"
|
||||
stroke="none"
|
||||
stroke-dasharray="none"
|
||||
fill-opacity="1"
|
||||
fill="none"
|
||||
id="Canvas_2">
|
||||
<title
|
||||
id="title841">Canvas 2</title>
|
||||
<g
|
||||
id="Canvas_2: Layer 1">
|
||||
<title
|
||||
id="title843">Layer 1</title>
|
||||
<g
|
||||
id="Group_40">
|
||||
<g
|
||||
id="Graphic_39">
|
||||
<title
|
||||
id="title845">path6007</title>
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path847"
|
||||
stroke-width="3"
|
||||
stroke-linejoin="round"
|
||||
stroke-linecap="round"
|
||||
stroke="#009051"
|
||||
d="m 72.52062,328.5 h 225.5218 c 6.17355,0 11.1782,5.00465 11.1782,11.1782 v 0 c 0,6.17355 -5.00465,11.1782 -11.1782,11.1782 H 72.52062 c -6.17355,0 -11.1782,-5.00465 -11.1782,-11.1782 v 0 c 0,-6.17355 5.00465,-11.1782 11.1782,-11.1782 z" />
|
||||
</g>
|
||||
<g
|
||||
id="Graphic_38">
|
||||
<g
|
||||
style="fill:#009051"
|
||||
id="text852"
|
||||
transform="translate(54.656,222.125)"
|
||||
aria-label="HB">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path881"
|
||||
style="font-weight:400;font-size:96px;font-family:Ethnocentric;fill:#009051"
|
||||
d="M 84,91 H 64.224 V 66.232 H 26.016 V 91 H 6.048 V 26.776 H 26.016 V 49.528 H 64.224 V 26.776 H 84 Z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path883"
|
||||
style="font-weight:400;font-size:96px;font-family:Ethnocentric;fill:#009051"
|
||||
d="m 168.7155,57.976 q 4.224,1.248 7.104,4.896 2.976,3.648 2.976,9.408 0,4.032 -1.248,7.488 -1.248,3.36 -4.224,5.856 -2.976,2.496 -8.064,3.936 -4.992,1.44 -12.576,1.44 H 96.2355 V 51.928 h 56.832 q 2.208,0 3.84,-0.864 1.728,-0.96 1.728,-3.456 0,-2.4 -1.728,-3.264 -1.728,-0.864 -3.84,-0.864 h -56.832 l 13.44,-16.704 h 42.528 q 5.76,0 10.368,1.152 4.704,1.056 7.968,3.36 3.36,2.208 5.088,5.568 1.824,3.264 1.824,7.68 0,2.88 -0.768,5.088 -0.768,2.208 -2.016,3.936 -1.152,1.632 -2.784,2.784 -1.536,1.056 -3.168,1.632 z m -52.512,7.68 v 8.832 h 36.576 q 3.264,0 4.704,-1.152 1.44,-1.152 1.44,-3.36 0,-2.112 -1.44,-3.168 -1.44,-1.152 -4.704,-1.152 z" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="Graphic_37">
|
||||
<g
|
||||
style="fill:#ff9300"
|
||||
id="text857"
|
||||
transform="translate(209.109,275)"
|
||||
aria-label="link">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path886"
|
||||
style="font-weight:400;font-size:48px;font-family:Ethnocentric;fill:#ff9300"
|
||||
d="M 3.024,45 Z M 37.824,36.744 31.392,45 H 3.024 V 12.888 h 9.936 v 23.856 z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path888"
|
||||
style="font-weight:400;font-size:48px;font-family:Ethnocentric;fill:#ff9300"
|
||||
d="m 41.32425,45 z m 9.936,0 h -9.936 V 12.888 h 9.936 z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path890"
|
||||
style="font-weight:400;font-size:48px;font-family:Ethnocentric;fill:#ff9300"
|
||||
d="m 57.34875,45 z m 32.688,0.528 q -0.96,0 -1.92,-0.336 -0.912,-0.288 -2.064,-1.392 l -19.68,-17.664 V 45 h -9.024 V 18.36 q 0,-1.584 0.432,-2.736 0.48,-1.152 1.2,-1.872 0.768,-0.72 1.728,-1.056 1.008,-0.336 2.064,-0.336 0.912,0 1.824,0.336 0.96,0.288 2.16,1.392 l 19.68,17.664 V 12.888 h 9.072 V 39.48 q 0,1.584 -0.48,2.736 -0.432,1.152 -1.2,1.92 -0.72,0.72 -1.728,1.056 -1.008,0.336 -2.064,0.336 z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path892"
|
||||
style="font-weight:400;font-size:48px;font-family:Ethnocentric;fill:#ff9300"
|
||||
d="m 101.36775,45 z m 40.512,0 h -15.024 l -9.696,-8.448 q -2.496,-2.16 -3.84,-3.36 -1.296,-1.2 -2.112,-2.016 0.048,1.104 0.096,2.304 0.048,1.152 0.048,2.304 V 45 h -9.984 V 12.888 h 9.984 v 7.44 q 0,1.488 -0.048,2.928 -0.048,1.44 -0.144,2.688 0.96,-0.864 2.304,-2.112 1.392,-1.296 3.6,-3.12 l 9.264,-7.824 h 14.4 l -12.288,9.216 q -1.584,1.2 -2.832,2.112 -1.2,0.912 -2.16,1.584 -0.96,0.672 -1.776,1.2 -0.768,0.528 -1.536,1.008 1.392,0.96 3.36,2.4 1.968,1.44 5.088,3.984 z" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="Graphic_36">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 302.0625,336.9375 h 14.5771 v 6.1875 h -14.5771 z"
|
||||
style="fill:#ffffff"
|
||||
id="rect860" />
|
||||
</g>
|
||||
<g
|
||||
id="Graphic_35">
|
||||
<title
|
||||
id="title863">path6381</title>
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path865"
|
||||
stroke-width="3"
|
||||
stroke-linejoin="round"
|
||||
stroke-linecap="round"
|
||||
stroke="#ff9300"
|
||||
d="M 116.9282,340.3125 H 342.45 c 6.17355,0 11.1782,5.00465 11.1782,11.1782 v 0 c 0,6.17355 -5.00465,11.1782 -11.1782,11.1782 H 116.9282 c -6.17355,0 -11.1782,-5.00465 -11.1782,-11.1782 v 0 c 0,-6.17355 5.00465,-11.1782 11.1782,-11.1782 z" />
|
||||
</g>
|
||||
<g
|
||||
id="Graphic_34">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 99,347.625 h 14.5771 v 6.1875 H 99 Z"
|
||||
style="fill:#ffffff"
|
||||
id="rect868" />
|
||||
</g>
|
||||
<g
|
||||
id="Line_33">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 93.9375,350.85641 H 120.375"
|
||||
style="stroke:#009051;stroke-width:3;stroke-linecap:round;stroke-linejoin:round"
|
||||
id="line871" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.1 KiB |
@@ -1,3 +1,61 @@
|
||||

|
||||
|
||||
HBNet is a fork of [HBlink3](https://github.com/HBLink-org/hblink3) that extends the functionality of HBLink through several features, making it more of a usable application and less of a framework. HBNet aims to be complete and ready to use application that can be used to build and run a DMR network.
|
||||
|
||||
HBNet consists of 2 parts, HBNet Web Service and the actual DMR server, based on HBLink. The HBNet Web Service handles user administration, server configuration, and is a content management system for your DMR network.
|
||||
|
||||
This project originally started as a not so simple set of scripts to decode GPS locations and generate APRS positions. Through other modifications and additions, it has grown into a fully featured fork.
|
||||
|
||||
|
||||
### User end features:
|
||||
|
||||
* Handles user registration and email verification
|
||||
|
||||
* Individual hotspot passphrases for each user
|
||||
|
||||
* Automatic retrieval of DMR IDs on registration
|
||||
|
||||
* Automatically generate talkgroup pages
|
||||
|
||||
* Automatically generates a script for Pi-Star setup (WORK IN PROGRESS)
|
||||
|
||||
* Map of currently connected peers
|
||||
|
||||
|
||||
### Administrative features:
|
||||
|
||||
* Administrate multiple DMR servers through a single web service
|
||||
|
||||
* Optional manual approval of new users
|
||||
|
||||
* Multiple Admin user logins
|
||||
|
||||
|
||||
### OpenBridge additions
|
||||
|
||||
* Enhanced unit call routing between connected servers. Every server known which server every subscribers is on.
|
||||
|
||||
* Optionally encrypt data sent over OpenBridge
|
||||
|
||||
|
||||
### Data Gateway (APRS/SMS)
|
||||
|
||||
* Compatable with HBNet and original HBLink.
|
||||
|
||||
* Connect your server via OpenBridge or MMDVM.
|
||||
|
||||
* Decodes GPS positions and generates APRS positions
|
||||
|
||||
* Simple web dashboard
|
||||
|
||||
|
||||
|
||||
### Other features
|
||||
|
||||
* SQLite or MySQL backend
|
||||
|
||||
* APRS and SMS features (WORK IN PROGRESS)
|
||||
|
||||
---
|
||||
### FOR SUPPORT, DISCUSSION, GETTING INVOLVED ###
|
||||
|
||||
@@ -5,6 +63,8 @@ Please join the DVSwitch group at groups.io for online forum support, discussion
|
||||
|
||||
DVSwitch@groups.io
|
||||
|
||||
A voluntary registry for HBlink systems with public access has been created at http://hblink-register.com.es Please consider listing your system if you allow open access.
|
||||
|
||||
---
|
||||
|
||||
## PROJECT: Open Source HomeBrew Repeater Proctol Client/Master. ##
|
||||
@@ -13,7 +73,7 @@ DVSwitch@groups.io
|
||||
|
||||
**PURPOSE:** Thanks to the work of Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT we have an open protocol for internetworking DMR repeaters. Unfortunately, there's no generic client and/or master stacks. This project is to build an open-source, python-based implementation. You are free to use this software however you want, however we ask that you provide attribution in some public venue (such as project, club, organization web site). This helps us see where the software is in use and track how it is used.
|
||||
|
||||
For those who will ask: This is a piece of software that implements an open-source, amateur radio networking protocol. It is not a network. It is not indended to be a network. It is not intended to replace or circumvent a network. People do those things, code doesn't.
|
||||
For those who will ask: This is a piece of software that implements an open-source, amateur radio networking protocol. It is not a network. It is not intended to be a network. It is not intended to replace or circumvent a network. People do those things, code doesn't.
|
||||
|
||||
**PROPERTY:**
|
||||
This work represents the author's interpretation of the HomeBrew Repeater Protocol, based on the 2015-07-26 documents from DMRplus, "IPSC Protocol Specs for homebrew DMR repeater" as written by Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT, also licenced under Creative Commons BY-NC-SA license.
|
||||
@@ -24,37 +84,11 @@ None. The owners of this work make absolutely no warranty, express or implied. U
|
||||
**PRE-REQUISITE KNOWLEDGE:**
|
||||
This document assumes the reader is familiar with Linux/UNIX, the Python programming language and DMR.
|
||||
|
||||
**Using docker version**
|
||||
|
||||
To work with provided docker setup you will need:
|
||||
* A private repository with your configuration files (all .cfg files in repo will be copyed to the application root directory on start up)
|
||||
* A service user able to read your private repository (or be brave and publish your configuration, or be really brave and give your username and password to the docker)
|
||||
* A server with docker installed
|
||||
* Follow this simple steps:
|
||||
|
||||
Build your own image from source
|
||||
|
||||
```bash
|
||||
|
||||
docker build . -t millaguie/hblink:3.0.0
|
||||
|
||||
```
|
||||
|
||||
Or user a prebuilt one in docker hub: millaguie/hblink:3.0.0
|
||||
|
||||
Wake up your container
|
||||
|
||||
```bash
|
||||
touch /var/log/hblink.log
|
||||
chown 65000 /var/log/hblink.log
|
||||
run -v /var/log/hblink.log:/var/log/hblink.log -e GIT_USER=$USER -e GIT_PASSWORD=$PASSWORD -e GIT_REPO=$URL_TO_REPO_WITHOUT_HTTPS:// -p 54000:54000 millaguie/hblink:3.0.0
|
||||
```
|
||||
|
||||
**MORE DOCUMENTATION TO COME**
|
||||
|
||||
***0x49 DE N0MJS***
|
||||
|
||||
Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS n0mjs@me.com
|
||||
Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS n0mjs@me.com
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Executable → Regular
Executable
+295
@@ -0,0 +1,295 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
###############################################################################
|
||||
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
#
|
||||
# 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
|
||||
###############################################################################
|
||||
|
||||
'''
|
||||
This is a very simple call/packet router for Homebrew Repeater Protocol. It
|
||||
will forward traffic from any system to all other systems configured in the
|
||||
hblink.py configuration file. It does not check for call contentions or
|
||||
filter TS/TGID combinations. It should really only be used as a proxy to
|
||||
hide multiple Homebrew repater protocol systems behind what appears as a single
|
||||
repeater, hotspot, etc.
|
||||
|
||||
As is, this program only works with group voice packets. It could work for all
|
||||
of them by removing a few things.
|
||||
|
||||
IT ONLY WORKS FOR HBP SYSTEMS!!! Using it with OpenBridge or XLX wouldn't make
|
||||
a lot of sense, and has the potential to do bad things.
|
||||
'''
|
||||
|
||||
# Python modules we need
|
||||
import sys
|
||||
from bitarray import bitarray
|
||||
from time import time
|
||||
from importlib import import_module
|
||||
from types import ModuleType
|
||||
|
||||
# Twisted is pretty important, so I keep it separate
|
||||
from twisted.internet.protocol import Factory, Protocol
|
||||
from twisted.protocols.basic import NetstringReceiver
|
||||
from twisted.internet import reactor, task
|
||||
|
||||
# Things we import from the main hblink module
|
||||
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, config_reports, mk_aliases, acl_check
|
||||
from dmr_utils3.utils import bytes_3, int_id, get_alias
|
||||
from dmr_utils3 import decode, bptc, const
|
||||
import config
|
||||
import log
|
||||
import const
|
||||
|
||||
# The module needs logging logging, but handlers, etc. are controlled by the parent
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
|
||||
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||
__copyright__ = 'Copyright (c) 2016-2018 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
|
||||
__license__ = 'GNU GPLv3'
|
||||
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||
__email__ = 'n0mjs@me.com'
|
||||
__status__ = 'pre-alpha'
|
||||
|
||||
# Module gobal varaibles
|
||||
|
||||
|
||||
class bridgeallSYSTEM(HBSYSTEM):
|
||||
|
||||
def __init__(self, _name, _config, _report):
|
||||
HBSYSTEM.__init__(self, _name, _config, _report)
|
||||
self._laststrid = ''
|
||||
|
||||
# Status information for the system, TS1 & TS2
|
||||
# 1 & 2 are "timeslot"
|
||||
self.STATUS = {
|
||||
1: {
|
||||
'RX_START': time(),
|
||||
'RX_LOSS': 0,
|
||||
'RX_SEQ': 0,
|
||||
'RX_RFS': b'\x00',
|
||||
'TX_RFS': b'\x00',
|
||||
'RX_STREAM_ID': b'\x00',
|
||||
'TX_STREAM_ID': b'\x00',
|
||||
'RX_TGID': b'\x00\x00\x00',
|
||||
'TX_TGID': b'\x00\x00\x00',
|
||||
'RX_TIME': time(),
|
||||
'TX_TIME': time(),
|
||||
'RX_TYPE': const.HBPF_SLT_VTERM,
|
||||
},
|
||||
2: {
|
||||
'RX_START': time(),
|
||||
'RX:LOSS': 0,
|
||||
'RX_SEQ': 0,
|
||||
'RX_RFS': b'\x00',
|
||||
'TX_RFS': b'\x00',
|
||||
'RX_STREAM_ID': b'\x00',
|
||||
'TX_STREAM_ID': b'\x00',
|
||||
'RX_TGID': b'\x00\x00\x00',
|
||||
'TX_TGID': b'\x00\x00\x00',
|
||||
'RX_TIME': time(),
|
||||
'TX_TIME': time(),
|
||||
'RX_TYPE': const.HBPF_SLT_VTERM,
|
||||
}
|
||||
}
|
||||
|
||||
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
|
||||
pkt_time = time()
|
||||
dmrpkt = _data[20:53]
|
||||
_bits = _data[15]
|
||||
|
||||
if _call_type == 'group':
|
||||
|
||||
# Is this is a new call stream?
|
||||
new_stream = (_stream_id != self.STATUS[_slot]['RX_STREAM_ID'])
|
||||
|
||||
if new_stream:
|
||||
self.STATUS[_slot]['RX_START'] = pkt_time
|
||||
self.STATUS[_slot]['RX_LOSS'] = 0
|
||||
self.STATUS[_slot]['RX_SEQ'] = _seq
|
||||
logger.info('(%s) *CALL START* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s', \
|
||||
self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot)
|
||||
else:
|
||||
# This could be much better, it will have errors during roll-over
|
||||
if _seq > (self.STATUS[_slot]['RX_SEQ'] + 1):
|
||||
#print(_seq, self.STATUS[_slot]['RX_SEQ'])
|
||||
self.STATUS[_slot]['RX_LOSS'] += _seq - (self.STATUS[_slot]['RX_SEQ'] + 1)
|
||||
|
||||
# Final actions - Is this a voice terminator?
|
||||
if (_frame_type == const.HBPF_DATA_SYNC) and (_dtype_vseq == const.HBPF_SLT_VTERM) and (self.STATUS[_slot]['RX_TYPE'] != const.HBPF_SLT_VTERM):
|
||||
call_duration = pkt_time - self.STATUS[_slot]['RX_START']
|
||||
logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Loss: %s, Duration: %s', \
|
||||
self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot, self.STATUS[_slot]['RX_LOSS'], call_duration)
|
||||
|
||||
|
||||
for _target in self._CONFIG['SYSTEMS']:
|
||||
if _target != self._system:
|
||||
|
||||
_target_status = systems[_target].STATUS
|
||||
_target_system = self._CONFIG['SYSTEMS'][_target]
|
||||
|
||||
# BEGIN STANDARD CONTENTION HANDLING
|
||||
#
|
||||
# The rules for each of the 4 "ifs" below are listed here for readability. The Frame To Send is:
|
||||
# From a different group than last RX from this HBSystem, but it has been less than Group Hangtime
|
||||
# From a different group than last TX to this HBSystem, but it has been less than Group Hangtime
|
||||
# From the same group as the last RX from this HBSystem, but from a different subscriber, and it has been less than stream timeout
|
||||
# From the same group as the last TX to this HBSystem, but from a different subscriber, and it has been less than stream timeout
|
||||
# The "continue" at the end of each means the next iteration of the for loop that tests for matching rules
|
||||
#
|
||||
if ((_dst_id != _target_status[_slot]['RX_TGID']) and ((pkt_time - _target_status[_slot]['RX_TIME']) < _target_system['GROUP_HANGTIME'])):
|
||||
if _frame_type == const.HBPF_DATA_SYNC and _dtype_vseq == const.HBPF_SLT_VHEAD and self.STATUS[_slot]['RX_STREAM_ID'] != _stream_id:
|
||||
logger.info('(%s) Call not routed to TGID %s, target active or in group hangtime: HBSystem: %s, TS: %s, TGID: %s', self._system, int_id(_dst_id), _target, _slot, int_id(_target_status[_slot]['RX_TGID']))
|
||||
continue
|
||||
if ((_dst_id != _target_status[_slot]['TX_TGID']) and ((pkt_time - _target_status[_slot]['TX_TIME']) < _target_system['GROUP_HANGTIME'])):
|
||||
if _frame_type == const.HBPF_DATA_SYNC and _dtype_vseq == const.HBPF_SLT_VHEAD and self.STATUS[_slot]['RX_STREAM_ID'] != _stream_id:
|
||||
logger.info('(%s) Call not routed to TGID%s, target in group hangtime: HBSystem: %s, TS: %s, TGID: %s', self._system, int_id(_dst_id), _target, _slot, int_id(_target_status[_slot]['TX_TGID']))
|
||||
continue
|
||||
if (_dst_id == _target_status[_slot]['RX_TGID']) and ((pkt_time - _target_status[_slot]['RX_TIME']) < const.STREAM_TO):
|
||||
if _frame_type == const.HBPF_DATA_SYNC and _dtype_vseq == const.HBPF_SLT_VHEAD and self.STATUS[_slot]['RX_STREAM_ID'] != _stream_id:
|
||||
logger.info('(%s) Call not routed to TGID%s, matching call already active on target: HBSystem: %s, TS: %s, TGID: %s', self._system, int_id(_dst_id), _target, _slot, int_id(_target_status[_slot]['RX_TGID']))
|
||||
continue
|
||||
if (_dst_id == _target_status[_slot]['TX_TGID']) and (_rf_src != _target_status[_slot]['TX_RFS']) and ((pkt_time - _target_status[_slot]['TX_TIME']) < const.STREAM_TO):
|
||||
if _frame_type == const.HBPF_DATA_SYNC and _dtype_vseq == const.HBPF_SLT_VHEAD and self.STATUS[_slot]['RX_STREAM_ID'] != _stream_id:
|
||||
logger.info('(%s) Call not routed for subscriber %s, call route in progress on target: HBSystem: %s, TS: %s, TGID: %s, SUB: %s', self._system, int_id(_rf_src), _target, _slot, int_id(_target_status[_slot]['TX_TGID']), int_id(_target_status[_slot]['TX_RFS']))
|
||||
continue
|
||||
|
||||
|
||||
# ACL Processing
|
||||
if self._CONFIG['GLOBAL']['USE_ACL']:
|
||||
if not acl_check(_rf_src, self._CONFIG['GLOBAL']['SUB_ACL']):
|
||||
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
|
||||
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', _target, int_id(_stream_id), int_id(_rf_src))
|
||||
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
|
||||
continue
|
||||
if _slot == 1 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG1_ACL']):
|
||||
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
|
||||
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', _target, int_id(_stream_id), int_id(_dst_id))
|
||||
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
|
||||
continue
|
||||
if _slot == 2 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG2_ACL']):
|
||||
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
|
||||
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s ON TGID %s BY GLOBAL TS2 ACL', _target, int_id(_stream_id), int_id(_dst_id))
|
||||
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
|
||||
continue
|
||||
if _target_system['USE_ACL']:
|
||||
if not acl_check(_rf_src, _target_system['SUB_ACL']):
|
||||
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
|
||||
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', _target, int_id(_stream_id), int_id(_rf_src))
|
||||
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
|
||||
continue
|
||||
if _slot == 1 and not acl_check(_dst_id, _target_system['TG1_ACL']):
|
||||
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
|
||||
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s ON TGID %s BY SYSTEM TS1 ACL', _target, int_id(_stream_id), int_id(_dst_id))
|
||||
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
|
||||
continue
|
||||
if _slot == 2 and not acl_check(_dst_id, _target_system['TG2_ACL']):
|
||||
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
|
||||
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s ON TGID %s BY SYSTEM TS2 ACL', _target, int_id(_stream_id), int_id(_dst_id))
|
||||
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
|
||||
continue
|
||||
|
||||
# Record this stuff for later
|
||||
# Is this a new call stream?
|
||||
if new_stream:
|
||||
# Record the DST TGID and Stream ID
|
||||
_target_status[_slot]['TX_START'] = pkt_time
|
||||
_target_status[_slot]['TX_TGID'] = _dst_id
|
||||
_target_status[_slot]['TX_RFS'] = _rf_src
|
||||
_target_status[_slot]['TX_PEER'] = _peer_id
|
||||
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
|
||||
|
||||
_target_status[_slot]['TX_TIME'] = pkt_time
|
||||
|
||||
systems[_target].send_system(_data)
|
||||
#logger.debug('(%s) Packet routed to system: %s', self._system, _target)
|
||||
|
||||
# Mark status variables for use later
|
||||
self.STATUS[_slot]['RX_RFS'] = _rf_src
|
||||
self.STATUS[_slot]['RX_SEQ'] = _seq
|
||||
self.STATUS[_slot]['RX_TYPE'] = _dtype_vseq
|
||||
self.STATUS[_slot]['RX_TGID'] = _dst_id
|
||||
self.STATUS[_slot]['RX_TIME'] = pkt_time
|
||||
self.STATUS[_slot]['RX_STREAM_ID'] = _stream_id
|
||||
|
||||
|
||||
#************************************************
|
||||
# MAIN PROGRAM LOOP STARTS HERE
|
||||
#************************************************
|
||||
|
||||
if __name__ == '__main__':
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
import signal
|
||||
from dmr_utils3.utils import try_download, mk_id_dict
|
||||
|
||||
# Change the current directory to the location of the application
|
||||
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
|
||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)')
|
||||
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||
cli_args = parser.parse_args()
|
||||
|
||||
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
|
||||
if not cli_args.CONFIG_FILE:
|
||||
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
|
||||
|
||||
# Call the external routine to build the configuration dictionary
|
||||
CONFIG = config.build_config(cli_args.CONFIG_FILE)
|
||||
|
||||
# Start the system logger
|
||||
if cli_args.LOG_LEVEL:
|
||||
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||
logger = log.config_logging(CONFIG['LOGGER'])
|
||||
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n')
|
||||
logger.debug('Logging system started, anything from here on gets logged')
|
||||
|
||||
# Set up the signal handler
|
||||
def sig_handler(_signal, _frame):
|
||||
logger.info('SHUTDOWN: BRIDGE_ALL IS TERMINATING WITH SIGNAL %s', str(_signal))
|
||||
hblink_handler(_signal, _frame)
|
||||
logger.info('SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
|
||||
reactor.stop()
|
||||
|
||||
# Set signal handers so that we can gracefully exit if need be
|
||||
for sig in [signal.SIGTERM, signal.SIGINT]:
|
||||
signal.signal(sig, sig_handler)
|
||||
|
||||
# Create the name-number mapping dictionaries
|
||||
peer_ids, subscriber_ids, talkgroup_ids = mk_aliases(CONFIG)
|
||||
|
||||
# INITIALIZE THE REPORTING LOOP
|
||||
report_server = config_reports(CONFIG, reportFactory)
|
||||
|
||||
# HBlink instance creation
|
||||
logger.info('HBlink \'bridge_all.py\' -- SYSTEM STARTING...')
|
||||
for system in CONFIG['SYSTEMS']:
|
||||
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
||||
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
|
||||
logger.critical('%s FATAL: Instance is mode \'OPENBRIDGE\', \n\t\t...Which would be tragic for Bridge All, since it carries multiple call\n\t\tstreams simultaneously. bridge_all.py onlyl works with MMDVM-based systems', system)
|
||||
sys.exit('bridge_all.py cannot function with systems that are not MMDVM devices. System {} is configured as an OPENBRIDGE'.format(system))
|
||||
else:
|
||||
systems[system] = bridgeallSYSTEM(system, CONFIG, report_server)
|
||||
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
|
||||
logger.debug('%s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
|
||||
|
||||
reactor.run()
|
||||
@@ -68,6 +68,8 @@ def acl_build(_acl, _max):
|
||||
return(True, set((const.ID_MIN, _max)))
|
||||
|
||||
acl = [] #set()
|
||||
if type(_acl) == tuple:
|
||||
_acl = ''.join(_acl)
|
||||
sections = _acl.split(':')
|
||||
|
||||
if sections[0] == 'PERMIT':
|
||||
@@ -86,7 +88,7 @@ def acl_build(_acl, _max):
|
||||
if (const.ID_MIN <= start <= _max) or (const.ID_MIN <= end <= _max):
|
||||
acl.append((start, end))
|
||||
else:
|
||||
sys.exit('ACL CREATION ERROR, VALUE OUT OF RANGE (} - {})IN RANGE-BASED ENTRY: {}'.format(const.ID_MIN, _max, entry))
|
||||
sys.exit('ACL CREATION ERROR, VALUE OUT OF RANGE ({} - {})IN RANGE-BASED ENTRY: {}'.format(const.ID_MIN, _max, entry))
|
||||
else:
|
||||
id = int(entry)
|
||||
if (const.ID_MIN <= id <= _max):
|
||||
@@ -107,6 +109,7 @@ def build_config(_config_file):
|
||||
CONFIG['REPORTS'] = {}
|
||||
CONFIG['LOGGER'] = {}
|
||||
CONFIG['ALIASES'] = {}
|
||||
CONFIG['WEB_SERVICE'] = {}
|
||||
CONFIG['SYSTEMS'] = {}
|
||||
|
||||
try:
|
||||
@@ -153,6 +156,26 @@ def build_config(_config_file):
|
||||
'STALE_TIME': config.getint(section, 'STALE_DAYS') * 86400,
|
||||
})
|
||||
|
||||
elif section == 'WEB_SERVICE':
|
||||
CONFIG['WEB_SERVICE'].update({
|
||||
'THIS_SERVER_NAME': config.get(section, 'THIS_SERVER_NAME'),
|
||||
'URL': config.get(section, 'URL'),
|
||||
'REMOTE_CONFIG_ENABLED': config.getboolean(section, 'REMOTE_CONFIG_ENABLED'),
|
||||
'APPEND_INT': config.getint(section, 'APPEND_INT'),
|
||||
'EXTRA_INT_1': config.getint(section, 'EXTRA_INT_1'),
|
||||
'EXTRA_INT_2': config.getint(section, 'EXTRA_INT_2'),
|
||||
'EXTRA_1': config.get(section, 'EXTRA_1'),
|
||||
'EXTRA_2': config.get(section, 'EXTRA_2'),
|
||||
'SHARED_SECRET': config.get(section, 'SHARED_SECRET'),
|
||||
'SHORTEN_PASSPHRASE': config.getboolean(section, 'SHORTEN_PASSPHRASE'),
|
||||
'SHORTEN_SAMPLE': config.get(section, 'SHORTEN_SAMPLE'),
|
||||
'SHORTEN_LENGTH': config.get(section, 'SHORTEN_LENGTH'),
|
||||
'BURN_FILE': config.get(section, 'BURN_FILE'),
|
||||
'BURN_INT': config.getint(section, 'BURN_INT'),
|
||||
|
||||
|
||||
})
|
||||
|
||||
elif config.getboolean(section, 'ENABLED'):
|
||||
if config.get(section, 'MODE') == 'PEER':
|
||||
CONFIG['SYSTEMS'].update({section: {
|
||||
@@ -182,11 +205,13 @@ def build_config(_config_file):
|
||||
'SOFTWARE_ID': bytes(config.get(section, 'SOFTWARE_ID').ljust(40)[:40], 'utf-8'),
|
||||
'PACKAGE_ID': bytes(config.get(section, 'PACKAGE_ID').ljust(40)[:40], 'utf-8'),
|
||||
'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'),
|
||||
'OPTIONS': bytes(config.get(section, 'OPTIONS'), 'utf-8'),
|
||||
'OPTIONS': b''.join([b'Type=HBNet;', bytes(config.get(section, 'OPTIONS'), 'utf-8')]),
|
||||
'USE_ACL': config.getboolean(section, 'USE_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TGID_TS1_ACL'),
|
||||
'TG2_ACL': config.get(section, 'TGID_TS2_ACL')
|
||||
'TG2_ACL': config.get(section, 'TGID_TS2_ACL'),
|
||||
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
|
||||
|
||||
}})
|
||||
CONFIG['SYSTEMS'][section].update({'STATS': {
|
||||
'CONNECTION': 'NO', # NO, RTPL_SENT, AUTHENTICATED, CONFIG-SENT, YES
|
||||
@@ -232,7 +257,9 @@ def build_config(_config_file):
|
||||
'USE_ACL': config.getboolean(section, 'USE_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TGID_TS1_ACL'),
|
||||
'TG2_ACL': config.get(section, 'TGID_TS2_ACL')
|
||||
'TG2_ACL': config.get(section, 'TGID_TS2_ACL'),
|
||||
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
|
||||
|
||||
}})
|
||||
CONFIG['SYSTEMS'][section].update({'XLXSTATS': {
|
||||
'CONNECTION': 'NO', # NO, RTPL_SENT, AUTHENTICATED, CONFIG-SENT, YES
|
||||
@@ -249,6 +276,7 @@ def build_config(_config_file):
|
||||
CONFIG['SYSTEMS'].update({section: {
|
||||
'MODE': config.get(section, 'MODE'),
|
||||
'ENABLED': config.getboolean(section, 'ENABLED'),
|
||||
'USE_USER_MAN': config.getboolean(section, 'USE_USER_MAN'),
|
||||
'REPEAT': config.getboolean(section, 'REPEAT'),
|
||||
'MAX_PEERS': config.getint(section, 'MAX_PEERS'),
|
||||
'IP': gethostbyname(config.get(section, 'IP')),
|
||||
@@ -259,7 +287,8 @@ def build_config(_config_file):
|
||||
'REG_ACL': config.get(section, 'REG_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TGID_TS1_ACL'),
|
||||
'TG2_ACL': config.get(section, 'TGID_TS2_ACL')
|
||||
'TG2_ACL': config.get(section, 'TGID_TS2_ACL'),
|
||||
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
|
||||
}})
|
||||
CONFIG['SYSTEMS'][section].update({'PEERS': {}})
|
||||
|
||||
@@ -274,12 +303,36 @@ def build_config(_config_file):
|
||||
'TARGET_SOCK': (gethostbyname(config.get(section, 'TARGET_IP')), config.getint(section, 'TARGET_PORT')),
|
||||
'TARGET_IP': gethostbyname(config.get(section, 'TARGET_IP')),
|
||||
'TARGET_PORT': config.getint(section, 'TARGET_PORT'),
|
||||
'BOTH_SLOTS': config.getboolean(section, 'BOTH_SLOTS'),
|
||||
'USE_ACL': config.getboolean(section, 'USE_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TGID_ACL'),
|
||||
'TG2_ACL': 'PERMIT:ALL'
|
||||
'TG2_ACL': 'PERMIT:ALL',
|
||||
'USE_ENCRYPTION': config.getboolean(section, 'USE_ENCRYPTION'),
|
||||
'ENCRYPTION_KEY': bytes(config.get(section, 'ENCRYPTION_KEY'), 'utf-8'),
|
||||
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
|
||||
}})
|
||||
|
||||
elif config.get(section, 'MODE') == 'PROXY':
|
||||
CONFIG['SYSTEMS'].update({section: {
|
||||
'MODE': config.get(section, 'MODE'),
|
||||
'ENABLED': config.getboolean(section, 'ENABLED'),
|
||||
'EXTERNAL_PROXY_SCRIPT': config.getboolean(section, 'EXTERNAL_PROXY_SCRIPT'),
|
||||
'STATIC_APRS_POSITION_ENABLED': config.getboolean(section, 'STATIC_APRS_POSITION_ENABLED'),
|
||||
'USE_USER_MAN': config.getboolean(section, 'USE_USER_MAN'),
|
||||
'REPEAT': config.getboolean(section, 'REPEAT'),
|
||||
'PASSPHRASE': bytes(config.get(section, 'PASSPHRASE'), 'utf-8'),
|
||||
'EXTERNAL_PORT': config.getint(section, 'EXTERNAL_PORT'),
|
||||
'INTERNAL_PORT_START': config.getint(section, 'INTERNAL_PORT_START'),
|
||||
'INTERNAL_PORT_STOP': config.getint(section, 'INTERNAL_PORT_STOP'),
|
||||
'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'),
|
||||
'USE_ACL': config.getboolean(section, 'USE_ACL'),
|
||||
'REG_ACL': config.get(section, 'REG_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TG1_ACL'),
|
||||
'TG2_ACL': config.get(section, 'TG2_ACL'),
|
||||
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
|
||||
}})
|
||||
CONFIG['SYSTEMS'][section].update({'PEERS': {}})
|
||||
|
||||
except configparser.Error as err:
|
||||
sys.exit('Error processing configuration file -- {}'.format(err))
|
||||
|
||||
@@ -50,6 +50,7 @@ HBPF_SLT_VHEAD = 0x1
|
||||
HBPF_SLT_VTERM = 0x2
|
||||
|
||||
# HomeBrew Protocol Commands
|
||||
DMRA = b'DMRA'
|
||||
DMRD = b'DMRD'
|
||||
MSTCL = b'MSTCL'
|
||||
MSTNAK = b'MSTNAK'
|
||||
@@ -68,6 +69,10 @@ RPTP = b'RPTP'
|
||||
RPTA = b'RPTA'
|
||||
RPTO = b'RPTO'
|
||||
|
||||
# Sever Data and Encrypted OBP
|
||||
SVRD = b'SVRD'
|
||||
EOBP = b'EOBP'
|
||||
|
||||
|
||||
# Higheset peer ID permitted by HBP
|
||||
PEER_MAX = 4294967295
|
||||
|
||||
@@ -0,0 +1,363 @@
|
||||
# PROGRAM-WIDE PARAMETERS GO HERE
|
||||
# PATH - working path for files, leave it alone unless you NEED to change it
|
||||
# PING_TIME - the interval that peers will ping the master, and re-try registraion
|
||||
# - how often the Master maintenance loop runs
|
||||
# MAX_MISSED - how many pings are missed before we give up and re-register
|
||||
# - number of times the master maintenance loop runs before de-registering a peer
|
||||
#
|
||||
# ACLs:
|
||||
#
|
||||
# Access Control Lists are a very powerful tool for administering your system.
|
||||
# But they consume packet processing time. Disable them if you are not using them.
|
||||
# But be aware that, as of now, the configuration stanzas still need the ACL
|
||||
# sections configured even if you're not using them.
|
||||
#
|
||||
# REGISTRATION ACLS ARE ALWAYS USED, ONLY SUBSCRIBER AND TGID MAY BE DISABLED!!!
|
||||
#
|
||||
# The 'action' May be PERMIT|DENY
|
||||
# Each entry may be a single radio id, or a hypenated range (e.g. 1-2999)
|
||||
# Format:
|
||||
# ACL = 'action:id|start-end|,id|start-end,....'
|
||||
# --for example--
|
||||
# SUB_ACL: DENY:1,1000-2000,4500-60000,17
|
||||
#
|
||||
# ACL Types:
|
||||
# REG_ACL: peer radio IDs for registration (only used on HBP master systems)
|
||||
# SUB_ACL: subscriber IDs for end-users
|
||||
# TGID_TS1_ACL: destination talkgroup IDs on Timeslot 1
|
||||
# TGID_TS2_ACL: destination talkgroup IDs on Timeslot 2
|
||||
#
|
||||
# ACLs may be repeated for individual systems if needed for granularity
|
||||
# Global ACLs will be processed BEFORE the system level ACLs
|
||||
# Packets will be matched against all ACLs, GLOBAL first. If a packet 'passes'
|
||||
# All elements, processing continues. Packets are discarded at the first
|
||||
# negative match, or 'reject' from an ACL element.
|
||||
#
|
||||
# If you do not wish to use ACLs, set them to 'PERMIT:ALL'
|
||||
# TGID_TS1_ACL in the global stanza is used for OPENBRIDGE systems, since all
|
||||
# traffic is passed as TS 1 between OpenBridges
|
||||
[GLOBAL]
|
||||
PATH: ./
|
||||
PING_TIME: 5
|
||||
MAX_MISSED: 3
|
||||
USE_ACL: True
|
||||
REG_ACL: PERMIT:ALL
|
||||
SUB_ACL: DENY:1
|
||||
TGID_TS1_ACL: PERMIT:ALL
|
||||
TGID_TS2_ACL: PERMIT:ALL
|
||||
|
||||
|
||||
# NOT YET WORKING: NETWORK REPORTING CONFIGURATION
|
||||
# Enabling "REPORT" will configure a socket-based reporting
|
||||
# system that will send the configuration and other items
|
||||
# to a another process (local or remote) that may process
|
||||
# the information for some useful purpose, like a web dashboard.
|
||||
#
|
||||
# REPORT - True to enable, False to disable
|
||||
# REPORT_INTERVAL - Seconds between reports
|
||||
# REPORT_PORT - TCP port to listen on if "REPORT_NETWORKS" = NETWORK
|
||||
# REPORT_CLIENTS - comma separated list of IPs you will allow clients
|
||||
# to connect on. Entering a * will allow all.
|
||||
#
|
||||
# ****FOR NOW MUST BE TRUE - USE THE LOOPBACK IF YOU DON'T USE THIS!!!****
|
||||
[REPORTS]
|
||||
REPORT: True
|
||||
REPORT_INTERVAL: 60
|
||||
REPORT_PORT: 4329
|
||||
REPORT_CLIENTS: 127.0.0.1
|
||||
|
||||
|
||||
# SYSTEM LOGGER CONFIGURAITON
|
||||
# This allows the logger to be configured without chaning the individual
|
||||
# python logger stuff. LOG_FILE should be a complete path/filename for *your*
|
||||
# system -- use /dev/null for non-file handlers.
|
||||
# LOG_HANDLERS may be any of the following, please, no spaces in the
|
||||
# list if you use several:
|
||||
# null
|
||||
# console
|
||||
# console-timed
|
||||
# file
|
||||
# file-timed
|
||||
# syslog
|
||||
# LOG_LEVEL may be any of the standard syslog logging levels, though
|
||||
# as of now, DEBUG, INFO, WARNING and CRITICAL are the only ones
|
||||
# used.
|
||||
#
|
||||
[LOGGER]
|
||||
LOG_FILE: /tmp/hblink.log
|
||||
LOG_HANDLERS: console-timed
|
||||
LOG_LEVEL: DEBUG
|
||||
LOG_NAME: HBlink
|
||||
|
||||
# DOWNLOAD AND IMPORT SUBSCRIBER, PEER and TGID ALIASES
|
||||
# Ok, not the TGID, there's no master list I know of to download
|
||||
# This is intended as a facility for other applcations built on top of
|
||||
# HBlink to use, and will NOT be used in HBlink directly.
|
||||
# STALE_DAYS is the number of days since the last download before we
|
||||
# download again. Don't be an ass and change this to less than a few days.
|
||||
[ALIASES]
|
||||
TRY_DOWNLOAD: True
|
||||
PATH: ./
|
||||
PEER_FILE: peer_ids.json
|
||||
SUBSCRIBER_FILE: subscriber_ids.json
|
||||
TGID_FILE: talkgroup_ids.json
|
||||
PEER_URL: https://www.radioid.net/static/rptrs.json
|
||||
SUBSCRIBER_URL: https://www.radioid.net/static/users.json
|
||||
STALE_DAYS: 7
|
||||
|
||||
# USER MANAGER
|
||||
# This is where to configure the details for use with a user managment script
|
||||
[WEB_SERVICE]
|
||||
THIS_SERVER_NAME: DATA_GATEWAY
|
||||
REMOTE_CONFIG_ENABLED: False
|
||||
# URL of the user managment server
|
||||
URL: http://localhost:8080/svr
|
||||
# Integer appended to DMR ID during the generation of a passphrase
|
||||
APPEND_INT: 1
|
||||
EXTRA_INT_1: 5
|
||||
EXTRA_INT_2: 8
|
||||
EXTRA_1: TeSt
|
||||
EXTRA_2: DmR4
|
||||
# Secret used to authenticate with user managment server, before checking if user login is approved
|
||||
SHARED_SECRET: test
|
||||
# Shorten passphrases
|
||||
SHORTEN_PASSPHRASE: True
|
||||
SHORTEN_SAMPLE: 4
|
||||
SHORTEN_LENGTH: 4
|
||||
BURN_FILE: ./burn_ids.txt
|
||||
BURN_INT: 5
|
||||
|
||||
[DATA_CONFIG]
|
||||
DATA_DMR_ID: 9099
|
||||
CALL_TYPE: both
|
||||
UNIT_SMS_TS: 2
|
||||
|
||||
USER_APRS_SSID: 5
|
||||
USER_APRS_COMMENT: HBNet APRS Gateway
|
||||
APRS_SERVER: hbl.ink
|
||||
APRS_PORT: 14580
|
||||
APRS_LOGIN_CALL: N0CALL
|
||||
APRS_LOGIN_PASSCODE: 12345
|
||||
APRS_FILTER: r/47/-120/500 t/m
|
||||
|
||||
# The following settings are only applicable if you are using the gps_data_beacon_igate script.
|
||||
# They do not affect the operation gps_data itself.
|
||||
# Time in minutes.
|
||||
IGATE_BEACON_TIME = 45
|
||||
IGATE_BEACON_COMMENT = HBLink3 D-APRS Gateway
|
||||
IGATE_BEACON_ICON = /I
|
||||
IGATE_LATITUDE = 4730. N
|
||||
IGATE_LONGITUDE = 11930. W
|
||||
|
||||
# The following settings are for the static positions only, for hotspots or repeaters connected to MASTER stanzas.
|
||||
# Implementation by IU7IGU
|
||||
# REPORT_INTERVAL in Minute (ALLOW only > 3 Minutes)
|
||||
# MESSAGE: This message will print on APRS description together RX and TX Frequency
|
||||
APRS_STATIC_REPORT_INTERVAL: 15
|
||||
APRS_STATIC_MESSAGE:Connected to HBLink
|
||||
|
||||
# The options below are required for operation of the dashboard and will cause errors in gps_data.py
|
||||
# if configured wrong. Leave them as default unless you know what you are doing.
|
||||
# If you do change, you must use absolute paths.
|
||||
LOCATION_FILE: /tmp/gps_data_user_loc.txt
|
||||
BULLETIN_BOARD_FILE: /tmp/gps_data_user_bb.txt
|
||||
MAILBOX_FILE: /tmp/gps_data_user_mailbox.txt
|
||||
EMERGENCY_SOS_FILE: /tmp/gps_data_user_sos.txt
|
||||
SMS_FILE: /tmp/gps_data_user_sms.txt
|
||||
|
||||
# User settings file, MUST configure using absolute path.
|
||||
USER_SETTINGS_FILE: /tmp/user_settings.txt
|
||||
|
||||
# API settings
|
||||
# Authorized Apps file - data used for the dashboard API
|
||||
USE_API: True
|
||||
AUTHORIZED_APPS_FILE: /tmp/authorized_apps.txt
|
||||
AUTHORIZED_TOKENS_FILE: /tmp/hblink_auth_tokens.txt
|
||||
AUTHORIZED_USERS_FILE: /home/eric/Sync/hblink3_sms_dev/authorized_users.txt
|
||||
ACCESS_SYSTEMS_FILE: /home/eric/Sync/hblink3_sms_dev/access_systems.txt
|
||||
MY_SERVER_SHORTCUT: XYZ
|
||||
SERVER_NAME: Test HBLink Network
|
||||
USE_PUBLIC_APPS: True
|
||||
PUBLIC_APPS_LIST: https://raw.githubusercontent.com/kf7eel/hblink_sms_external_apps/main/public_systems.txt
|
||||
RULES_PATH: /home/eric/Sync/hblink3_sms_dev/rules.py
|
||||
|
||||
# The following options are used for the dashboard. The dashboard is optional.
|
||||
# Title of the Dashboard
|
||||
DASHBOARD_TITLE: HBNet D-APRS Dashboard
|
||||
# Used for API, RSS feed link, etc
|
||||
DASHBOARD_URL: http://localhost:8092
|
||||
|
||||
# Logo used on dashboard page
|
||||
LOGO: https://raw.githubusercontent.com/kf7eel/hblink3/gps/HBlink.png
|
||||
|
||||
# Port to run server
|
||||
DASH_PORT: 8092
|
||||
|
||||
# IP to run server on
|
||||
DASH_HOST: 127.0.0.1
|
||||
|
||||
#Description of dashboard to show on main page
|
||||
DESCRIPTION: Welcome to the dashboard.
|
||||
|
||||
# Gateway contact info displayed on about page.
|
||||
CONTACT_NAME: your name
|
||||
CONTACT_CALL: N0CALL
|
||||
CONTACT_EMAIL: email@example.org
|
||||
CONTACT_WEBSITE: https://hbl.ink
|
||||
|
||||
# Time format for display
|
||||
TIME_FORMAT: %%H:%%M:%%S - %%m/%%d/%%y
|
||||
|
||||
# Center dashboard map over these coordinates
|
||||
MAP_CENTER_LAT: 47.00
|
||||
MAP_CENTER_LON: -120.00
|
||||
ZOOM_LEVEL: 7
|
||||
|
||||
# List and preview of some map themes at http://leaflet-extras.github.io/leaflet-providers/preview/
|
||||
# The following are options for map themes and just work, you should use one of these: “OpenStreetMap”, “Stamen” (Terrain, Toner, and Watercolor),
|
||||
MAP_THEME: Stamen Toner
|
||||
|
||||
|
||||
# OPENBRIDGE INSTANCES - DUPLICATE SECTION FOR MULTIPLE CONNECTIONS
|
||||
# OpenBridge is a protocol originall created by DMR+ for connection between an
|
||||
# IPSC2 server and Brandmeister. It has been implemented here at the suggestion
|
||||
# of the Brandmeister team as a way to legitimately connect HBlink to the
|
||||
# Brandemiester network.
|
||||
# It is recommended to name the system the ID of the Brandmeister server that
|
||||
# it connects to, but is not necessary. TARGET_IP and TARGET_PORT are of the
|
||||
# Brandmeister or IPSC2 server you are connecting to. PASSPHRASE is the password
|
||||
# that must be agreed upon between you and the operator of the server you are
|
||||
# connecting to. NETWORK_ID is a number in the format of a DMR Radio ID that
|
||||
# will be sent to the other server to identify this connection.
|
||||
# other parameters follow the other system types.
|
||||
#
|
||||
# ACLs:
|
||||
# OpenBridge does not 'register', so registration ACL is meaningless.
|
||||
# Proper OpenBridge passes all traffic on TS1.
|
||||
# HBlink can extend OPB to use both slots for unit calls only.
|
||||
# Setting "BOTH_SLOTS" True ONLY affects unit traffic!
|
||||
# Otherwise ACLs work as described in the global stanza
|
||||
[OBP-1]
|
||||
MODE: OPENBRIDGE
|
||||
ENABLED: True
|
||||
IP:
|
||||
PORT: 62036
|
||||
NETWORK_ID: 1234
|
||||
PASSPHRASE: passw0rd
|
||||
TARGET_IP: 127.0.0.1
|
||||
TARGET_PORT: 62037
|
||||
BOTH_SLOTS: True
|
||||
USE_ACL: True
|
||||
SUB_ACL: DENY:1
|
||||
TGID_ACL: PERMIT:ALL
|
||||
USE_ENCRYPTION: False
|
||||
ENCRYPTION_KEY:
|
||||
|
||||
# MASTER INSTANCES - DUPLICATE SECTION FOR MULTIPLE MASTERS
|
||||
# HomeBrew Protocol Master instances go here.
|
||||
# IP may be left blank if there's one interface on your system.
|
||||
# Port should be the port you want this master to listen on. It must be unique
|
||||
# and unused by anything else.
|
||||
# Repeat - if True, the master repeats traffic to peers, False, it does nothing.
|
||||
#
|
||||
# MAX_PEERS -- maximun number of peers that may be connect to this master
|
||||
# at any given time. This is very handy if you're allowing hotspots to
|
||||
# connect, or using a limited computer like a Raspberry Pi.
|
||||
#
|
||||
# ACLs:
|
||||
# See comments in the GLOBAL stanza
|
||||
[MASTER-1]
|
||||
MODE: MASTER
|
||||
ENABLED: True
|
||||
|
||||
# Use the user manager? If False, MASTER instance will operate as normal.
|
||||
USE_USER_MAN: False
|
||||
|
||||
REPEAT: True
|
||||
MAX_PEERS: 3
|
||||
EXPORT_AMBE: False
|
||||
IP:
|
||||
PORT: 62033
|
||||
PASSPHRASE: passw0rd
|
||||
GROUP_HANGTIME: 5
|
||||
USE_ACL: True
|
||||
REG_ACL: DENY:1
|
||||
SUB_ACL: DENY:1
|
||||
TGID_TS1_ACL: PERMIT:ALL
|
||||
TGID_TS2_ACL: PERMIT:ALL
|
||||
|
||||
# PEER INSTANCES - DUPLICATE SECTION FOR MULTIPLE PEERS
|
||||
# There are a LOT of errors in the HB Protocol specifications on this one!
|
||||
# MOST of these items are just strings and will be properly dealt with by the program
|
||||
# The TX & RX Frequencies are 9-digit numbers, and are the frequency in Hz.
|
||||
# Latitude is an 8-digit unsigned floating point number.
|
||||
# Longitude is a 9-digit signed floating point number.
|
||||
# Height is in meters
|
||||
# Setting Loose to True relaxes the validation on packets received from the master.
|
||||
# This will allow HBlink to connect to a non-compliant system such as XLXD, DMR+ etc.
|
||||
#
|
||||
# ACLs:
|
||||
# See comments in the GLOBAL stanza
|
||||
[REPEATER-1]
|
||||
MODE: PEER
|
||||
ENABLED: False
|
||||
LOOSE: False
|
||||
EXPORT_AMBE: False
|
||||
IP:
|
||||
PORT: 54001
|
||||
MASTER_IP: 172.16.1.1
|
||||
MASTER_PORT: 54000
|
||||
PASSPHRASE: homebrew
|
||||
CALLSIGN: W1ABC
|
||||
RADIO_ID: 312000
|
||||
RX_FREQ: 449000000
|
||||
TX_FREQ: 444000000
|
||||
TX_POWER: 25
|
||||
COLORCODE: 1
|
||||
SLOTS: 1
|
||||
LATITUDE: 38.0000
|
||||
LONGITUDE: -095.0000
|
||||
HEIGHT: 75
|
||||
LOCATION: Anywhere, USA
|
||||
DESCRIPTION: This is a cool repeater
|
||||
URL: www.w1abc.org
|
||||
SOFTWARE_ID: 20170620
|
||||
PACKAGE_ID: MMDVM_HBlink
|
||||
GROUP_HANGTIME: 5
|
||||
OPTIONS:
|
||||
USE_ACL: True
|
||||
SUB_ACL: DENY:1
|
||||
TGID_TS1_ACL: PERMIT:ALL
|
||||
TGID_TS2_ACL: PERMIT:ALL
|
||||
|
||||
[XLX-1]
|
||||
MODE: XLXPEER
|
||||
ENABLED: False
|
||||
LOOSE: True
|
||||
EXPORT_AMBE: False
|
||||
IP:
|
||||
PORT: 54002
|
||||
MASTER_IP: 172.16.1.1
|
||||
MASTER_PORT: 62030
|
||||
PASSPHRASE: passw0rd
|
||||
CALLSIGN: W1ABC
|
||||
RADIO_ID: 312000
|
||||
RX_FREQ: 449000000
|
||||
TX_FREQ: 444000000
|
||||
TX_POWER: 25
|
||||
COLORCODE: 1
|
||||
SLOTS: 1
|
||||
LATITUDE: 38.0000
|
||||
LONGITUDE: -095.0000
|
||||
HEIGHT: 75
|
||||
LOCATION: Anywhere, USA
|
||||
DESCRIPTION: This is a cool repeater
|
||||
URL: www.w1abc.org
|
||||
SOFTWARE_ID: 20170620
|
||||
PACKAGE_ID: MMDVM_HBlink
|
||||
GROUP_HANGTIME: 5
|
||||
XLXMODULE: 4004
|
||||
USE_ACL: True
|
||||
SUB_ACL: DENY:1
|
||||
TGID_TS1_ACL: PERMIT:ALL
|
||||
TGID_TS2_ACL: PERMIT:ALL
|
||||
+1619
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,404 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
###############################################################################
|
||||
# Copyright (C) 2016-2018 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
#
|
||||
# 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
|
||||
###############################################################################
|
||||
|
||||
'''
|
||||
This module generates the configuration data structure for hblink.py and
|
||||
assoicated programs that use it. It has been seaparated into a different
|
||||
module so as to keep hblink.py easeier to navigate. This file only needs
|
||||
updated if the items in the main configuraiton file (usually hblink.cfg)
|
||||
change.
|
||||
'''
|
||||
|
||||
import configparser
|
||||
import sys
|
||||
import const
|
||||
|
||||
from socket import gethostbyname
|
||||
|
||||
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
|
||||
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||
__copyright__ = 'Copyright (c) 2016-2018 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
|
||||
__license__ = 'GNU GPLv3'
|
||||
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||
__email__ = 'n0mjs@me.com'
|
||||
|
||||
# Processing of ALS goes here. It's separated from the acl_build function because this
|
||||
# code is hblink config-file format specific, and acl_build is abstracted
|
||||
def process_acls(_config):
|
||||
# Global registration ACL
|
||||
_config['GLOBAL']['REG_ACL'] = acl_build(_config['GLOBAL']['REG_ACL'], const.PEER_MAX)
|
||||
|
||||
# Global subscriber and TGID ACLs
|
||||
for acl in ['SUB_ACL', 'TG1_ACL', 'TG2_ACL']:
|
||||
_config['GLOBAL'][acl] = acl_build(_config['GLOBAL'][acl], const.ID_MAX)
|
||||
|
||||
# System level ACLs
|
||||
for system in _config['SYSTEMS']:
|
||||
# Registration ACLs (which make no sense for peer systems)
|
||||
if _config['SYSTEMS'][system]['MODE'] == 'MASTER':
|
||||
_config['SYSTEMS'][system]['REG_ACL'] = acl_build(_config['SYSTEMS'][system]['REG_ACL'], const.PEER_MAX)
|
||||
|
||||
# Subscriber and TGID ACLs (valid for all system types)
|
||||
for acl in ['SUB_ACL', 'TG1_ACL', 'TG2_ACL']:
|
||||
_config['SYSTEMS'][system][acl] = acl_build(_config['SYSTEMS'][system][acl], const.ID_MAX)
|
||||
|
||||
# Create an access control list that is programatically useable from human readable:
|
||||
# ORIGINAL: 'DENY:1-5,3120101,3120124'
|
||||
# PROCESSED: (False, set([(1, 5), (3120124, 3120124), (3120101, 3120101)]))
|
||||
def acl_build(_acl, _max):
|
||||
if not _acl:
|
||||
return(True, set((const.ID_MIN, _max)))
|
||||
|
||||
acl = [] #set()
|
||||
if type(_acl) == tuple:
|
||||
_acl = ''.join(_acl)
|
||||
sections = _acl.split(':')
|
||||
|
||||
if sections[0] == 'PERMIT':
|
||||
action = True
|
||||
else:
|
||||
action = False
|
||||
|
||||
for entry in sections[1].split(','):
|
||||
if entry == 'ALL':
|
||||
acl.append((const.ID_MIN, _max))
|
||||
break
|
||||
|
||||
elif '-' in entry:
|
||||
start,end = entry.split('-')
|
||||
start,end = int(start), int(end)
|
||||
if (const.ID_MIN <= start <= _max) or (const.ID_MIN <= end <= _max):
|
||||
acl.append((start, end))
|
||||
else:
|
||||
sys.exit('ACL CREATION ERROR, VALUE OUT OF RANGE ({} - {})IN RANGE-BASED ENTRY: {}'.format(const.ID_MIN, _max, entry))
|
||||
else:
|
||||
id = int(entry)
|
||||
if (const.ID_MIN <= id <= _max):
|
||||
acl.append((id, id))
|
||||
else:
|
||||
sys.exit('ACL CREATION ERROR, VALUE OUT OF RANGE ({} - {}) IN SINGLE ID ENTRY: {}'.format(const.ID_MIN, _max, entry))
|
||||
|
||||
return (action, acl)
|
||||
|
||||
def build_config(_config_file):
|
||||
config = configparser.ConfigParser()
|
||||
|
||||
if not config.read(_config_file):
|
||||
sys.exit('Configuration file \''+_config_file+'\' is not a valid configuration file! Exiting...')
|
||||
|
||||
CONFIG = {}
|
||||
CONFIG['GLOBAL'] = {}
|
||||
CONFIG['REPORTS'] = {}
|
||||
CONFIG['LOGGER'] = {}
|
||||
CONFIG['ALIASES'] = {}
|
||||
CONFIG['WEB_SERVICE'] = {}
|
||||
CONFIG['DATA_CONFIG'] = {}
|
||||
CONFIG['SYSTEMS'] = {}
|
||||
|
||||
try:
|
||||
for section in config.sections():
|
||||
if section == 'GLOBAL':
|
||||
CONFIG['GLOBAL'].update({
|
||||
'PATH': config.get(section, 'PATH'),
|
||||
'PING_TIME': config.getint(section, 'PING_TIME'),
|
||||
'MAX_MISSED': config.getint(section, 'MAX_MISSED'),
|
||||
'USE_ACL': config.get(section, 'USE_ACL'),
|
||||
'REG_ACL': config.get(section, 'REG_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TGID_TS1_ACL'),
|
||||
'TG2_ACL': config.get(section, 'TGID_TS2_ACL')
|
||||
})
|
||||
|
||||
elif section == 'REPORTS':
|
||||
CONFIG['REPORTS'].update({
|
||||
'REPORT': config.getboolean(section, 'REPORT'),
|
||||
'REPORT_INTERVAL': config.getint(section, 'REPORT_INTERVAL'),
|
||||
'REPORT_PORT': config.getint(section, 'REPORT_PORT'),
|
||||
'REPORT_CLIENTS': config.get(section, 'REPORT_CLIENTS').split(',')
|
||||
})
|
||||
|
||||
elif section == 'LOGGER':
|
||||
CONFIG['LOGGER'].update({
|
||||
'LOG_FILE': config.get(section, 'LOG_FILE'),
|
||||
'LOG_HANDLERS': config.get(section, 'LOG_HANDLERS'),
|
||||
'LOG_LEVEL': config.get(section, 'LOG_LEVEL'),
|
||||
'LOG_NAME': config.get(section, 'LOG_NAME')
|
||||
})
|
||||
if not CONFIG['LOGGER']['LOG_FILE']:
|
||||
CONFIG['LOGGER']['LOG_FILE'] = '/dev/null'
|
||||
|
||||
elif section == 'ALIASES':
|
||||
CONFIG['ALIASES'].update({
|
||||
'TRY_DOWNLOAD': config.getboolean(section, 'TRY_DOWNLOAD'),
|
||||
'PATH': config.get(section, 'PATH'),
|
||||
'PEER_FILE': config.get(section, 'PEER_FILE'),
|
||||
'SUBSCRIBER_FILE': config.get(section, 'SUBSCRIBER_FILE'),
|
||||
'TGID_FILE': config.get(section, 'TGID_FILE'),
|
||||
'PEER_URL': config.get(section, 'PEER_URL'),
|
||||
'SUBSCRIBER_URL': config.get(section, 'SUBSCRIBER_URL'),
|
||||
'STALE_TIME': config.getint(section, 'STALE_DAYS') * 86400,
|
||||
})
|
||||
|
||||
elif section == 'WEB_SERVICE':
|
||||
CONFIG['WEB_SERVICE'].update({
|
||||
'THIS_SERVER_NAME': config.get(section, 'THIS_SERVER_NAME'),
|
||||
'URL': config.get(section, 'URL'),
|
||||
'REMOTE_CONFIG_ENABLED': config.getboolean(section, 'REMOTE_CONFIG_ENABLED'),
|
||||
'SHARED_SECRET': config.get(section, 'SHARED_SECRET'),
|
||||
})
|
||||
|
||||
elif section == 'DATA_CONFIG':
|
||||
CONFIG['DATA_CONFIG'].update({
|
||||
'DATA_DMR_ID': config.get(section, 'DATA_DMR_ID'),
|
||||
'USER_APRS_SSID': config.get(section, 'USER_APRS_SSID'),
|
||||
'CALL_TYPE': config.get(section, 'CALL_TYPE'),
|
||||
## 'UNIT_SMS_TS': config.get(section, 'UNIT_SMS_TS'),
|
||||
'USER_APRS_COMMENT': config.get(section, 'USER_APRS_COMMENT'),
|
||||
'APRS_LOGIN_CALL': config.get(section, 'APRS_LOGIN_CALL'),
|
||||
'APRS_LOGIN_PASSCODE': config.get(section, 'APRS_LOGIN_PASSCODE'),
|
||||
'APRS_SERVER': config.get(section, 'APRS_SERVER'),
|
||||
'APRS_PORT': config.get(section, 'APRS_PORT'),
|
||||
'APRS_FILTER': config.get(section, 'APRS_FILTER'),
|
||||
'IGATE_BEACON_TIME': config.get(section, 'IGATE_BEACON_TIME'),
|
||||
'IGATE_BEACON_ICON': config.get(section, 'IGATE_BEACON_ICON'),
|
||||
'IGATE_BEACON_COMMENT': config.get(section, 'IGATE_BEACON_COMMENT'),
|
||||
'IGATE_LATITUDE': config.get(section, 'IGATE_LATITUDE'),
|
||||
'IGATE_LONGITUDE': config.get(section, 'IGATE_LONGITUDE'),
|
||||
'APRS_STATIC_REPORT_INTERVAL': config.get(section, 'APRS_STATIC_REPORT_INTERVAL'),
|
||||
'APRS_STATIC_MESSAGE': config.get(section, 'APRS_STATIC_MESSAGE'),
|
||||
## 'EMAIL_SENDER': config.get(section, 'EMAIL_SENDER'),
|
||||
## 'EMAIL_PASSWORD': config.get(section, 'EMAIL_PASSWORD'),
|
||||
## 'SMTP_SERVER': config.get(section, 'SMTP_SERVER'),
|
||||
## 'SMTP_PORT': config.get(section, 'SMTP_PORT'),
|
||||
'LOCATION_FILE': config.get(section, 'LOCATION_FILE'),
|
||||
'BULLETIN_BOARD_FILE': config.get(section, 'BULLETIN_BOARD_FILE'),
|
||||
'MAILBOX_FILE': config.get(section, 'MAILBOX_FILE'),
|
||||
'SMS_FILE': config.get(section, 'SMS_FILE'),
|
||||
'EMERGENCY_SOS_FILE': config.get(section, 'EMERGENCY_SOS_FILE'),
|
||||
'USER_SETTINGS_FILE': config.get(section, 'USER_SETTINGS_FILE'),
|
||||
## 'USE_API': config.getboolean(section, 'USE_API'),
|
||||
## 'AUTHORIZED_TOKENS_FILE': config.get(section, 'AUTHORIZED_TOKENS_FILE'),
|
||||
## 'USE_PUBLIC_APPS': config.getboolean(section, 'USE_PUBLIC_APPS'),
|
||||
## 'PUBLIC_APPS_LIST': config.get(section, 'PUBLIC_APPS_LIST'),
|
||||
## 'MY_SERVER_SHORTCUT': config.get(section, 'MY_SERVER_SHORTCUT'),
|
||||
## 'DASHBOARD_URL': config.get(section, 'DASHBOARD_URL'),
|
||||
## 'SERVER_NAME': config.get(section, 'SERVER_NAME'),
|
||||
## 'RULES_PATH': config.get(section, 'RULES_PATH'),
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
elif config.getboolean(section, 'ENABLED'):
|
||||
if config.get(section, 'MODE') == 'PEER':
|
||||
CONFIG['SYSTEMS'].update({section: {
|
||||
'MODE': config.get(section, 'MODE'),
|
||||
'ENABLED': config.getboolean(section, 'ENABLED'),
|
||||
'LOOSE': config.getboolean(section, 'LOOSE'),
|
||||
'SOCK_ADDR': (gethostbyname(config.get(section, 'IP')), config.getint(section, 'PORT')),
|
||||
'IP': gethostbyname(config.get(section, 'IP')),
|
||||
'PORT': config.getint(section, 'PORT'),
|
||||
'MASTER_SOCKADDR': (gethostbyname(config.get(section, 'MASTER_IP')), config.getint(section, 'MASTER_PORT')),
|
||||
'MASTER_IP': gethostbyname(config.get(section, 'MASTER_IP')),
|
||||
'MASTER_PORT': config.getint(section, 'MASTER_PORT'),
|
||||
'PASSPHRASE': bytes(config.get(section, 'PASSPHRASE'), 'utf-8'),
|
||||
'CALLSIGN': bytes(config.get(section, 'CALLSIGN').ljust(8)[:8], 'utf-8'),
|
||||
'RADIO_ID': config.getint(section, 'RADIO_ID').to_bytes(4, 'big'),
|
||||
'RX_FREQ': bytes(config.get(section, 'RX_FREQ').ljust(9)[:9], 'utf-8'),
|
||||
'TX_FREQ': bytes(config.get(section, 'TX_FREQ').ljust(9)[:9], 'utf-8'),
|
||||
'TX_POWER': bytes(config.get(section, 'TX_POWER').rjust(2,'0'), 'utf-8'),
|
||||
'COLORCODE': bytes(config.get(section, 'COLORCODE').rjust(2,'0'), 'utf-8'),
|
||||
'LATITUDE': bytes(config.get(section, 'LATITUDE').ljust(8)[:8], 'utf-8'),
|
||||
'LONGITUDE': bytes(config.get(section, 'LONGITUDE').ljust(9)[:9], 'utf-8'),
|
||||
'HEIGHT': bytes(config.get(section, 'HEIGHT').rjust(3,'0'), 'utf-8'),
|
||||
'LOCATION': bytes(config.get(section, 'LOCATION').ljust(20)[:20], 'utf-8'),
|
||||
'DESCRIPTION': bytes(config.get(section, 'DESCRIPTION').ljust(19)[:19], 'utf-8'),
|
||||
'SLOTS': bytes(config.get(section, 'SLOTS'), 'utf-8'),
|
||||
'URL': bytes(config.get(section, 'URL').ljust(124)[:124], 'utf-8'),
|
||||
'SOFTWARE_ID': bytes(config.get(section, 'SOFTWARE_ID').ljust(40)[:40], 'utf-8'),
|
||||
'PACKAGE_ID': bytes(config.get(section, 'PACKAGE_ID').ljust(40)[:40], 'utf-8'),
|
||||
'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'),
|
||||
'OPTIONS': b''.join([b'Type=HBlink;', bytes(config.get(section, 'OPTIONS'), 'utf-8')]),
|
||||
'USE_ACL': config.getboolean(section, 'USE_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TGID_TS1_ACL'),
|
||||
'TG2_ACL': config.get(section, 'TGID_TS2_ACL'),
|
||||
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
|
||||
}})
|
||||
CONFIG['SYSTEMS'][section].update({'STATS': {
|
||||
'CONNECTION': 'NO', # NO, RTPL_SENT, AUTHENTICATED, CONFIG-SENT, YES
|
||||
'CONNECTED': None,
|
||||
'PINGS_SENT': 0,
|
||||
'PINGS_ACKD': 0,
|
||||
'NUM_OUTSTANDING': 0,
|
||||
'PING_OUTSTANDING': False,
|
||||
'LAST_PING_TX_TIME': 0,
|
||||
'LAST_PING_ACK_TIME': 0,
|
||||
}})
|
||||
|
||||
if config.get(section, 'MODE') == 'XLXPEER':
|
||||
CONFIG['SYSTEMS'].update({section: {
|
||||
'MODE': config.get(section, 'MODE'),
|
||||
'ENABLED': config.getboolean(section, 'ENABLED'),
|
||||
'LOOSE': config.getboolean(section, 'LOOSE'),
|
||||
'SOCK_ADDR': (gethostbyname(config.get(section, 'IP')), config.getint(section, 'PORT')),
|
||||
'IP': gethostbyname(config.get(section, 'IP')),
|
||||
'PORT': config.getint(section, 'PORT'),
|
||||
'MASTER_SOCKADDR': (gethostbyname(config.get(section, 'MASTER_IP')), config.getint(section, 'MASTER_PORT')),
|
||||
'MASTER_IP': gethostbyname(config.get(section, 'MASTER_IP')),
|
||||
'MASTER_PORT': config.getint(section, 'MASTER_PORT'),
|
||||
'PASSPHRASE': bytes(config.get(section, 'PASSPHRASE'), 'utf-8'),
|
||||
'CALLSIGN': bytes(config.get(section, 'CALLSIGN').ljust(8)[:8], 'utf-8'),
|
||||
'RADIO_ID': config.getint(section, 'RADIO_ID').to_bytes(4, 'big'),
|
||||
'RX_FREQ': bytes(config.get(section, 'RX_FREQ').ljust(9)[:9], 'utf-8'),
|
||||
'TX_FREQ': bytes(config.get(section, 'TX_FREQ').ljust(9)[:9], 'utf-8'),
|
||||
'TX_POWER': bytes(config.get(section, 'TX_POWER').rjust(2,'0'), 'utf-8'),
|
||||
'COLORCODE': bytes(config.get(section, 'COLORCODE').rjust(2,'0'), 'utf-8'),
|
||||
'LATITUDE': bytes(config.get(section, 'LATITUDE').ljust(8)[:8], 'utf-8'),
|
||||
'LONGITUDE': bytes(config.get(section, 'LONGITUDE').ljust(9)[:9], 'utf-8'),
|
||||
'HEIGHT': bytes(config.get(section, 'HEIGHT').rjust(3,'0'), 'utf-8'),
|
||||
'LOCATION': bytes(config.get(section, 'LOCATION').ljust(20)[:20], 'utf-8'),
|
||||
'DESCRIPTION': bytes(config.get(section, 'DESCRIPTION').ljust(19)[:19], 'utf-8'),
|
||||
'SLOTS': bytes(config.get(section, 'SLOTS'), 'utf-8'),
|
||||
'URL': bytes(config.get(section, 'URL').ljust(124)[:124], 'utf-8'),
|
||||
'SOFTWARE_ID': bytes(config.get(section, 'SOFTWARE_ID').ljust(40)[:40], 'utf-8'),
|
||||
'PACKAGE_ID': bytes(config.get(section, 'PACKAGE_ID').ljust(40)[:40], 'utf-8'),
|
||||
'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'),
|
||||
'XLXMODULE': config.getint(section, 'XLXMODULE'),
|
||||
'OPTIONS': '',
|
||||
'USE_ACL': config.getboolean(section, 'USE_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TGID_TS1_ACL'),
|
||||
'TG2_ACL': config.get(section, 'TGID_TS2_ACL'),
|
||||
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
|
||||
}})
|
||||
CONFIG['SYSTEMS'][section].update({'XLXSTATS': {
|
||||
'CONNECTION': 'NO', # NO, RTPL_SENT, AUTHENTICATED, CONFIG-SENT, YES
|
||||
'CONNECTED': None,
|
||||
'PINGS_SENT': 0,
|
||||
'PINGS_ACKD': 0,
|
||||
'NUM_OUTSTANDING': 0,
|
||||
'PING_OUTSTANDING': False,
|
||||
'LAST_PING_TX_TIME': 0,
|
||||
'LAST_PING_ACK_TIME': 0,
|
||||
}})
|
||||
|
||||
elif config.get(section, 'MODE') == 'MASTER':
|
||||
CONFIG['SYSTEMS'].update({section: {
|
||||
'MODE': config.get(section, 'MODE'),
|
||||
'ENABLED': config.getboolean(section, 'ENABLED'),
|
||||
'USE_USER_MAN': config.getboolean(section, 'USE_USER_MAN'),
|
||||
'REPEAT': config.getboolean(section, 'REPEAT'),
|
||||
'MAX_PEERS': config.getint(section, 'MAX_PEERS'),
|
||||
'IP': gethostbyname(config.get(section, 'IP')),
|
||||
'PORT': config.getint(section, 'PORT'),
|
||||
'PASSPHRASE': bytes(config.get(section, 'PASSPHRASE'), 'utf-8'),
|
||||
'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'),
|
||||
'USE_ACL': config.getboolean(section, 'USE_ACL'),
|
||||
'REG_ACL': config.get(section, 'REG_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TGID_TS1_ACL'),
|
||||
'TG2_ACL': config.get(section, 'TGID_TS2_ACL'),
|
||||
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
|
||||
}})
|
||||
CONFIG['SYSTEMS'][section].update({'PEERS': {}})
|
||||
|
||||
elif config.get(section, 'MODE') == 'OPENBRIDGE':
|
||||
CONFIG['SYSTEMS'].update({section: {
|
||||
'MODE': config.get(section, 'MODE'),
|
||||
'ENABLED': config.getboolean(section, 'ENABLED'),
|
||||
'NETWORK_ID': config.getint(section, 'NETWORK_ID').to_bytes(4, 'big'),
|
||||
'IP': gethostbyname(config.get(section, 'IP')),
|
||||
'PORT': config.getint(section, 'PORT'),
|
||||
'PASSPHRASE': bytes(config.get(section, 'PASSPHRASE').ljust(20,'\x00')[:20], 'utf-8'),
|
||||
'TARGET_SOCK': (gethostbyname(config.get(section, 'TARGET_IP')), config.getint(section, 'TARGET_PORT')),
|
||||
'TARGET_IP': gethostbyname(config.get(section, 'TARGET_IP')),
|
||||
'TARGET_PORT': config.getint(section, 'TARGET_PORT'),
|
||||
'BOTH_SLOTS': config.getboolean(section, 'BOTH_SLOTS'),
|
||||
'USE_ACL': config.getboolean(section, 'USE_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TGID_ACL'),
|
||||
'TG2_ACL': 'PERMIT:ALL',
|
||||
'USE_ENCRYPTION': config.getboolean(section, 'USE_ENCRYPTION'),
|
||||
'ENCRYPTION_KEY': bytes(config.get(section, 'ENCRYPTION_KEY'), 'utf-8'),
|
||||
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
|
||||
}})
|
||||
elif config.get(section, 'MODE') == 'PROXY':
|
||||
CONFIG['SYSTEMS'].update({section: {
|
||||
'MODE': config.get(section, 'MODE'),
|
||||
'ENABLED': config.getboolean(section, 'ENABLED'),
|
||||
'EXTERNAL_PROXY_SCRIPT': config.getboolean(section, 'EXTERNAL_PROXY_SCRIPT'),
|
||||
'STATIC_APRS_POSITION_ENABLED': config.getboolean(section, 'STATIC_APRS_POSITION_ENABLED'),
|
||||
'REPEAT': config.getboolean(section, 'REPEAT'),
|
||||
'PASSPHRASE': bytes(config.get(section, 'PASSPHRASE'), 'utf-8'),
|
||||
'EXTERNAL_PORT': config.getint(section, 'EXTERNAL_PORT'),
|
||||
'INTERNAL_PORT_START': config.getint(section, 'INTERNAL_PORT_START'),
|
||||
'INTERNAL_PORT_STOP': config.getint(section, 'INTERNAL_PORT_STOP'),
|
||||
'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'),
|
||||
'USE_ACL': config.getboolean(section, 'USE_ACL'),
|
||||
'REG_ACL': config.get(section, 'REG_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TG1_ACL'),
|
||||
'TG2_ACL': config.get(section, 'TG2_ACL'),
|
||||
'OTHER_OPTIONS': config.get(section, 'OTHER_OPTIONS'),
|
||||
}})
|
||||
CONFIG['SYSTEMS'][section].update({'PEERS': {}})
|
||||
|
||||
except configparser.Error as err:
|
||||
sys.exit('Error processing configuration file -- {}'.format(err))
|
||||
|
||||
process_acls(CONFIG)
|
||||
|
||||
return CONFIG
|
||||
|
||||
# Used to run this file direclty and print the config,
|
||||
# which might be useful for debugging
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
from pprint import pprint
|
||||
from dmr_utils3.utils import int_id
|
||||
|
||||
# Change the current directory to the location of the application
|
||||
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
|
||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)')
|
||||
cli_args = parser.parse_args()
|
||||
|
||||
|
||||
# Ensure we have a path for the config file, if one wasn't specified, then use the execution directory
|
||||
if not cli_args.CONFIG_FILE:
|
||||
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
|
||||
|
||||
CONFIG = build_config(cli_args.CONFIG_FILE)
|
||||
pprint(CONFIG)
|
||||
|
||||
def acl_check(_id, _acl):
|
||||
id = int_id(_id)
|
||||
for entry in _acl[1]:
|
||||
if entry[0] <= id <= entry[1]:
|
||||
return _acl[0]
|
||||
return not _acl[0]
|
||||
|
||||
print(acl_check(b'\x00\x01\x37', CONFIG['GLOBAL']['TG1_ACL']))
|
||||
@@ -1,195 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
###############################################################################
|
||||
# Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
#
|
||||
# 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
|
||||
###############################################################################
|
||||
|
||||
'''
|
||||
This tool listens to network traffic and breaks apart HBP and DMR packets.
|
||||
|
||||
It is a development and debugging tool and has no purpose in actual production
|
||||
DMR networking systems.
|
||||
'''
|
||||
|
||||
# Python modules we need
|
||||
from binascii import b2a_hex as bhex
|
||||
from bitarray import bitarray
|
||||
|
||||
# Twisted is pretty important, so I keep it separate
|
||||
from twisted.internet.protocol import Factory, Protocol
|
||||
from twisted.internet import reactor
|
||||
|
||||
# Things we import from the main hblink module
|
||||
from hblink import HBSYSTEM, systems, hblink_handler
|
||||
from dmr_utils3.utils import bytes_3, bytes_4, int_id
|
||||
from dmr_utils3 import bptc
|
||||
import config
|
||||
import log
|
||||
from const import *
|
||||
|
||||
|
||||
# REMOVE LATER from datetime import datetime
|
||||
# The module needs logging, but handlers, etc. are controlled by the parent
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
|
||||
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||
__copyright__ = 'Copyright (c) 2016-2019 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||
__license__ = 'GNU GPLv3'
|
||||
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||
__email__ = 'n0mjs@me.com'
|
||||
|
||||
|
||||
DUMP_HBP = False
|
||||
DUMP_DMR = True
|
||||
|
||||
# Module gobal varaibles
|
||||
|
||||
class HBP(HBSYSTEM):
|
||||
|
||||
def __init__(self, _name, _config, _report):
|
||||
HBSYSTEM.__init__(self, _name, _config, _report)
|
||||
self.last_stream = b'\x00\x00\x00\x00'
|
||||
self.lcfrags = 0
|
||||
self.lostcount = 0
|
||||
|
||||
|
||||
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
|
||||
|
||||
pktype = 'UNIDENTIFIED'
|
||||
|
||||
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM):
|
||||
pktype = 'VTERM '
|
||||
|
||||
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VHEAD):
|
||||
pktype = 'VHEAD '
|
||||
|
||||
if (_frame_type == HBPF_VOICE_SYNC):
|
||||
pktype = 'VOICE SYNC ' + str(_dtype_vseq + 1)
|
||||
|
||||
if (_frame_type == HBPF_VOICE):
|
||||
pktype = 'VOICE ' + str(_dtype_vseq + 1)
|
||||
|
||||
if DUMP_HBP:
|
||||
print('STREAM: {} SEQ: {} PEER: {} SRC: {} DST: {} SLOT: {} CALL: {} FRAME: {} DTYPE: {}'.format(
|
||||
int_id(_stream_id), int_id(_seq), int_id(_peer_id), int_id(_rf_src), int_id(_dst_id), _slot, pktype, _frame_type, _dtype_vseq
|
||||
))
|
||||
|
||||
if DUMP_DMR:
|
||||
payload = _data[20:53]
|
||||
bitload = bitarray(endian='big')
|
||||
bitload.frombytes(payload)
|
||||
if pktype == ('VHEAD '):
|
||||
LC = bptc.decode_full_lc(bitload[:98] + bitload[-98:]).tobytes()
|
||||
OPT = bhex(LC[0:3])
|
||||
DST = int_id(LC[3:6])
|
||||
SRC = int_id(LC[6:9])
|
||||
|
||||
ST = bin(int.from_bytes((bitload[98:109] + bitload[-108:-99])[:8].tobytes(), 'big'))
|
||||
SC = bhex(bitload[108:-108].tobytes())
|
||||
|
||||
print('VOICE HEADER: LC:(OPTIONS: {} DEST: {} SOURCE: {}) -- SLOT TYPE: {} -- SYNC: {}'.format(OPT, DST, SRC, ST, SC))
|
||||
|
||||
elif pktype == ('VTERM '):
|
||||
LC = bptc.decode_full_lc(bitload[:98] + bitload[-98:]).tobytes()
|
||||
OPT = bhex(LC[0:3])
|
||||
DST = int_id(LC[3:6])
|
||||
SRC = int_id(LC[6:9])
|
||||
|
||||
ST = bin(int.from_bytes((bitload[98:109] + bitload[-108:-99])[:8].tobytes(), 'big'))
|
||||
SC = bhex(bitload[108:-108].tobytes())
|
||||
|
||||
print('VOICE TERMINATOR: LC:(OPTIONS: {} DEST: {} SOURCE: {}) -- SLOT TYPE: {} -- SYNC: {}'.format(OPT, DST, SRC, ST, SC))
|
||||
|
||||
elif pktype == ('VOICE SYNC 1'):
|
||||
self.lcfrags=0
|
||||
print('Voice Burst A')
|
||||
BVC = bitload[0:108] + bitload[-108:]
|
||||
BSC = bitload[108:-108]
|
||||
self.lcfrags = 0
|
||||
|
||||
elif 'VOICE ' in pktype:
|
||||
print('Voice Burst B-F')
|
||||
BVC = bitload[0:108] + bitload[-108:]
|
||||
BEB = bitload[108:116] + bitload[-116:-108]
|
||||
BES = bitload[116:-116]
|
||||
print(len(BVC), len(BEB), len(BES))
|
||||
|
||||
|
||||
#************************************************
|
||||
# MAIN PROGRAM LOOP STARTS HERE
|
||||
#************************************************
|
||||
|
||||
if __name__ == '__main__':
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
import signal
|
||||
|
||||
# Change the current directory to the location of the application
|
||||
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
|
||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually deconstructor.cfg)')
|
||||
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||
cli_args = parser.parse_args()
|
||||
|
||||
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
|
||||
if not cli_args.CONFIG_FILE:
|
||||
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
|
||||
|
||||
# Call the external routine to build the configuration dictionary
|
||||
CONFIG = config.build_config(cli_args.CONFIG_FILE)
|
||||
|
||||
# Start the system logger
|
||||
if cli_args.LOG_LEVEL:
|
||||
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||
logger = log.config_logging(CONFIG['LOGGER'])
|
||||
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n')
|
||||
logger.debug('(GLOBAL) Logging system started, anything from here on gets logged')
|
||||
|
||||
# Set up the signal handler
|
||||
def sig_handler(_signal, _frame):
|
||||
logger.info('(GLOBAL) SHUTDOWN: DECONSTRUCTOR IS TERMINATING WITH SIGNAL %s', str(_signal))
|
||||
hblink_handler(_signal, _frame)
|
||||
logger.info('(GLOBAL) SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
|
||||
reactor.stop()
|
||||
|
||||
# Set signal handers so that we can gracefully exit if need be
|
||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||
signal.signal(sig, sig_handler)
|
||||
|
||||
# INITIALIZE THE REPORTING LOOP
|
||||
report_server = None
|
||||
|
||||
# HBlink instance creation
|
||||
logger.info('(GLOBAL) HBlink \'hbp_deconstructor.py\' -- SYSTEM STARTING...')
|
||||
for system in CONFIG['SYSTEMS']:
|
||||
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
||||
if CONFIG['SYSTEMS'][system]['MODE'] == 'MASTER' or CONFIG['SYSTEMS'][system]['MODE'] == 'PEER':
|
||||
systems[system] = HBP(system, CONFIG, report_server)
|
||||
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
|
||||
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
|
||||
|
||||
def loopingErrHandle(failure):
|
||||
logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure)
|
||||
reactor.stop()
|
||||
|
||||
reactor.run()
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir -p /var/tmp/config
|
||||
cd /var/tmp/config
|
||||
git clone https://${GIT_USER}:${GIT_PASSWORD}@${GIT_REPO}
|
||||
|
||||
DIR=$(echo ${GIT_REPO}| sed s/.git$//g | sed s#^.*/##g)
|
||||
|
||||
cp -a /var/tmp/config/${DIR}/*cfg /opt/hblink3/
|
||||
python /opt/hblink3/hblink.py
|
||||
-188
@@ -1,188 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
###############################################################################
|
||||
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
#
|
||||
# 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
|
||||
###############################################################################
|
||||
|
||||
'''
|
||||
This module is used to extract the AMBE72, FEC encoded data needed to make DMR
|
||||
frames. It prints out a list of lists, the outer list contains the word and each
|
||||
of the inner lists has two elements that comprise the 3 AMBE frames sent in each
|
||||
DMR packet. The frames are split into 1.5 frames and 1.5 frames, that is to say
|
||||
the two 108 bit segments used in DMR bursts.
|
||||
|
||||
This program is intended to produce the data needed to build words (or phrases)
|
||||
that can be used to populate the voice_lib.py file. It does not write the file
|
||||
for you, you must copy the output and paste them into the file. Most of the
|
||||
formatting, but not all, is done for you.
|
||||
|
||||
It will not process OpenBridge systems, and it is strongly recommended you only
|
||||
use it with one system in the hblink.cfg file at a time -- otherwise things can
|
||||
get really out of hand quickly.
|
||||
|
||||
This is a program for ADVANCED USERS ONLY. I really mean it this time, if you're
|
||||
not comfortable with how DMR packets are structured and basic Python, this isn't
|
||||
going to work well for you.
|
||||
'''
|
||||
|
||||
|
||||
# Python modules we need
|
||||
from bitarray import bitarray
|
||||
|
||||
# Twisted is pretty important, so I keep it separate
|
||||
from twisted.internet.protocol import Factory, Protocol
|
||||
from twisted.internet import reactor
|
||||
|
||||
# Things we import from the main hblink module
|
||||
from hblink import HBSYSTEM, systems, hblink_handler
|
||||
from dmr_utils3.utils import int_id
|
||||
import config
|
||||
import log
|
||||
|
||||
# The module needs logging, but handlers, etc. are controlled by the parent
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
|
||||
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||
__copyright__ = 'Copyright (c) 2016-2019 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
|
||||
__license__ = 'GNU GPLv3'
|
||||
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||
__email__ = 'n0mjs@me.com'
|
||||
|
||||
# Module gobal varaibles
|
||||
# Precalculated "dmrbits" (DMRD packet byte 15) -- just (slot << 7 | this value) and you're good to go!
|
||||
HEADBITS = 0b00100001
|
||||
BURSTBITS = [0b00010000,0b00000001,0b00000010,0b00000011,0b00000100,0b00000101]
|
||||
TERMBITS = 0b00100010
|
||||
|
||||
|
||||
class HBP(HBSYSTEM):
|
||||
|
||||
def __init__(self, _name, _config, _report):
|
||||
HBSYSTEM.__init__(self, _name, _config, _report)
|
||||
self.current_stream = '\x00'
|
||||
|
||||
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
|
||||
|
||||
dmr = _data[20:53]
|
||||
bits = _data[15] & ~(1<<7)
|
||||
|
||||
dmrraw = bitarray(endian='big')
|
||||
dmrraw.frombytes(dmr)
|
||||
|
||||
if bits == HEADBITS:
|
||||
if self.current_stream != _stream_id:
|
||||
print('START STREAM ID {} ON SLOT {} FROM SUBSCRIBER {} TO GROUP {}'.format(int_id(_stream_id), _slot, int_id(_rf_src), int_id(_dst_id)))
|
||||
print('[')
|
||||
self.current_stream = _stream_id
|
||||
|
||||
if bits == TERMBITS:
|
||||
if self.current_stream == _stream_id:
|
||||
print(' ]')
|
||||
print('STOP STREAM ID {}'.format(int_id(_stream_id)))
|
||||
self.current_stream = '\x00'
|
||||
|
||||
if bits == BURSTBITS[0]:
|
||||
bts = 'Burst A'
|
||||
sig = [dmrraw[:108], dmrraw[-108:]]
|
||||
print(' {},'.format(sig))
|
||||
if bits == BURSTBITS[1]:
|
||||
bts = 'Burst B'
|
||||
sig = [dmrraw[:108], dmrraw[-108:]]
|
||||
print(' {},'.format(sig))
|
||||
if bits == BURSTBITS[2]:
|
||||
bts = 'Burst C'
|
||||
sig = [dmrraw[:108], dmrraw[-108:]]
|
||||
print(' {},'.format(sig))
|
||||
if bits == BURSTBITS[3]:
|
||||
bts = 'Burst D'
|
||||
sig = [dmrraw[:108], dmrraw[-108:]]
|
||||
print(' {},'.format(sig))
|
||||
if bits == BURSTBITS[4]:
|
||||
bts = 'Burst E'
|
||||
sig = [dmrraw[:108], dmrraw[-108:]]
|
||||
print(' {},'.format(sig))
|
||||
if bits == BURSTBITS[5]:
|
||||
bts = 'Burst F'
|
||||
sig = [dmrraw[:108], dmrraw[-108:]]
|
||||
print(' {},'.format(sig))
|
||||
|
||||
#************************************************
|
||||
# MAIN PROGRAM LOOP STARTS HERE
|
||||
#************************************************
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
import signal
|
||||
|
||||
# Change the current directory to the location of the application
|
||||
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
|
||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)')
|
||||
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||
cli_args = parser.parse_args()
|
||||
|
||||
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
|
||||
if not cli_args.CONFIG_FILE:
|
||||
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
|
||||
|
||||
# Call the external routine to build the configuration dictionary
|
||||
CONFIG = config.build_config(cli_args.CONFIG_FILE)
|
||||
|
||||
# Start the system logger
|
||||
if cli_args.LOG_LEVEL:
|
||||
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||
logger = log.config_logging(CONFIG['LOGGER'])
|
||||
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n')
|
||||
logger.debug('(GLOBAL) Logging system started, anything from here on gets logged')
|
||||
|
||||
# Set up the signal handler
|
||||
def sig_handler(_signal, _frame):
|
||||
logger.info('(GLOBAL) SHUTDOWN: CONFBRIDGE IS TERMINATING WITH SIGNAL %s', str(_signal))
|
||||
hblink_handler(_signal, _frame)
|
||||
logger.info('(GLOBAL) SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
|
||||
reactor.stop()
|
||||
|
||||
# Set signal handers so that we can gracefully exit if need be
|
||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||
signal.signal(sig, sig_handler)
|
||||
|
||||
# INITIALIZE THE REPORTING LOOP
|
||||
report_server = None
|
||||
|
||||
# HBlink instance creation
|
||||
logger.info('(GLOBAL) HBlink \'bridge.py\' -- SYSTEM STARTING...')
|
||||
for system in CONFIG['SYSTEMS']:
|
||||
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
||||
if CONFIG['SYSTEMS'][system]['MODE'] == 'MASTER' or CONFIG['SYSTEMS'][system]['MODE'] == 'PEER':
|
||||
systems[system] = HBP(system, CONFIG, report_server)
|
||||
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
|
||||
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
|
||||
|
||||
def loopingErrHandle(failure):
|
||||
logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure)
|
||||
reactor.stop()
|
||||
|
||||
reactor.run()
|
||||
+37
-4
@@ -105,6 +105,29 @@ PEER_URL: https://www.radioid.net/static/rptrs.json
|
||||
SUBSCRIBER_URL: https://www.radioid.net/static/users.json
|
||||
STALE_DAYS: 7
|
||||
|
||||
# USER MANAGER
|
||||
# This is where to configure the details for use with a user managment script
|
||||
[WEB_SERVICE]
|
||||
THIS_SERVER_NAME: MMDVM_Server
|
||||
REMOTE_CONFIG_ENABLED: True
|
||||
# URL of the user managment server
|
||||
URL: http://localhost:8080/svr
|
||||
# Integer appended to DMR ID during the generation of a passphrase
|
||||
APPEND_INT: 1
|
||||
EXTRA_INT_1: 5
|
||||
EXTRA_INT_2: 8
|
||||
EXTRA_1: TeSt
|
||||
EXTRA_2: DmR4
|
||||
# Secret used to authenticate with user managment server, before checking if user login is approved
|
||||
SHARED_SECRET: test
|
||||
# Shorten passphrases
|
||||
SHORTEN_PASSPHRASE: True
|
||||
SHORTEN_SAMPLE: 4
|
||||
SHORTEN_LENGTH: 4
|
||||
BURN_FILE: ./burn_ids.txt
|
||||
BURN_INT: 5
|
||||
|
||||
|
||||
# OPENBRIDGE INSTANCES - DUPLICATE SECTION FOR MULTIPLE CONNECTIONS
|
||||
# OpenBridge is a protocol originall created by DMR+ for connection between an
|
||||
# IPSC2 server and Brandmeister. It has been implemented here at the suggestion
|
||||
@@ -120,20 +143,26 @@ STALE_DAYS: 7
|
||||
#
|
||||
# ACLs:
|
||||
# OpenBridge does not 'register', so registration ACL is meaningless.
|
||||
# OpenBridge passes all traffic on TS1, so there is only 1 TGID ACL.
|
||||
# Proper OpenBridge passes all traffic on TS1.
|
||||
# HBlink can extend OPB to use both slots for unit calls only.
|
||||
# Setting "BOTH_SLOTS" True ONLY affects unit traffic!
|
||||
# Otherwise ACLs work as described in the global stanza
|
||||
[OBP-1]
|
||||
MODE: OPENBRIDGE
|
||||
ENABLED: True
|
||||
ENABLED: False
|
||||
IP:
|
||||
PORT: 62035
|
||||
NETWORK_ID: 3129100
|
||||
PASSPHRASE: password
|
||||
TARGET_IP: 1.2.3.4
|
||||
TARGET_PORT: 62035
|
||||
BOTH_SLOTS: True
|
||||
USE_ACL: True
|
||||
SUB_ACL: DENY:1
|
||||
TGID_ACL: PERMIT:ALL
|
||||
# Experimental encryption
|
||||
ENCRYPTION_KEY:
|
||||
USE_ENCRYPTION: False
|
||||
|
||||
# MASTER INSTANCES - DUPLICATE SECTION FOR MULTIPLE MASTERS
|
||||
# HomeBrew Protocol Master instances go here.
|
||||
@@ -151,6 +180,10 @@ TGID_ACL: PERMIT:ALL
|
||||
[MASTER-1]
|
||||
MODE: MASTER
|
||||
ENABLED: True
|
||||
|
||||
# Use the user manager? If False, MASTER instance will operate as normal.
|
||||
USE_USER_MAN: False
|
||||
|
||||
REPEAT: True
|
||||
MAX_PEERS: 10
|
||||
EXPORT_AMBE: False
|
||||
@@ -178,7 +211,7 @@ TGID_TS2_ACL: PERMIT:ALL
|
||||
# See comments in the GLOBAL stanza
|
||||
[REPEATER-1]
|
||||
MODE: PEER
|
||||
ENABLED: True
|
||||
ENABLED: False
|
||||
LOOSE: False
|
||||
EXPORT_AMBE: False
|
||||
IP:
|
||||
@@ -210,7 +243,7 @@ TGID_TS2_ACL: PERMIT:ALL
|
||||
|
||||
[XLX-1]
|
||||
MODE: XLXPEER
|
||||
ENABLED: True
|
||||
ENABLED: False
|
||||
LOOSE: True
|
||||
EXPORT_AMBE: False
|
||||
IP:
|
||||
|
||||
@@ -44,6 +44,7 @@ from twisted.internet import reactor, task
|
||||
# Other files we pull from -- this is mostly for readability and segmentation
|
||||
import log
|
||||
import config
|
||||
from config import acl_build
|
||||
from const import *
|
||||
from dmr_utils3.utils import int_id, bytes_4, try_download, mk_id_dict
|
||||
|
||||
@@ -55,6 +56,17 @@ from reporting_const import *
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Used for user auth
|
||||
import os, ast
|
||||
import requests, json
|
||||
import base64
|
||||
import libscrc
|
||||
import re
|
||||
|
||||
# Encryption library
|
||||
from cryptography.fernet import Fernet
|
||||
|
||||
|
||||
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
|
||||
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||
__copyright__ = 'Copyright (c) 2016-2019 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||
@@ -66,6 +78,19 @@ __email__ = 'n0mjs@me.com'
|
||||
# Global variables used whether we are a module or __main__
|
||||
systems = {}
|
||||
|
||||
# Functions that provide a basic symetrical encryption using Fernet
|
||||
def encrypt_packet(key, message):
|
||||
f = Fernet(key)
|
||||
token = f.encrypt(message)
|
||||
|
||||
return token
|
||||
|
||||
def decrypt_packet(key, message):
|
||||
f = Fernet(key)
|
||||
token = f.decrypt(message, ttl=1)
|
||||
|
||||
return token
|
||||
|
||||
# Timed loop used for reporting HBP status
|
||||
def config_reports(_config, _factory):
|
||||
def reporting_loop(_logger, _server):
|
||||
@@ -94,12 +119,34 @@ def hblink_handler(_signal, _frame):
|
||||
# on matching and the action specified.
|
||||
def acl_check(_id, _acl):
|
||||
id = int_id(_id)
|
||||
|
||||
# if acl string, build tuple
|
||||
if type(_acl) == str:
|
||||
_acl = acl_build(_acl, 4294967295)
|
||||
|
||||
for entry in _acl[1]:
|
||||
if entry[0] <= id <= entry[1]:
|
||||
return _acl[0]
|
||||
return not _acl[0]
|
||||
|
||||
|
||||
def download_burnlist(_CONFIG):
|
||||
user_man_url = _CONFIG['WEB_SERVICE']['URL']
|
||||
shared_secret = str(sha256(_CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||
burn_check = {
|
||||
'burn_list':True,
|
||||
'secret':shared_secret
|
||||
}
|
||||
json_object = json.dumps(burn_check, indent = 4)
|
||||
try:
|
||||
req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
|
||||
resp = json.loads(req.text)
|
||||
return resp['burn_list']
|
||||
# For exception, write blank dict
|
||||
except requests.ConnectionError:
|
||||
return {}
|
||||
|
||||
|
||||
#************************************************
|
||||
# OPENBRIDGE CLASS
|
||||
#************************************************
|
||||
@@ -117,84 +164,142 @@ class OPENBRIDGE(DatagramProtocol):
|
||||
logger.info('(%s) is mode OPENBRIDGE. No De-Registration required, continuing shutdown', self._system)
|
||||
|
||||
def send_system(self, _packet):
|
||||
if _packet[:4] == DMRD:
|
||||
if _packet[:4] == DMRD or _packet[:4] == EOBP:
|
||||
#_packet = _packet[:11] + self._config['NETWORK_ID'] + _packet[15:]
|
||||
_packet = b''.join([_packet[:11], self._config['NETWORK_ID'], _packet[15:]])
|
||||
#_packet += hmac_new(self._config['PASSPHRASE'],_packet,sha1).digest()
|
||||
_packet = b''.join([_packet, (hmac_new(self._config['PASSPHRASE'],_packet,sha1).digest())])
|
||||
if self._config['USE_ENCRYPTION'] == True or _packet[:4] == EOBP:
|
||||
_enc_pkt = encrypt_packet(self._config['ENCRYPTION_KEY'], _packet)
|
||||
_packet = b'EOBP' + _enc_pkt
|
||||
self.transport.write(_packet, (self._config['TARGET_IP'], self._config['TARGET_PORT']))
|
||||
# KEEP THE FOLLOWING COMMENTED OUT UNLESS YOU'RE DEBUGGING DEEPLY!!!!
|
||||
# logger.debug('(%s) TX Packet to OpenBridge %s:%s -- %s', self._system, self._config['TARGET_IP'], self._config['TARGET_PORT'], ahex(_packet))
|
||||
# Special Server Data packet, encrypted using frenet, send
|
||||
elif _packet[:4] == SVRD:
|
||||
_enc_pkt = encrypt_packet(self._config['ENCRYPTION_KEY'], _packet)
|
||||
_packet = b'SVRD' + _enc_pkt
|
||||
self.transport.write(_packet, (self._config['TARGET_IP'], self._config['TARGET_PORT']))
|
||||
logger.info('SVRD packet')
|
||||
else:
|
||||
logger.error('(%s) OpenBridge system was asked to send non DMRD packet: %s', self._system, _packet)
|
||||
|
||||
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
|
||||
pass
|
||||
#print(int_id(_peer_id), int_id(_rf_src), int_id(_dst_id), int_id(_seq), _slot, _call_type, _frame_type, repr(_dtype_vseq), int_id(_stream_id))
|
||||
|
||||
def svrd_received(self, _mode, _data):
|
||||
pass
|
||||
|
||||
def datagramReceived(self, _packet, _sockaddr):
|
||||
## print(_packet[:4])
|
||||
# Keep This Line Commented Unless HEAVILY Debugging!
|
||||
#logger.debug('(%s) RX packet from %s -- %s', self._system, _sockaddr, ahex(_packet))
|
||||
## logger.debug('(%s) RX packet from %s -- %s', self._system, _sockaddr, ahex(_packet))
|
||||
if _packet[:4] == DMRD or _packet[:4] == EOBP:
|
||||
if _packet[:4] == EOBP:
|
||||
_d_pkt = decrypt_packet(self._config['ENCRYPTION_KEY'], _packet[4:])
|
||||
_packet = _d_pkt
|
||||
|
||||
if _packet[:4] == DMRD: # DMRData -- encapsulated DMR data frame
|
||||
_data = _packet[:53]
|
||||
_hash = _packet[53:]
|
||||
_ckhs = hmac_new(self._config['PASSPHRASE'],_data,sha1).digest()
|
||||
# DMRData -- encapsulated DMR data frame
|
||||
if _packet[:4] == DMRD:
|
||||
_data = _packet[:53]
|
||||
_hash = _packet[53:]
|
||||
_ckhs = hmac_new(self._config['PASSPHRASE'],_data,sha1).digest()
|
||||
|
||||
if compare_digest(_hash, _ckhs) and _sockaddr == self._config['TARGET_SOCK']:
|
||||
_peer_id = _data[11:15]
|
||||
_seq = _data[4]
|
||||
_rf_src = _data[5:8]
|
||||
_dst_id = _data[8:11]
|
||||
_bits = _data[15]
|
||||
_slot = 2 if (_bits & 0x80) else 1
|
||||
#_call_type = 'unit' if (_bits & 0x40) else 'group'
|
||||
if _bits & 0x40:
|
||||
_call_type = 'unit'
|
||||
elif (_bits & 0x23) == 0x23:
|
||||
_call_type = 'vcsbk'
|
||||
## print(compare_digest(_hash, _ckhs))
|
||||
## print(_sockaddr == self._config['TARGET_SOCK'])
|
||||
## print(ahex(_ckhs))
|
||||
## print(ahex(_hash))
|
||||
|
||||
if compare_digest(_hash, _ckhs) and _sockaddr == self._config['TARGET_SOCK']:
|
||||
_peer_id = _data[11:15]
|
||||
_seq = _data[4]
|
||||
_rf_src = _data[5:8]
|
||||
_dst_id = _data[8:11]
|
||||
_bits = _data[15]
|
||||
_slot = 2 if (_bits & 0x80) else 1
|
||||
#_call_type = 'unit' if (_bits & 0x40) else 'group'
|
||||
if _bits & 0x40:
|
||||
_call_type = 'unit'
|
||||
elif (_bits & 0x23) == 0x23:
|
||||
_call_type = 'vcsbk'
|
||||
else:
|
||||
_call_type = 'group'
|
||||
_frame_type = (_bits & 0x30) >> 4
|
||||
_dtype_vseq = (_bits & 0xF) # data, 1=voice header, 2=voice terminator; voice, 0=burst A ... 5=burst F
|
||||
_stream_id = _data[16:20]
|
||||
#logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._system, int_id(_seq), int_id(_rf_src), int_id(_dst_id))
|
||||
|
||||
# Sanity check for OpenBridge -- all calls must be on Slot 1 for Brandmeister or DMR+. Other HBlinks can process timeslot on OPB if the flag is set
|
||||
if _slot != 1 and not self._config['BOTH_SLOTS'] and not _call_type == 'unit':
|
||||
logger.error('(%s) OpenBridge packet discarded because it was not received on slot 1. SID: %s, TGID %s', self._system, int_id(_rf_src), int_id(_dst_id))
|
||||
return
|
||||
|
||||
# ACL Processing
|
||||
if self._CONFIG['GLOBAL']['USE_ACL']:
|
||||
if not acl_check(_rf_src, self._CONFIG['GLOBAL']['SUB_ACL']):
|
||||
if _stream_id not in self._laststrid:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', self._system, int_id(_stream_id), int_id(_rf_src))
|
||||
self._laststrid.append(_stream_id)
|
||||
return
|
||||
if _slot == 1 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG1_ACL']):
|
||||
if _stream_id not in self._laststrid:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid.append(_stream_id)
|
||||
return
|
||||
if self._config['USE_ACL']:
|
||||
if not acl_check(_rf_src, self._config['SUB_ACL']):
|
||||
if _stream_id not in self._laststrid:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_rf_src))
|
||||
self._laststrid.append(_stream_id)
|
||||
return
|
||||
if not acl_check(_dst_id, self._config['TG1_ACL']):
|
||||
if _stream_id not in self._laststrid:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid.append(_stream_id)
|
||||
return
|
||||
|
||||
# Userland actions -- typically this is the function you subclass for an application
|
||||
self.dmrd_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data)
|
||||
else:
|
||||
_call_type = 'group'
|
||||
_frame_type = (_bits & 0x30) >> 4
|
||||
_dtype_vseq = (_bits & 0xF) # data, 1=voice header, 2=voice terminator; voice, 0=burst A ... 5=burst F
|
||||
_stream_id = _data[16:20]
|
||||
#logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._system, int_id(_seq), int_id(_rf_src), int_id(_dst_id))
|
||||
|
||||
# Sanity check for OpenBridge -- all calls must be on Slot 1
|
||||
if _slot != 1:
|
||||
logger.error('(%s) OpenBridge packet discarded because it was not received on slot 1. SID: %s, TGID %s', self._system, int_id(_rf_src), int_id(_dst_id))
|
||||
return
|
||||
|
||||
# ACL Processing
|
||||
if self._CONFIG['GLOBAL']['USE_ACL']:
|
||||
if not acl_check(_rf_src, self._CONFIG['GLOBAL']['SUB_ACL']):
|
||||
if _stream_id not in self._laststrid:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', self._system, int_id(_stream_id), int_id(_rf_src))
|
||||
self._laststrid.append(_stream_id)
|
||||
return
|
||||
if _slot == 1 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG1_ACL']):
|
||||
if _stream_id not in self._laststrid:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid.append(_stream_id)
|
||||
return
|
||||
if self._config['USE_ACL']:
|
||||
if not acl_check(_rf_src, self._config['SUB_ACL']):
|
||||
if _stream_id not in self._laststrid:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_rf_src))
|
||||
self._laststrid.append(_stream_id)
|
||||
return
|
||||
if not acl_check(_dst_id, self._config['TG1_ACL']):
|
||||
if _stream_id not in self._laststrid:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid.append(_stream_id)
|
||||
return
|
||||
|
||||
# Userland actions -- typically this is the function you subclass for an application
|
||||
self.dmrd_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data)
|
||||
else:
|
||||
logger.info('(%s) OpenBridge HMAC failed, packet discarded - OPCODE: %s DATA: %s HMAC LENGTH: %s HMAC: %s', self._system, _packet[:4], repr(_packet[:53]), len(_packet[53:]), repr(_packet[53:]))
|
||||
if not compare_digest(_hash, _ckhs):
|
||||
logger.info('(%s) OpenBridge HMAC failed, packet discarded - OPCODE: %s DATA: %s HMAC LENGTH: %s HMAC: %s', self._system, _packet[:4], repr(_packet[:53]), len(_packet[53:]), repr(_packet[53:]))
|
||||
|
||||
if not _sockaddr == self._config['TARGET_SOCK']:
|
||||
logger.info('(%s) OpenBridge socket mismatch, packet discarded - OPCODE: %s DATA: %s ', self._system, _packet[:4], repr(_packet[:53]))
|
||||
|
||||
|
||||
# Server Data packet, decrypt and process it.
|
||||
elif _packet[:4] == SVRD:
|
||||
_d_pkt = decrypt_packet(self._config['ENCRYPTION_KEY'], _packet[4:])
|
||||
## logger.info('SVRD Received: ' + str(_d_pkt))
|
||||
# DMR Data packet, sent via SVRD
|
||||
## if _d_pkt[4:8] == b'DATA':
|
||||
## print('----------------------')
|
||||
## _data = _d_pkt[4:]
|
||||
## _peer_id = _data[11:15]
|
||||
## _seq = _data[4]
|
||||
## _rf_src = _data[5:8]
|
||||
## _dst_id = _data[8:11]
|
||||
## _bits = _data[15]
|
||||
## _slot = 2 if (_bits & 0x80) else 1
|
||||
## #_call_type = 'unit' if (_bits & 0x40) else 'group'
|
||||
## if _bits & 0x40:
|
||||
## _call_type = 'unit'
|
||||
## elif (_bits & 0x23) == 0x23:
|
||||
## _call_type = 'vcsbk'
|
||||
## else:
|
||||
## _call_type = 'group'
|
||||
## _frame_type = (_bits & 0x30) >> 4
|
||||
## _dtype_vseq = (_bits & 0xF) # data, 1=voice header, 2=voice terminator; voice, 0=burst A ... 5=burst F
|
||||
## _stream_id = _data[16:20]
|
||||
## print(_stream_id)
|
||||
##
|
||||
## print(_call_type)
|
||||
## self.dmrd_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data)
|
||||
## else:
|
||||
|
||||
self.svrd_received(_d_pkt[4:8], _d_pkt[8:])
|
||||
|
||||
#************************************************
|
||||
# HB MASTER CLASS
|
||||
#************************************************
|
||||
@@ -206,8 +311,7 @@ class HBSYSTEM(DatagramProtocol):
|
||||
self._system = _name
|
||||
self._report = _report
|
||||
self._config = self._CONFIG['SYSTEMS'][self._system]
|
||||
self._laststrid1 = ''
|
||||
self._laststrid2 = ''
|
||||
self._laststrid = {1: b'', 2: b''}
|
||||
|
||||
# Define shortcuts and generic function names based on the type of system we are
|
||||
if self._config['MODE'] == 'MASTER':
|
||||
@@ -230,6 +334,122 @@ class HBSYSTEM(DatagramProtocol):
|
||||
self.maintenance_loop = self.peer_maintenance_loop
|
||||
self.datagramReceived = self.peer_datagramReceived
|
||||
self.dereg = self.peer_dereg
|
||||
|
||||
def check_user_man(self, _id, server_name, peer_ip, _system):
|
||||
#Change this to a config value
|
||||
user_man_url = self._CONFIG['WEB_SERVICE']['URL']
|
||||
shared_secret = str(sha256(self._CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||
## print(int(str(int_id(_id))[:7]))
|
||||
auth_check = {
|
||||
'secret':shared_secret,
|
||||
'login_id':int(str(int_id(_id))[:7]),
|
||||
'login_ip': peer_ip,
|
||||
'login_server': server_name,
|
||||
'system': _system
|
||||
}
|
||||
json_object = json.dumps(auth_check, indent = 4)
|
||||
try:
|
||||
req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
|
||||
resp = json.loads(req.text)
|
||||
print(resp)
|
||||
return resp
|
||||
except requests.ConnectionError:
|
||||
return {'allow':True}
|
||||
|
||||
# Sends login confirmation for log
|
||||
def send_login_conf(self, _id, server_name, peer_ip, old_auth):
|
||||
#Change this to a config value
|
||||
user_man_url = self._CONFIG['WEB_SERVICE']['URL']
|
||||
shared_secret = str(sha256(self._CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||
#print(int(str(int_id(_id))[:7]))
|
||||
auth_conf = {
|
||||
'secret':shared_secret,
|
||||
'login_id':int(str(int_id(_id))[:7]),
|
||||
'login_ip': peer_ip,
|
||||
'login_server': server_name,
|
||||
'login_confirmed': True,
|
||||
'old_auth': old_auth
|
||||
}
|
||||
## print(auth_conf)
|
||||
json_object = json.dumps(auth_conf, indent = 4)
|
||||
try:
|
||||
req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
|
||||
# resp = json.loads(req.text)
|
||||
#return resp
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
# Sends PEER info for map and other stuff
|
||||
def send_peer_loc(self, _id, call, lat, lon, url, description, loc, soft):
|
||||
#Change this to a config value
|
||||
user_man_url = self._CONFIG['WEB_SERVICE']['URL']
|
||||
shared_secret = str(sha256(self._CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||
peer_loc_conf = {
|
||||
'secret':shared_secret,
|
||||
'loc_callsign':re.sub("b'|'|\s\s+", '', str(call)),
|
||||
'dmr_id' : int(str(int_id(_id))),
|
||||
'lat': re.sub("b'|'|\s\s\s+", '', str(lat)),
|
||||
'lon': re.sub("b'|'|\s\s\s+", '', str(lon)),
|
||||
'url': re.sub("b'|'|\s\s\s+", '', str(url)),
|
||||
'description': re.sub("b'|'|\s\s+", '', str(description)),
|
||||
'loc' : re.sub("b'|'|\s\s+", '', str(loc)),
|
||||
'software': re.sub("b'|'|\s\s+", '', str(soft))
|
||||
}
|
||||
json_object = json.dumps(peer_loc_conf, indent = 4)
|
||||
print(json_object)
|
||||
try:
|
||||
req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
|
||||
# resp = json.loads(req.text)
|
||||
#return resp
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
|
||||
def calc_passphrase(self, peer_id, _salt_str):
|
||||
burn_id = ast.literal_eval(os.popen('cat ' + self._CONFIG['WEB_SERVICE']['BURN_FILE']).read())
|
||||
peer_id_trimmed = int(str(int_id(peer_id))[:7])
|
||||
try:
|
||||
## print(self.ums_response)
|
||||
if self.ums_response['mode'] == 'legacy':
|
||||
_calc_hash = bhex(sha256(_salt_str+self._config['PASSPHRASE']).hexdigest())
|
||||
calc_passphrase = self._config['PASSPHRASE']
|
||||
if self.ums_response['mode'] == 'override':
|
||||
_calc_hash = bhex(sha256(_salt_str+str.encode(self.ums_response['value'])).hexdigest())
|
||||
if self.ums_response['mode'] == 'normal':
|
||||
_new_peer_id = bytes_4(int(str(int_id(peer_id))[:7]))
|
||||
peer_id_trimmed = str(peer_id_trimmed)
|
||||
try:
|
||||
if burn_id[peer_id_trimmed]:
|
||||
logger.info('User ID has been burned. Requiring passphrase version: ' + str(burn_id[peer_id_trimmed]))
|
||||
calc_passphrase = sha256(str(self._CONFIG['WEB_SERVICE']['EXTRA_1']).encode() + str(self._CONFIG['WEB_SERVICE']['EXTRA_INT_1']).encode() + str(_new_peer_id).encode()[-3:]).hexdigest().upper().encode()[::14] + base64.b64encode(bytes.fromhex(str(hex(libscrc.ccitt((_new_peer_id) + burn_id[peer_id_trimmed].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['BURN_INT'].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + burn_id[peer_id_trimmed].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['BURN_INT'].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))))[2:].zfill(4)) + (_new_peer_id) + burn_id[peer_id_trimmed].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['BURN_INT'].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + burn_id[peer_id_trimmed].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['BURN_INT'].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))+ sha256(str(self._CONFIG['WEB_SERVICE']['EXTRA_2']).encode() + str(self._CONFIG['WEB_SERVICE']['EXTRA_INT_2']).encode() + str(_new_peer_id).encode()[-3:]).hexdigest().upper().encode()[::14]
|
||||
except:
|
||||
# + base64.b64encode(str.encode(str(_new_peer_id) + self._CONFIG['WEB_SERVICE']['EXTRA_3'] + str(self._CONFIG['WEB_SERVICE']['EXTRA_INT_1'] - self._CONFIG['WEB_SERVICE']['APPEND_INT']) + str(_new_peer_id) + self._CONFIG['WEB_SERVICE']['EXTRA_2']))
|
||||
calc_passphrase = sha256(str(self._CONFIG['WEB_SERVICE']['EXTRA_1']).encode() + str(self._CONFIG['WEB_SERVICE']['EXTRA_INT_1']).encode() + str(_new_peer_id).encode()[-3:]).hexdigest().upper().encode()[::14] + base64.b64encode(bytes.fromhex(str(hex(libscrc.ccitt((_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))))[2:].zfill(4)) + (_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8))) + sha256(str(self._CONFIG['WEB_SERVICE']['EXTRA_2']).encode() + str(self._CONFIG['WEB_SERVICE']['EXTRA_INT_2']).encode() + str(_new_peer_id).encode()[-3:]).hexdigest().upper().encode()[::14]
|
||||
## print(base64.b64encode(calc_passphrase))
|
||||
if self._CONFIG['WEB_SERVICE']['SHORTEN_PASSPHRASE'] == True:
|
||||
## print(calc_passphrase)
|
||||
calc_passphrase = calc_passphrase[::int(self._CONFIG['WEB_SERVICE']['SHORTEN_SAMPLE'])][-int(self._CONFIG['WEB_SERVICE']['SHORTEN_LENGTH']):]
|
||||
if self._CONFIG['WEB_SERVICE']['SHORTEN_PASSPHRASE'] == False:
|
||||
pass
|
||||
_calc_hash = bhex(sha256(_salt_str+calc_passphrase).hexdigest())
|
||||
#If exception, assume UMS down and default to calculated passphrase
|
||||
except Exception as e:
|
||||
logger.info('Execption, Web Service possibly down')
|
||||
_new_peer_id = bytes_4(int(str(int_id(peer_id))[:7]))
|
||||
if peer_id_trimmed in burn_id:
|
||||
logger.info('User ID has been burned. Requiring passphrase version: ' + str(burn_id[peer_id_trimmed]))
|
||||
calc_passphrase = sha256(str(self._CONFIG['WEB_SERVICE']['EXTRA_1']).encode() + str(self._CONFIG['WEB_SERVICE']['EXTRA_INT_1']).encode() + str(_new_peer_id).encode()[-3:]).hexdigest().upper().encode()[::14] + base64.b64encode(bytes.fromhex(str(hex(libscrc.ccitt((_new_peer_id) + burn_id[peer_id_trimmed].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['BURN_INT'].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + burn_id[peer_id_trimmed].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['BURN_INT'].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))))[2:].zfill(4)) + (_new_peer_id) + burn_id[peer_id_trimmed].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['BURN_INT'].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + burn_id[peer_id_trimmed].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['BURN_INT'].to_bytes(2, 'big') + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8))) + sha256(str(self._CONFIG['WEB_SERVICE']['EXTRA_2']).encode() + str(self._CONFIG['WEB_SERVICE']['EXTRA_INT_2']).encode() + str(_new_peer_id).encode()[-3:]).hexdigest().upper().encode()[::14]
|
||||
else:
|
||||
calc_passphrase = sha256(str(self._CONFIG['WEB_SERVICE']['EXTRA_1']).encode() + str(self._CONFIG['WEB_SERVICE']['EXTRA_INT_1']).encode() + str(_new_peer_id).encode()[-3:]).hexdigest().upper().encode()[::14] + base64.b64encode(bytes.fromhex(str(hex(libscrc.ccitt((_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))))[2:].zfill(4)) + (_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8))) + sha256(str(self._CONFIG['WEB_SERVICE']['EXTRA_2']).encode() + str(self._CONFIG['WEB_SERVICE']['EXTRA_INT_2']).encode() + str(_new_peer_id).encode()[-3:]).hexdigest().upper().encode()[::14]
|
||||
|
||||
#calc_passphrase = base64.b64encode(bytes.fromhex(str(hex(libscrc.ccitt((_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))))[2:].zfill(4)) + (_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big') + bytes.fromhex(str(hex(libscrc.posix((_new_peer_id) + self._CONFIG['WEB_SERVICE']['APPEND_INT'].to_bytes(2, 'big'))))[2:].zfill(8)))
|
||||
if self._CONFIG['WEB_SERVICE']['SHORTEN_PASSPHRASE'] == True:
|
||||
calc_passphrase = calc_passphrase[::int(self._CONFIG['WEB_SERVICE']['SHORTEN_SAMPLE'])][-int(self._CONFIG['WEB_SERVICE']['SHORTEN_LENGTH']):]
|
||||
if self._CONFIG['WEB_SERVICE']['SHORTEN_PASSPHRASE'] == False:
|
||||
pass
|
||||
_calc_hash = bhex(sha256(_salt_str+calc_passphrase).hexdigest())
|
||||
## print(calc_passphrase)
|
||||
# print(_calc_hash)
|
||||
return _calc_hash
|
||||
|
||||
|
||||
def startProtocol(self):
|
||||
# Set up periodic loop for tracking pings from peers. Run every 'PING_TIME' seconds
|
||||
@@ -316,6 +536,9 @@ class HBSYSTEM(DatagramProtocol):
|
||||
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
|
||||
pass
|
||||
|
||||
def mmdvm_cmd(self, _cmd):
|
||||
pass
|
||||
|
||||
def master_dereg(self):
|
||||
for _peer in self._peers:
|
||||
self.send_peer(_peer, MSTCL + _peer)
|
||||
@@ -332,6 +555,7 @@ class HBSYSTEM(DatagramProtocol):
|
||||
|
||||
# Extract the command, which is various length, all but one 4 significant characters -- RPTCL
|
||||
_command = _data[:4]
|
||||
## print(self._config)
|
||||
|
||||
if _command == DMRD: # DMRData -- encapsulated DMR data frame
|
||||
_peer_id = _data[11:15]
|
||||
@@ -353,45 +577,39 @@ class HBSYSTEM(DatagramProtocol):
|
||||
_frame_type = (_bits & 0x30) >> 4
|
||||
_dtype_vseq = (_bits & 0xF) # data, 1=voice header, 2=voice terminator; voice, 0=burst A ... 5=burst F
|
||||
_stream_id = _data[16:20]
|
||||
#logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._system, int_id(_seq), int_id(_rf_src), int_id(_dst_id))
|
||||
#logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._system, _seq, int_id(_rf_src), int_id(_dst_id))
|
||||
# ACL Processing
|
||||
if self._CONFIG['GLOBAL']['USE_ACL']:
|
||||
if not acl_check(_rf_src, self._CONFIG['GLOBAL']['SUB_ACL']):
|
||||
if self._laststrid != _stream_id:
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', self._system, int_id(_stream_id), int_id(_rf_src))
|
||||
if _slot == 1:
|
||||
self._laststrid1 = _stream_id
|
||||
else:
|
||||
self._laststrid2 = _stream_id
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
if _slot == 1 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG1_ACL']):
|
||||
if self._laststrid1 != _stream_id:
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid1 = _stream_id
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
if _slot == 2 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG2_ACL']):
|
||||
if self._laststrid2 != _stream_id:
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid2 = _stream_id
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
if self._config['USE_ACL']:
|
||||
if not acl_check(_rf_src, self._config['SUB_ACL']):
|
||||
if self._laststrid != _stream_id:
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_rf_src))
|
||||
if _slot == 1:
|
||||
self._laststrid1 = _stream_id
|
||||
else:
|
||||
self._laststrid2 = _stream_id
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
if _slot == 1 and not acl_check(_dst_id, self._config['TG1_ACL']):
|
||||
if self._laststrid1 != _stream_id:
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid1 = _stream_id
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
if _slot == 2 and not acl_check(_dst_id, self._config['TG2_ACL']):
|
||||
if self._laststrid2 != _stream_id:
|
||||
if self._laststrid[_slot]!= _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid2 = _stream_id
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
|
||||
# The basic purpose of a master is to repeat to the peers
|
||||
@@ -409,11 +627,39 @@ class HBSYSTEM(DatagramProtocol):
|
||||
|
||||
elif _command == RPTL: # RPTLogin -- a repeater wants to login
|
||||
_peer_id = _data[4:8]
|
||||
print()
|
||||
print((self._config['REG_ACL']))
|
||||
print()
|
||||
# Check to see if we've reached the maximum number of allowed peers
|
||||
if len(self._peers) < self._config['MAX_PEERS']:
|
||||
# Check for valid Radio ID
|
||||
if acl_check(_peer_id, self._CONFIG['GLOBAL']['REG_ACL']) and acl_check(_peer_id, self._config['REG_ACL']):
|
||||
# Build the configuration data strcuture for the peer
|
||||
#print(self.check_user_man(_peer_id))
|
||||
if self._config['USE_USER_MAN'] == True:
|
||||
self.ums_response = self.check_user_man(_peer_id, self._CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'], _sockaddr[0], self._system)
|
||||
## print(self.ums_response)
|
||||
#Will allow anyone to attempt authentication, used for a transition period
|
||||
## if acl_check(_peer_id, self._CONFIG['GLOBAL']['REG_ACL']) and self.ums_response['allow'] or acl_check(_peer_id, self._CONFIG['GLOBAL']['REG_ACL']) and acl_check(_peer_id, self._config['REG_ACL']):
|
||||
if acl_check(_peer_id, self._CONFIG['GLOBAL']['REG_ACL']) and self.ums_response['allow']:
|
||||
user_auth = self.ums_response['allow']
|
||||
else:
|
||||
user_auth = False
|
||||
elif self._config['USE_USER_MAN'] == False:
|
||||
print('False')
|
||||
b_acl = self._config['REG_ACL']
|
||||
if self._CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True:
|
||||
# If UMS is False, and Rmote Confir True
|
||||
if acl_check(_peer_id, self._CONFIG['GLOBAL']['REG_ACL']) and acl_check(_peer_id, self._config['REG_ACL']):
|
||||
user_auth = True
|
||||
print(self._CONFIG['GLOBAL']['REG_ACL'])
|
||||
else:
|
||||
user_auth = False
|
||||
#If UMS and Remot Config False
|
||||
elif self._CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == False:
|
||||
user_auth = False
|
||||
if acl_check(_peer_id, self._CONFIG['GLOBAL']['REG_ACL']) and acl_check(_peer_id, b_acl):#acl_check(_peer_id, b_acl):
|
||||
user_auth = True
|
||||
if user_auth == True:
|
||||
# Build the configuration data strcuture for the peer
|
||||
self._peers.update({_peer_id: {
|
||||
'CONNECTION': 'RPTL-RECEIVED',
|
||||
'CONNECTED': time(),
|
||||
@@ -444,9 +690,10 @@ class HBSYSTEM(DatagramProtocol):
|
||||
self.send_peer(_peer_id, b''.join([RPTACK, _salt_str]))
|
||||
self._peers[_peer_id]['CONNECTION'] = 'CHALLENGE_SENT'
|
||||
logger.info('(%s) Sent Challenge Response to %s for login: %s', self._system, int_id(_peer_id), self._peers[_peer_id]['SALT'])
|
||||
## print(self._peers)
|
||||
else:
|
||||
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
|
||||
logger.warning('(%s) Invalid Login from Radio ID: %s Denied by Registation ACL', self._system, int_id(_peer_id))
|
||||
logger.warning('(%s) Invalid Login from %s Radio ID: %s Denied by Registation ACL', self._system, _sockaddr[0], int_id(_peer_id))
|
||||
else:
|
||||
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
|
||||
logger.warning('(%s) Registration denied from Radio ID: %s Maximum number of peers exceeded', self._system, int_id(_peer_id))
|
||||
@@ -460,11 +707,27 @@ class HBSYSTEM(DatagramProtocol):
|
||||
_this_peer['LAST_PING'] = time()
|
||||
_sent_hash = _data[8:]
|
||||
_salt_str = bytes_4(_this_peer['SALT'])
|
||||
_calc_hash = bhex(sha256(_salt_str+self._config['PASSPHRASE']).hexdigest())
|
||||
# Used to allow config passphrase AND calculated.
|
||||
_ocalc_hash = bhex(sha256(_salt_str+self._config['PASSPHRASE']).hexdigest())
|
||||
|
||||
#print(self.ums_response)
|
||||
if self._config['USE_USER_MAN'] == True:
|
||||
# print(self.calc_passphrase(_peer_id, _salt_str))
|
||||
_calc_hash = self.calc_passphrase(_peer_id, _salt_str)
|
||||
if self._config['USE_USER_MAN'] == False:
|
||||
_calc_hash = bhex(sha256(_salt_str+self._config['PASSPHRASE']).hexdigest())
|
||||
# Uncomment below to only accept calculated passphrase
|
||||
if _sent_hash == _calc_hash:
|
||||
# Condition below accepts either calculated passphrase or config passphrase
|
||||
## if _sent_hash == _calc_hash or _sent_hash == _ocalc_hash:
|
||||
_this_peer['CONNECTION'] = 'WAITING_CONFIG'
|
||||
self.send_peer(_peer_id, b''.join([RPTACK, _peer_id]))
|
||||
logger.info('(%s) Peer %s has completed the login exchange successfully', self._system, _this_peer['RADIO_ID'])
|
||||
self.send_login_conf(_peer_id, self._CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'], _sockaddr[0], False)
|
||||
## if _sent_hash == _ocalc_hash:
|
||||
## self.send_login_conf(_peer_id, self._CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'], _sockaddr[0], True)
|
||||
## else:
|
||||
## self.send_login_conf(_peer_id, self._CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'], _sockaddr[0], False)
|
||||
else:
|
||||
logger.info('(%s) Peer %s has FAILED the login exchange successfully', self._system, _this_peer['RADIO_ID'])
|
||||
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
|
||||
@@ -481,6 +744,7 @@ class HBSYSTEM(DatagramProtocol):
|
||||
and self._peers[_peer_id]['SOCKADDR'] == _sockaddr:
|
||||
logger.info('(%s) Peer is closing down: %s (%s)', self._system, self._peers[_peer_id]['CALLSIGN'], int_id(_peer_id))
|
||||
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
|
||||
self.send_peer_loc(_peer_id, self._peers[_peer_id]['CALLSIGN'], '*', '*', '*', '*', '*', '*')
|
||||
del self._peers[_peer_id]
|
||||
|
||||
else:
|
||||
@@ -509,6 +773,12 @@ class HBSYSTEM(DatagramProtocol):
|
||||
|
||||
self.send_peer(_peer_id, b''.join([RPTACK, _peer_id]))
|
||||
logger.info('(%s) Peer %s (%s) has sent repeater configuration', self._system, _this_peer['CALLSIGN'], _this_peer['RADIO_ID'])
|
||||
if 'NO_MAP' in str(_this_peer['LOCATION']):
|
||||
self.send_peer_loc(_peer_id, self._peers[_peer_id]['CALLSIGN'], '*', '*', '*', '*', '*', '*')
|
||||
## print(_this_peer['LOCATION'])
|
||||
## pass
|
||||
else:
|
||||
self.send_peer_loc(_peer_id, _this_peer['CALLSIGN'], _this_peer['LATITUDE'], _this_peer['LONGITUDE'], _this_peer['URL'], _this_peer['DESCRIPTION'], _this_peer['LOCATION'], str(_this_peer['PACKAGE_ID']) + ' - ' + str(_this_peer['SOFTWARE_ID']))
|
||||
else:
|
||||
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
|
||||
logger.warning('(%s) Peer info from Radio ID that has not logged in: %s', self._system, int_id(_peer_id))
|
||||
@@ -526,6 +796,22 @@ class HBSYSTEM(DatagramProtocol):
|
||||
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
|
||||
logger.warning('(%s) Ping from Radio ID that is not logged in: %s', self._system, int_id(_peer_id))
|
||||
|
||||
elif _command == RPTO:
|
||||
_peer_id = _data[4:8]
|
||||
if _peer_id in self._peers \
|
||||
and self._peers[_peer_id]['CONNECTION'] == 'YES' \
|
||||
and self._peers[_peer_id]['SOCKADDR'] == _sockaddr:
|
||||
logger.info('(%s) Peer %s (%s) has send options: %s', self._system, self._peers[_peer_id]['CALLSIGN'], int_id(_peer_id), _data[8:])
|
||||
# Send remove from map command
|
||||
## self.mmdvm_cmd(_data)
|
||||
if 'NO_MAP' in str(_data[8:]):
|
||||
self.send_peer_loc(_peer_id, self._peers[_peer_id]['CALLSIGN'], '*', '*', '*', '*', '*', '*')
|
||||
self.transport.write(b''.join([RPTACK, _peer_id]), _sockaddr)
|
||||
|
||||
elif _command == DMRA:
|
||||
_peer_id = _data[4:8]
|
||||
logger.info('(%s) Recieved DMR Talker Alias from peer %s, subscriber %s', self._system, self._peers[_peer_id]['CALLSIGN'], int_id(_rf_src))
|
||||
|
||||
else:
|
||||
logger.error('(%s) Unrecognized command. Raw HBP PDU: %s', self._system, ahex(_data))
|
||||
|
||||
@@ -562,41 +848,35 @@ class HBSYSTEM(DatagramProtocol):
|
||||
# ACL Processing
|
||||
if self._CONFIG['GLOBAL']['USE_ACL']:
|
||||
if not acl_check(_rf_src, self._CONFIG['GLOBAL']['SUB_ACL']):
|
||||
if self._laststrid != _stream_id:
|
||||
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', self._system, int_id(_stream_id), int_id(_rf_src))
|
||||
if _slot == 1:
|
||||
self._laststrid1 = _stream_id
|
||||
else:
|
||||
self._laststrid2 = _stream_id
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', self._system, int_id(_stream_id), int_id(_rf_src))
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
if _slot == 1 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG1_ACL']):
|
||||
if self._laststrid1 != _stream_id:
|
||||
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid1 = _stream_id
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
if _slot == 2 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG2_ACL']):
|
||||
if self._laststrid2 != _stream_id:
|
||||
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid2 = _stream_id
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
if self._config['USE_ACL']:
|
||||
if not acl_check(_rf_src, self._config['SUB_ACL']):
|
||||
if self._laststrid != _stream_id:
|
||||
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_rf_src))
|
||||
if _slot == 1:
|
||||
self._laststrid1 = _stream_id
|
||||
else:
|
||||
self._laststrid2 = _stream_id
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_rf_src))
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
if _slot == 1 and not acl_check(_dst_id, self._config['TG1_ACL']):
|
||||
if self._laststrid1 != _stream_id:
|
||||
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid1 = _stream_id
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
if _slot == 2 and not acl_check(_dst_id, self._config['TG2_ACL']):
|
||||
if self._laststrid2 != _stream_id:
|
||||
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid2 = _stream_id
|
||||
if self._laststrid[_slot] != _stream_id:
|
||||
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
|
||||
self._laststrid[_slot] = _stream_id
|
||||
return
|
||||
|
||||
|
||||
@@ -661,6 +941,7 @@ class HBSYSTEM(DatagramProtocol):
|
||||
self._stats['CONNECTION'] = 'YES'
|
||||
self._stats['CONNECTED'] = time()
|
||||
logger.info('(%s) Connection to Master Completed', self._system)
|
||||
|
||||
# If we are an XLX, send the XLX module request here.
|
||||
if self._config['MODE'] == 'XLXPEER':
|
||||
self.send_xlxmaster(self._config['RADIO_ID'], int(4000), self._config['MASTER_SOCKADDR'])
|
||||
@@ -802,7 +1083,7 @@ if __name__ == '__main__':
|
||||
if cli_args.LOG_LEVEL:
|
||||
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||
logger = log.config_logging(CONFIG['LOGGER'])
|
||||
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n')
|
||||
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019, 2020\n\tThe Regents of the K0USY Group. All rights reserved.\n')
|
||||
logger.debug('(GLOBAL) Logging system started, anything from here on gets logged')
|
||||
|
||||
# Set up the signal handler
|
||||
@@ -818,6 +1099,7 @@ if __name__ == '__main__':
|
||||
|
||||
peer_ids, subscriber_ids, talkgroup_ids = mk_aliases(CONFIG)
|
||||
|
||||
|
||||
# INITIALIZE THE REPORTING LOOP
|
||||
if CONFIG['REPORTS']['REPORT']:
|
||||
report_server = config_reports(CONFIG, reportFactory)
|
||||
@@ -836,4 +1118,8 @@ if __name__ == '__main__':
|
||||
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
|
||||
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
|
||||
|
||||
# Download burn list
|
||||
with open(CONFIG['WEB_SERVICE']['BURN_FILE'], 'w') as f:
|
||||
f.write(str(download_burnlist(CONFIG)))
|
||||
|
||||
reactor.run()
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
from twisted.internet.protocol import DatagramProtocol
|
||||
from twisted.internet import reactor, task
|
||||
from time import time
|
||||
from resettabletimer import ResettableTimer
|
||||
from dmr_utils3.utils import int_id
|
||||
import random
|
||||
|
||||
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
|
||||
__author__ = 'Simon Adlem - G7RZU'
|
||||
__copyright__ = 'Copyright (c) Simon Adlem, G7RZU 2020,2021'
|
||||
__credits__ = 'Jon Lee, G4TSN; Norman Williams, M6NBP'
|
||||
__license__ = 'GNU GPLv3'
|
||||
__maintainer__ = 'Simon Adlem G7RZU'
|
||||
__email__ = 'simon@gb7fr.org.uk'
|
||||
|
||||
class Proxy(DatagramProtocol):
|
||||
|
||||
def __init__(self,Master,ListenPort,connTrack,blackList,Timeout,Debug,DestportStart,DestPortEnd):
|
||||
self.master = Master
|
||||
self.connTrack = connTrack
|
||||
self.peerTrack = {}
|
||||
self.timeout = Timeout
|
||||
self.debug = Debug
|
||||
self.blackList = blackList
|
||||
self.destPortStart = DestportStart
|
||||
self.destPortEnd = DestPortEnd
|
||||
self.numPorts = DestPortEnd - DestportStart
|
||||
|
||||
|
||||
def reaper(self,_peer_id):
|
||||
if self.debug:
|
||||
print("dead",_peer_id)
|
||||
self.transport.write(b'RPTCL'+_peer_id, ('127.0.0.1',self.peerTrack[_peer_id]['dport']))
|
||||
self.connTrack[self.peerTrack[_peer_id]['dport']] = False
|
||||
del self.peerTrack[_peer_id]
|
||||
|
||||
|
||||
def datagramReceived(self, data, addr):
|
||||
|
||||
# HomeBrew Protocol Commands
|
||||
DMRD = b'DMRD'
|
||||
DMRA = b'DMRA'
|
||||
MSTCL = b'MSTCL'
|
||||
MSTNAK = b'MSTNAK'
|
||||
MSTPONG = b'MSTPONG'
|
||||
MSTN = b'MSTN'
|
||||
MSTP = b'MSTP'
|
||||
MSTC = b'MSTC'
|
||||
RPTL = b'RPTL'
|
||||
RPTPING = b'RPTPING'
|
||||
RPTCL = b'RPTCL'
|
||||
RPTL = b'RPTL'
|
||||
RPTACK = b'RPTACK'
|
||||
RPTK = b'RPTK'
|
||||
RPTC = b'RPTC'
|
||||
RPTP = b'RPTP'
|
||||
RPTA = b'RPTA'
|
||||
RPTO = b'RPTO'
|
||||
|
||||
host,port = addr
|
||||
|
||||
nowtime = time()
|
||||
|
||||
Debug = self.debug
|
||||
|
||||
#If the packet comes from the master
|
||||
if host == self.master:
|
||||
_command = data[:4]
|
||||
_lng_command = data[:6]
|
||||
#### print(_lng_command)
|
||||
|
||||
|
||||
if _command == DMRD:
|
||||
_peer_id = data[11:15]
|
||||
## print(self.peerTrack[_peer_id]['timer'])
|
||||
elif _command == RPTA:
|
||||
if data[6:10] in self.peerTrack:
|
||||
_peer_id = data[6:10]
|
||||
else:
|
||||
_peer_id = self.connTrack[port]
|
||||
elif _lng_command == MSTNAK:
|
||||
_peer_id = data[6:10]
|
||||
|
||||
elif _command == MSTN and MSTNAK not in _lng_command:
|
||||
_peer_id = data[6:10]
|
||||
|
||||
self.peerTrack[_peer_id]['timer'].cancel()
|
||||
self.reaper(_peer_id)
|
||||
return
|
||||
elif _command == MSTP:
|
||||
_peer_id = data[7:11]
|
||||
## print(self.peerTrack)
|
||||
elif _command == MSTC:
|
||||
_peer_id = data[5:9]
|
||||
self.peerTrack[_peer_id]['timer'].cancel()
|
||||
self.reaper(_peer_id)
|
||||
return
|
||||
|
||||
# _peer_id = self.connTrack[port]
|
||||
if self.debug:
|
||||
print(data)
|
||||
if _peer_id and _peer_id in self.peerTrack:
|
||||
self.transport.write(data,(self.peerTrack[_peer_id]['shost'],self.peerTrack[_peer_id]['sport']))
|
||||
#self.peerTrack[_peer_id]['timer'].reset()
|
||||
return
|
||||
|
||||
|
||||
|
||||
else:
|
||||
_command = data[:4]
|
||||
|
||||
if _command == DMRD: # DMRData -- encapsulated DMR data frame
|
||||
_peer_id = data[11:15]
|
||||
elif _command == DMRA: # DMRAlias -- Talker Alias information
|
||||
_peer_id = _data[4:8]
|
||||
elif _command == RPTL: # RPTLogin -- a repeater wants to login
|
||||
_peer_id = data[4:8]
|
||||
elif _command == RPTK: # Repeater has answered our login challenge
|
||||
_peer_id = data[4:8]
|
||||
elif _command == RPTC: # Repeater is sending it's configuraiton OR disconnecting
|
||||
if data[:5] == RPTCL: # Disconnect command
|
||||
_peer_id = data[5:9]
|
||||
else:
|
||||
_peer_id = data[4:8] # Configure Command
|
||||
elif _command == RPTO: # options
|
||||
_peer_id = data[4:8]
|
||||
elif _command == RPTP: # RPTPing -- peer is pinging us
|
||||
_peer_id = data[7:11]
|
||||
else:
|
||||
return
|
||||
|
||||
if _peer_id in self.peerTrack:
|
||||
_dport = self.peerTrack[_peer_id]['dport']
|
||||
self.peerTrack[_peer_id]['sport'] = port
|
||||
self.peerTrack[_peer_id]['shost'] = host
|
||||
self.transport.write(data, ('127.0.0.1',_dport))
|
||||
self.peerTrack[_peer_id]['timer'].reset()
|
||||
if self.debug:
|
||||
print(data)
|
||||
print(_dport)
|
||||
return
|
||||
else:
|
||||
|
||||
if int_id(_peer_id) in self.blackList:
|
||||
return
|
||||
#for _dport in self.connTrack:
|
||||
while True:
|
||||
_dport = random.randint(1,(self.numPorts - 1))
|
||||
_dport = _dport + self.destPortStart
|
||||
if not self.connTrack[_dport]:
|
||||
break
|
||||
self.connTrack[_dport] = _peer_id
|
||||
self.peerTrack[_peer_id] = {}
|
||||
self.peerTrack[_peer_id]['dport'] = _dport
|
||||
self.peerTrack[_peer_id]['sport'] = port
|
||||
self.peerTrack[_peer_id]['shost'] = host
|
||||
self.peerTrack[_peer_id]['timer'] = ResettableTimer(self.timeout,self.reaper,[_peer_id])
|
||||
self.peerTrack[_peer_id]['timer'].start()
|
||||
self.transport.write(data, (self.master,_dport))
|
||||
if self.debug:
|
||||
print(data)
|
||||
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
#*** CONFIG HERE ***
|
||||
|
||||
Master = "127.0.0.1"
|
||||
ListenPort = 62031
|
||||
DestportStart = 54100
|
||||
DestPortEnd = 54102
|
||||
Timeout = 30
|
||||
Stats = True
|
||||
Debug = True
|
||||
BlackList = [1234567]
|
||||
|
||||
#*******************
|
||||
|
||||
|
||||
CONNTRACK = {}
|
||||
|
||||
for port in range(DestportStart,DestPortEnd+1,1):
|
||||
CONNTRACK[port] = False
|
||||
|
||||
|
||||
reactor.listenUDP(ListenPort,Proxy(Master,ListenPort,CONNTRACK,BlackList,Timeout,Debug,DestportStart,DestPortEnd))
|
||||
|
||||
def loopingErrHandle(failure):
|
||||
print('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error innowtimed loop.\n {}'.format(failure))
|
||||
reactor.stop()
|
||||
|
||||
def stats():
|
||||
count = 0
|
||||
nowtime = time()
|
||||
for port in CONNTRACK:
|
||||
if CONNTRACK[port]:
|
||||
count = count+1
|
||||
|
||||
totalPorts = DestPortEnd - DestportStart
|
||||
freePorts = totalPorts - count
|
||||
|
||||
print("{} ports out of {} in use ({} free)".format(count,totalPorts,freePorts))
|
||||
|
||||
|
||||
|
||||
if Stats == True:
|
||||
stats_task = task.LoopingCall(stats)
|
||||
statsa = stats_task.start(30)
|
||||
statsa.addErrback(loopingErrHandle)
|
||||
|
||||
reactor.run()
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Install the required support programs
|
||||
apt-get install python3 python3-pip -y
|
||||
pip3 install -r requirements.txt
|
||||
|
||||
+10
-12
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
###############################################################################
|
||||
# Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
#
|
||||
# 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
|
||||
@@ -21,11 +21,10 @@
|
||||
from bitarray import bitarray
|
||||
from dmr_utils3 import bptc, golay, qr
|
||||
from dmr_utils3.utils import bytes_3, bytes_4
|
||||
from dmr_utils3.const import EMB, SLOT_TYPE, BS_VOICE_SYNC, BS_DATA_SYNC, LC_OPT_G
|
||||
from dmr_utils3.const import EMB, SLOT_TYPE, BS_VOICE_SYNC, BS_DATA_SYNC, LC_OPT
|
||||
from random import randint
|
||||
from voice_lib import words
|
||||
|
||||
|
||||
# Precalculated "dmrbits" (DMRD packet byte 15) -- just (slot << 7 | this value) and you're good to go!
|
||||
HEADBITS = 0b00100001
|
||||
BURSTBITS = [0b00010000,0b00000001,0b00000010,0b00000011,0b00000100,0b00000101]
|
||||
@@ -45,7 +44,7 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
|
||||
# Calculate all of the static components up-front
|
||||
STREAM_ID = bytes_4(randint(0x00, 0xFFFFFFFF))
|
||||
SDP = _rf_src + _dst_id + _peer
|
||||
LC = LC_OPT_G + _dst_id + _rf_src
|
||||
LC = LC_OPT + _dst_id + _rf_src
|
||||
|
||||
HEAD_LC = bptc.encode_header_lc(LC)
|
||||
HEAD_LC = [HEAD_LC[:98], HEAD_LC[-98:]]
|
||||
@@ -64,7 +63,6 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
|
||||
EMBED.append(EMB['BURST_F'][:8] + NULL_EMB_LC + EMB['BURST_F'][-8:])
|
||||
|
||||
|
||||
|
||||
#initialize the HBP calls stream sequence to 0
|
||||
SEQ = 0
|
||||
|
||||
@@ -79,15 +77,15 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
|
||||
# Send each burst, six bursts per Superframe rotating through with the proper EMBED value per burst A-F
|
||||
for word in _phrase:
|
||||
for burst in range(0, len(word)):
|
||||
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | BURSTBITS[burst % 6]]) + STREAM_ID + (word[burst][0] + EMBED[burst % 6] + word[burst][1]).tobytes() + TAIL
|
||||
print(burst)
|
||||
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | BURSTBITS[burst % 6]]) + STREAM_ID + (word[burst + 0][0] + EMBED[burst % 6] + word[burst + 0][1]).tobytes() + TAIL
|
||||
SEQ = (SEQ + 1) % 0x100
|
||||
yield pkt
|
||||
|
||||
# Send 2 Voice Terminator Frames
|
||||
for i in range(2):
|
||||
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | TERMBITS]) + STREAM_ID + (TERM_LC[0] + SLOT_TYPE['VOICE_LC_TERM'][:10] + BS_DATA_SYNC + SLOT_TYPE['VOICE_LC_TERM'][-10:] + TERM_LC[1]).tobytes() + TAIL
|
||||
SEQ = (SEQ + 1) % 0x100
|
||||
yield pkt
|
||||
# Send a single Voice Terminator Frame
|
||||
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | TERMBITS]) + STREAM_ID + (TERM_LC[0] + SLOT_TYPE['VOICE_LC_TERM'][:10] + BS_DATA_SYNC + SLOT_TYPE['VOICE_LC_TERM'][-10:] + TERM_LC[1]).tobytes() + TAIL
|
||||
SEQ = (SEQ + 1) % 0x100
|
||||
yield pkt
|
||||
|
||||
# Return False to indicate we're done.
|
||||
return False
|
||||
@@ -96,7 +94,7 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
|
||||
if __name__ == '__main__':
|
||||
from time import time
|
||||
|
||||
speech = pkt_gen(bytes_3(3120101), bytes_3(3120), bytes_4(312000), 0, [words['connected']])
|
||||
speech = pkt_gen(bytes_3(3120101), bytes_3(3120), bytes_4(312000), 0, [words['all_circuits'], words['all_circuits']])
|
||||
|
||||
|
||||
while True:
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Script to generate a key for Encrypted OpenBridge
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
import re
|
||||
|
||||
def gen_key():
|
||||
key = Fernet.generate_key()
|
||||
return key
|
||||
|
||||
print('Key: ' + str(gen_key())[2:-1])
|
||||
+51
-44
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
###############################################################################
|
||||
# Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
#
|
||||
# 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
|
||||
@@ -18,43 +18,30 @@
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
###############################################################################
|
||||
|
||||
'''
|
||||
This is a short program that is intended to be used only to validate voice entries
|
||||
in the voice_lib.py file. It should only be used for building voice libraries and
|
||||
only used during development to validate the entires.
|
||||
|
||||
It uses a number of hard-coded parameters, like the voice files to play back, the
|
||||
slot, talkgroup, source, etc. of the originating stream.
|
||||
|
||||
It is not for novices to use, and should only be used by those comfortable with
|
||||
how DMR packets are build and Python. It does not handle OpenBridge systems, only
|
||||
HBP systems, and it is HIGHLY recommended to only use it against a single system
|
||||
at a time.
|
||||
|
||||
It is a development and debugging tool and has no purpose in actual production
|
||||
DMR networking systems.
|
||||
'''
|
||||
|
||||
|
||||
# Python modules we need
|
||||
from time import sleep
|
||||
import sys
|
||||
from bitarray import bitarray
|
||||
from time import time, sleep
|
||||
from importlib import import_module
|
||||
from binascii import b2a_hex as bhex
|
||||
from threading import Thread
|
||||
|
||||
# Twisted is pretty important, so I keep it separate
|
||||
from twisted.internet.protocol import Factory, Protocol
|
||||
from twisted.internet import reactor
|
||||
from twisted.protocols.basic import NetstringReceiver
|
||||
from twisted.internet import reactor, task
|
||||
|
||||
# Things we import from the main hblink module
|
||||
from hblink import HBSYSTEM, systems, hblink_handler
|
||||
from dmr_utils3.utils import bytes_3, bytes_4, int_id
|
||||
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, mk_aliases
|
||||
from dmr_utils3.utils import bytes_3, bytes_4, int_id, get_alias
|
||||
from dmr_utils3 import decode, bptc, const
|
||||
import config
|
||||
import log
|
||||
from const import *
|
||||
from mk_voice import pkt_gen
|
||||
from voice_lib import words
|
||||
|
||||
|
||||
# Stuff for socket reporting
|
||||
import pickle
|
||||
# REMOVE LATER from datetime import datetime
|
||||
# The module needs logging, but handlers, etc. are controlled by the parent
|
||||
import logging
|
||||
@@ -71,31 +58,41 @@ __email__ = 'n0mjs@me.com'
|
||||
|
||||
# Module gobal varaibles
|
||||
|
||||
|
||||
class OBP(OPENBRIDGE):
|
||||
|
||||
def __init__(self, _name, _config, _report):
|
||||
OPENBRIDGE.__init__(self, _name, _config, _report)
|
||||
|
||||
|
||||
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
|
||||
pass
|
||||
|
||||
|
||||
class HBP(HBSYSTEM):
|
||||
|
||||
def __init__(self, _name, _config, _report):
|
||||
HBSYSTEM.__init__(self, _name, _config, _report)
|
||||
self.last_stream = b'\x00'
|
||||
|
||||
def play_voice(self, _rf_src, _tgid, _peer, _slot, _speech):
|
||||
speech = pkt_gen(_rf_src, _tgid, _peer, _slot, _speech)
|
||||
|
||||
sleep(1)
|
||||
while True:
|
||||
try:
|
||||
pkt = next(speech)
|
||||
except StopIteration:
|
||||
break
|
||||
sleep(.058)
|
||||
self.send_system(pkt)
|
||||
return None
|
||||
|
||||
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
|
||||
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM) and (_stream_id != self.last_stream) and (_dst_id == bytes_3(2)):
|
||||
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM) and (_stream_id != self.last_stream):
|
||||
print(int_id(_stream_id), int_id(self.last_stream))
|
||||
self.last_stream = _stream_id
|
||||
|
||||
feedback = Thread(target=self.play_voice(bytes_3(3120102), bytes_3(2), bytes_4(3120119), 0, [words['connected'], words['kansas_link']]))
|
||||
feedback.start()
|
||||
print('start speech')
|
||||
speech = pkt_gen(bytes_3(3120101), bytes_3(2), bytes_4(3120119), 0, [words['all_circuits'],words['all_circuits']])
|
||||
|
||||
sleep(1)
|
||||
while True:
|
||||
try:
|
||||
pkt = next(speech)
|
||||
except StopIteration:
|
||||
break
|
||||
sleep(.058)
|
||||
self.send_system(pkt)
|
||||
print(bhex(pkt))
|
||||
print('end speech')
|
||||
|
||||
|
||||
|
||||
#************************************************
|
||||
@@ -143,14 +140,23 @@ if __name__ == '__main__':
|
||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||
signal.signal(sig, sig_handler)
|
||||
|
||||
# Create the name-number mapping dictionaries
|
||||
peer_ids, subscriber_ids, talkgroup_ids = mk_aliases(CONFIG)
|
||||
|
||||
# INITIALIZE THE REPORTING LOOP
|
||||
report_server = None
|
||||
if CONFIG['REPORTS']['REPORT']:
|
||||
report_server = config_reports(CONFIG, bridgeReportFactory)
|
||||
else:
|
||||
report_server = None
|
||||
logger.info('(REPORT) TCP Socket reporting not configured')
|
||||
|
||||
# HBlink instance creation
|
||||
logger.info('(GLOBAL) HBlink \'bridge.py\' -- SYSTEM STARTING...')
|
||||
for system in CONFIG['SYSTEMS']:
|
||||
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
||||
if CONFIG['SYSTEMS'][system]['MODE'] == 'MASTER' or CONFIG['SYSTEMS'][system]['MODE'] == 'PEER':
|
||||
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
|
||||
systems[system] = OBP(system, CONFIG, report_server)
|
||||
else:
|
||||
systems[system] = HBP(system, CONFIG, report_server)
|
||||
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
|
||||
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
|
||||
@@ -159,4 +165,5 @@ if __name__ == '__main__':
|
||||
logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure)
|
||||
reactor.stop()
|
||||
|
||||
|
||||
reactor.run()
|
||||
|
||||
Executable
+229
@@ -0,0 +1,229 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
###############################################################################
|
||||
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com> (and Mike Zingman N4IRR)
|
||||
#
|
||||
# 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
|
||||
###############################################################################
|
||||
|
||||
|
||||
# Python modules we need
|
||||
import sys
|
||||
from bitarray import bitarray
|
||||
from time import time, sleep
|
||||
from importlib import import_module
|
||||
|
||||
# Twisted is pretty important, so I keep it separate
|
||||
from twisted.internet.protocol import Factory, Protocol
|
||||
from twisted.protocols.basic import NetstringReceiver
|
||||
from twisted.internet import reactor, task
|
||||
|
||||
# Things we import from the main hblink module
|
||||
from hblink import HBSYSTEM, systems, hblink_handler, reportFactory, REPORT_OPCODES, config_reports, mk_aliases
|
||||
from dmr_utils3.utils import bytes_3, int_id, get_alias
|
||||
from dmr_utils3 import decode, bptc, const
|
||||
import config
|
||||
import log
|
||||
import const
|
||||
|
||||
# The module needs logging logging, but handlers, etc. are controlled by the parent
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
|
||||
__author__ = 'Cortney T. Buffington, N0MJS and Mike Zingman, N4IRR'
|
||||
__copyright__ = 'Copyright (c) 2016-2019 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||
__license__ = 'GNU GPLv3'
|
||||
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||
__email__ = 'n0mjs@me.com'
|
||||
__status__ = 'pre-alpha'
|
||||
|
||||
# Module gobal varaibles
|
||||
|
||||
class playback(HBSYSTEM):
|
||||
|
||||
def __init__(self, _name, _config, _report):
|
||||
HBSYSTEM.__init__(self, _name, _config, _report)
|
||||
|
||||
# Status information for the system, TS1 & TS2
|
||||
# 1 & 2 are "timeslot"
|
||||
# In TX_EMB_LC, 2-5 are burst B-E
|
||||
self.STATUS = {
|
||||
1: {
|
||||
'RX_START': time(),
|
||||
'RX_SEQ': '\x00',
|
||||
'RX_RFS': '\x00',
|
||||
'TX_RFS': '\x00',
|
||||
'RX_STREAM_ID': '\x00',
|
||||
'TX_STREAM_ID': '\x00',
|
||||
'RX_TGID': '\x00\x00\x00',
|
||||
'TX_TGID': '\x00\x00\x00',
|
||||
'RX_TIME': time(),
|
||||
'TX_TIME': time(),
|
||||
'RX_TYPE': const.HBPF_SLT_VTERM,
|
||||
'RX_LC': '\x00',
|
||||
'TX_H_LC': '\x00',
|
||||
'TX_T_LC': '\x00',
|
||||
'TX_EMB_LC': {
|
||||
1: '\x00',
|
||||
2: '\x00',
|
||||
3: '\x00',
|
||||
4: '\x00',
|
||||
}
|
||||
},
|
||||
2: {
|
||||
'RX_START': time(),
|
||||
'RX_SEQ': '\x00',
|
||||
'RX_RFS': '\x00',
|
||||
'TX_RFS': '\x00',
|
||||
'RX_STREAM_ID': '\x00',
|
||||
'TX_STREAM_ID': '\x00',
|
||||
'RX_TGID': '\x00\x00\x00',
|
||||
'TX_TGID': '\x00\x00\x00',
|
||||
'RX_TIME': time(),
|
||||
'TX_TIME': time(),
|
||||
'RX_TYPE': const.HBPF_SLT_VTERM,
|
||||
'RX_LC': '\x00',
|
||||
'TX_H_LC': '\x00',
|
||||
'TX_T_LC': '\x00',
|
||||
'TX_EMB_LC': {
|
||||
1: '\x00',
|
||||
2: '\x00',
|
||||
3: '\x00',
|
||||
4: '\x00',
|
||||
}
|
||||
}
|
||||
}
|
||||
self.CALL_DATA = []
|
||||
|
||||
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
|
||||
pkt_time = time()
|
||||
dmrpkt = _data[20:53]
|
||||
_bits = _data[15]
|
||||
if _call_type == 'group':
|
||||
|
||||
# Is this is a new call stream?
|
||||
if (_stream_id != self.STATUS[_slot]['RX_STREAM_ID']):
|
||||
self.STATUS['RX_START'] = pkt_time
|
||||
logger.info('(%s) *START RECORDING* STREAM ID: %s SUB: %s (%s) REPEATER: %s (%s) TGID %s (%s), TS %s', \
|
||||
self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot)
|
||||
self.CALL_DATA.append(_data)
|
||||
self.STATUS[_slot]['RX_STREAM_ID'] = _stream_id
|
||||
return
|
||||
|
||||
# Final actions - Is this a voice terminator?
|
||||
if (_frame_type == const.HBPF_DATA_SYNC) and (_dtype_vseq == const.HBPF_SLT_VTERM) and (self.STATUS[_slot]['RX_TYPE'] != const.HBPF_SLT_VTERM) and (self.CALL_DATA):
|
||||
call_duration = pkt_time - self.STATUS['RX_START']
|
||||
self.CALL_DATA.append(_data)
|
||||
logger.info('(%s) *END RECORDING* STREAM ID: %s', self._system, int_id(_stream_id))
|
||||
sleep(2)
|
||||
logger.info('(%s) *START PLAYBACK* STREAM ID: %s SUB: %s (%s) REPEATER: %s (%s) TGID %s (%s), TS %s, Duration: %s', \
|
||||
self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot, call_duration)
|
||||
for i in self.CALL_DATA:
|
||||
self.send_system(i)
|
||||
#print(i)
|
||||
sleep(0.06)
|
||||
self.CALL_DATA = []
|
||||
logger.info('(%s) *END PLAYBACK* STREAM ID: %s', self._system, int_id(_stream_id))
|
||||
|
||||
else:
|
||||
if self.CALL_DATA:
|
||||
self.CALL_DATA.append(_data)
|
||||
|
||||
|
||||
# Mark status variables for use later
|
||||
self.STATUS[_slot]['RX_RFS'] = _rf_src
|
||||
self.STATUS[_slot]['RX_TYPE'] = _dtype_vseq
|
||||
self.STATUS[_slot]['RX_TGID'] = _dst_id
|
||||
self.STATUS[_slot]['RX_TIME'] = pkt_time
|
||||
self.STATUS[_slot]['RX_STREAM_ID'] = _stream_id
|
||||
|
||||
|
||||
#************************************************
|
||||
# MAIN PROGRAM LOOP STARTS HERE
|
||||
#************************************************
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
import signal
|
||||
from dmr_utils3.utils import try_download, mk_id_dict
|
||||
|
||||
# Change the current directory to the location of the application
|
||||
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
|
||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)')
|
||||
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||
cli_args = parser.parse_args()
|
||||
|
||||
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
|
||||
if not cli_args.CONFIG_FILE:
|
||||
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
|
||||
|
||||
# Call the external routine to build the configuration dictionary
|
||||
CONFIG = config.build_config(cli_args.CONFIG_FILE)
|
||||
|
||||
# Start the system logger
|
||||
if cli_args.LOG_LEVEL:
|
||||
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||
logger = log.config_logging(CONFIG['LOGGER'])
|
||||
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Founding Members of the K0USY Group. All rights reserved.\n')
|
||||
logger.debug('Logging system started, anything from here on gets logged')
|
||||
|
||||
# Set up the signal handler
|
||||
def sig_handler(_signal, _frame):
|
||||
logger.info('SHUTDOWN: HBROUTER IS TERMINATING WITH SIGNAL %s', str(_signal))
|
||||
hblink_handler(_signal, _frame)
|
||||
logger.info('SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
|
||||
reactor.stop()
|
||||
|
||||
# Set signal handers so that we can gracefully exit if need be
|
||||
for sig in [signal.SIGTERM, signal.SIGINT]:
|
||||
signal.signal(sig, sig_handler)
|
||||
|
||||
# ID ALIAS CREATION
|
||||
# Download
|
||||
if CONFIG['ALIASES']['TRY_DOWNLOAD'] == True:
|
||||
# Try updating peer aliases file
|
||||
result = try_download(CONFIG['ALIASES']['PATH'], CONFIG['ALIASES']['PEER_FILE'], CONFIG['ALIASES']['PEER_URL'], CONFIG['ALIASES']['STALE_TIME'])
|
||||
logger.info(result)
|
||||
# Try updating subscriber aliases file
|
||||
result = try_download(CONFIG['ALIASES']['PATH'], CONFIG['ALIASES']['SUBSCRIBER_FILE'], CONFIG['ALIASES']['SUBSCRIBER_URL'], CONFIG['ALIASES']['STALE_TIME'])
|
||||
logger.info(result)
|
||||
|
||||
# Create the name-number mapping dictionaries
|
||||
peer_ids, subscriber_ids, talkgroup_ids = mk_aliases(CONFIG)
|
||||
|
||||
# INITIALIZE THE REPORTING LOOP
|
||||
report_server = config_reports(CONFIG, reportFactory)
|
||||
|
||||
# HBlink instance creation
|
||||
logger.info('HBlink \'playback.py\' (c) 2017-2019 Cort Buffington, N0MJS & Mike Zingman, N4IRR -- SYSTEM STARTING...')
|
||||
for system in CONFIG['SYSTEMS']:
|
||||
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
||||
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
|
||||
logger.critical('%s FATAL: Instance is mode \'OPENBRIDGE\', \n\t\t...Which would be tragic for playback, since it carries multiple call\n\t\tstreams simultaneously. playback.py onlyl works with MMDVM-based systems', system)
|
||||
sys.exit('playback.py cannot function with systems that are not MMDVM devices. System {} is configured as an OPENBRIDGE'.format(system))
|
||||
else:
|
||||
systems[system] = playback(system, CONFIG, report_server)
|
||||
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
|
||||
logger.debug('%s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
|
||||
|
||||
reactor.run()
|
||||
@@ -3,3 +3,11 @@ bitarray>=0.8.1
|
||||
Twisted>=16.3.0
|
||||
dmr_utils3>=0.1.19
|
||||
configparser>=3.0.0
|
||||
aprslib>=0.6.42
|
||||
pynmea2
|
||||
maidenhead
|
||||
requests
|
||||
libscrc
|
||||
resettabletimer
|
||||
cryptography
|
||||
|
||||
|
||||
+11
-13
@@ -47,20 +47,18 @@ BRIDGES = {
|
||||
]
|
||||
}
|
||||
|
||||
TELEMETRY = {
|
||||
'WORLDWIDE': [
|
||||
{'SYSTEM': 'MASTER-1', 'ON': [], 'OFF': []}
|
||||
],
|
||||
'ENGLISH': [
|
||||
{'SYSTEM': 'MASTER-1', 'ON': [], 'OFF': []},
|
||||
{'SYSTEM': 'REPEATER-1', 'ON': [], 'OFF': []}
|
||||
],
|
||||
'STATEWIDE': [
|
||||
{'SYSTEM': 'MASTER-1', 'ON': [], 'OFF': []},
|
||||
{'SYSTEM': 'REPEATER-1', 'ON': [], 'OFF': []}
|
||||
]
|
||||
}
|
||||
'''
|
||||
list the names of each system that should bridge unit to unit (individual) calls.
|
||||
'''
|
||||
|
||||
UNIT = ['ONE', 'TWO']
|
||||
|
||||
'''
|
||||
This is for testing the syntax of the file. It won't eliminate all errors, but running this file
|
||||
like it were a Python program itself will tell you if the syntax is correct!
|
||||
'''
|
||||
|
||||
if __name__ == '__main__':
|
||||
from pprint import pprint
|
||||
pprint(BRIDGES)
|
||||
print(UNIT)
|
||||
|
||||
Regular → Executable
+140
-73
@@ -1,79 +1,146 @@
|
||||
'''
|
||||
This is a voice file library that is used by other programs so that
|
||||
hblink can "talk" and provide voice feedback for users. It does nothing
|
||||
on it's own, but is called by programs that need to create their own
|
||||
voice feedback for users -- like to notify of system events, etc.
|
||||
|
||||
The format is already HIGHLY processed to make assembly of DMR packets
|
||||
quick and easy on the fly. DMR voice packets each contain 3 AMBE
|
||||
frames. They are 72bit FEC encoded and they are combined so that
|
||||
1.5 of the frames fit on each side of the control information in the
|
||||
center of the packet.
|
||||
'''
|
||||
|
||||
from bitarray import bitarray
|
||||
|
||||
words = {
|
||||
'kansas_link': [
|
||||
[bitarray('111111101110010010000001000001110111000100000111000111111101010111101011111111011100011110000011001101010011'), bitarray('010100010000010011111000011110001001110010100011100110000010011001100001001001010111100111011100010101010011')],
|
||||
[bitarray('111110000001101110100011000001010010001000000010110011111111001100100101111011111111010010000011001101110001'), bitarray('010000010000000011001001010111001110111011101100011110100011011100010111010101000001010011001010000110101100')],
|
||||
[bitarray('111111101101010110100010000101110111000001000111001010111101001011111111111111011100010010000011001100110001'), bitarray('001100110101010110011101001011011000111111111110011010100001010100010011001100110100011011001110000111101111')],
|
||||
[bitarray('111011101110011010100010000101110001000000000101000010001000011011111010111111011100010110100001011100110101'), bitarray('000001010111010110101101000111011010110111111100010110000001010100010001011001010001011111111110011111111011')],
|
||||
[bitarray('110111101101010010000001010100110111001100100111010011011000000010011111110011111110010110100011011101010011'), bitarray('010100100101010011111101000011111001111011001100010010100011011100110111000001000111000010111010011110101111')],
|
||||
[bitarray('010011101101110010000101011001000001000000110011110010000010111101100111111001101011100111000101010100100110'), bitarray('000101100111000010111000111000111110110101111000101011100110011101000100010000010001001111001100101100111110')],
|
||||
[bitarray('110001001001101111000101001101000100010000010101000011001010101100101001000011000000111010100101010101010011'), bitarray('010101010110010001011010000100011100001111110010111110000111010100100010001100110001010000001011011000011000')],
|
||||
[bitarray('000011000001110010100110001101100000000000100000011101011111000001001101000011010011111010100101000101000110'), bitarray('011101110100010000011010010100011000101100101011010111100101011000000100010001100110010000100101001110101011')],
|
||||
[bitarray('110101011010101111000101011000100110001000110011000111111000111100101111101000001011011011000111000001000011'), bitarray('001000000001010000000111000111011001100100101011010111100110000001100111001000100011000001110000010111011011')],
|
||||
[bitarray('101000001000011011100101000001000101010000000001000101110001011011001100111100010110010011000101010000100100'), bitarray('010101110011110011011000110110100111110011011111011010000011011101110101010001010001000111101111010111111111')],
|
||||
[bitarray('110111001110010110100011010100110101000100100110001011011000001110001101110111011100010010100001000100010011'), bitarray('000100110000000110011110011110101011110101011000100111000101001001110001010100010001011111001101101000001101')],
|
||||
[bitarray('111001001001101011100110010001110001000000100101011111011000111000101011101111010100000010010101110001110000'), bitarray('010101110000111111011010110100111001100101010011100111100010111101001111100110011001101000100110001100011111')],
|
||||
[bitarray('101001001010100011000100110000001001000101111111001110000011010010000001101000000100110010000010001101000110'), bitarray('100001000001011101111100011111110001100000010100111111100001010100000100011110111010100100100111111110111011')],
|
||||
[bitarray('101101011000001011100010000000110010001010111101011100010111111100100010110000111110000100000111010110001111'), bitarray('011010101001110011110000001101111001101100111010000101000001010111101001011011010111000110110001001110100111')],
|
||||
[bitarray('100101111101001001010111001100111000000000000100110110001001011110001100110101101010000000000000011101011001'), bitarray('000001001110000110111001000001010111100000001110011101100000000101111011001111011001110110001011111001110111')],
|
||||
[bitarray('110001001000000000000010000100011001001100111101010010001011000100010111111001001001010100000010001100110010'), bitarray('100110110101000101110000000010000001110101101010011001101010001110100111001110101111111111110001011001110000')],
|
||||
[bitarray('110001101010010001101001000110000011000111101111110011000110011101100001100100101101000101101010010110010101'), bitarray('110110100010100010111100001000011011111100111000110101101100010000010111110101110011010100111100100110010001')],
|
||||
[bitarray('101010000110011000101100110001100000111000110000111001011010100110100111111100101101101101011001111100110010'), bitarray('110100010011000011110110110100111010100100101011001001011001010100101001000100010010000100111101110100011000')],
|
||||
[bitarray('101001101000011001100101001011001100001100111000001111110100110001101011111000000111111100100011000100001101'), bitarray('001101111000101111111101000111101001101100000011111001000111000101111110001100110000001110111100010000110010')],
|
||||
[bitarray('101000101100001101000011000001110100110101010101100001110110100110010001110101001110001101001100111110100010'), bitarray('011110111110100101001010000110111111101001111001001011000011001100000100001110001000011001100010111100100110')],
|
||||
[bitarray('101101101011000110000000010001000100101100100000111000111010010101111111101101011001000011000000010001000100'), bitarray('011111111010011101100001101001000001110010001100001010000110011001110000010011011001010010111100110000110010')],
|
||||
[bitarray('101000000110111111100010001101100011001110101011101100100111110110011101100100110100111111100000000100100001'), bitarray('011010001100100000010100101110111011111001101100001010100101011000000110011110010101101101000010101110001100')],
|
||||
[bitarray('110100101011110000011010100010110100011111010100010010000111100011000111101100111000101001001000000011000011'), bitarray('001110111100101001001010100011010111111100111000111001100010100000010100101110001000101100110001100101010111')],
|
||||
[bitarray('101101111100101100000101011111110110110101000101100110100101110100111101111111100111000101100000011011101101'), bitarray('011110011101000011000110100100110111110110000100001101000111001011110010110111011101010001001010011000001010')],
|
||||
[bitarray('100110100100001000100001010000111011001001110101010010111001111111110011111110010001001001100110010101101010'), bitarray('001000101100110110001111111001011001100110110001001100000010001111010110111010000001110100111100011110110011')],
|
||||
[bitarray('101010010101101001100011001011100101111100010100000011100111001100010001100010010110100000000000001010110011'), bitarray('000010001000111110001110101101101110101111001001010111100111010100000010001100011111100010001011010101110110')],
|
||||
[bitarray('100000011101111010100110001001100101010110110010110010101010001100011001101000100010011110000011011101010000'), bitarray('010001001100001111111101111101111001111100010101011111100101011100010110011101000111101111001010110010010011')],
|
||||
[bitarray('011000001000000011101000111100101110101110111000001101010000111001101010100010010100011010100001111101100001'), bitarray('011111011101111010111111010110000100101110011011001011100001011101110011001110100000101111111000111110011111')],
|
||||
[bitarray('101110111000001011100000011101100100010111010000100110001101101011001111110000111110010010100011000001000000'), bitarray('011000011000110001010110000101000011111100001100010010000010000001000010010101001101111100000100010000110011')],
|
||||
[bitarray('101000001000011011000101000001000010000101100011000100010011011111011001111011101100011110000011010101010011'), bitarray('001100010101011011001001001010111101111011011101011110000011001100010011010101100011010110111111000011011101')],
|
||||
[bitarray('111111001100010010000001001100010101000000110100000011001110011111011001101111010010010110100001000100110000'), bitarray('010000110100110101000110110111000101000100111101011010101011000111010000010100010010000001011001000100001111')],
|
||||
[bitarray('100011000001010010000011001100100000000000010001111000110100100110000100101011100000010110000001011101000100'), bitarray('011001100101101101010011101110100010110001101000101011000101010001010011001000110101010110111101101100101111')],
|
||||
[bitarray('110101011000101011100101010001010001010000110000011111001001100000011111110101001011100011000101010001010111'), bitarray('000000110101000111011010100100111110111001101001101111000111001000010111011101100011001110001100111100111001')],
|
||||
[bitarray('000010000010011011000011010010010011000101110101000110111001000010000101111001011000100011100110010001010011'), bitarray('000100010111010110111011100000011111111101101000101111100111001000010001010001100100001110011100101000111111')],
|
||||
[bitarray('110001111001101111000111000100000111010101110010000011011111101101111101101100011100111110100101000101000001'), bitarray('001111000100100011001010011101001101010110101011100011011001000100101111010000010001111011010111111000001111')]
|
||||
'all_circuits': [
|
||||
[bitarray('001011000001010000100010001001011111101010110000110001100010011001011000001010010000000100000111010000111101'), bitarray('100101001000101100110100111010010101011010110100001001100010000001111001101000010010000101110010111000101011')],
|
||||
[bitarray('000010010000010101100110000100000010111101001010001111000010001100111011001111010110010000100100110101000111'), bitarray('001000001000100101100010010100100010001111010110011111000110001100100111000110100100110111100011001010011000')],
|
||||
[bitarray('111111110010101010101001111000111010110110011010011000001001110011011101001110000011001101111010100001111111'), bitarray('010101101001110001010011011000111111000011000011011100000011011001011011100111110010111001100001000000111111')],
|
||||
[bitarray('001010110011001000100111010100101001100101101010101000100101110110000001010111110001111001000110000000101110'), bitarray('000010110010010111110111111100101110001010100010101101000101000010100111000101001101111000001011010000000011')],
|
||||
[bitarray('010011010001100000101011110101010011011001101000011100101010001100110110000010100111111001101000101000000010'), bitarray('011011111110101000011001100000000111000011101001010110101000010101111000101110101010001101100001100111010000')],
|
||||
[bitarray('011111010010011100111010111110010110101001101100100010110000011000101011000111000100001001011000000100111111'), bitarray('000010010011100011001101101101101111000110000101101001000110001000111000111010101111001011111111111000000000')],
|
||||
[bitarray('010111101111010000000011000001101100111111000101011011001011101001100010001010111010000100000001011100111010'), bitarray('011110001000001110000010111101001111000011111100110100100110011001111100110100101100011100110001101000111111')],
|
||||
[bitarray('010010011010101100000110011100101011010100000111001101001110100001110101001111001111101000100101001101110110'), bitarray('000110000010000010011011111011101001111100110000000100000000000001000110011110101011100011010001110111100111')],
|
||||
[bitarray('111001100001010000001010100000000101001011011111000111111111011110001001010110111100000101111001101101001001'), bitarray('011000101100011110011101100100110111000011110001101001111001001001111100111110101010101100101111001011000000')],
|
||||
[bitarray('011011010000111000010110001000101100101001101011111110111110010000100111010010110110000101100011001100101001'), bitarray('111001100010011101110111100100111110000010000001001100000111001001011001101001001011101100010011111111000001')],
|
||||
[bitarray('011110110101001101000000010100001011101000010001001101010010101100111010010110010111100001000101101001000111'), bitarray('111011000111011011010010010011001110010110110000111001101010000111110011101001100010011010000010101110101101')],
|
||||
[bitarray('011010011101000101101000101001111000000101101010010111011001110001010001000010110101100000011011100101111011'), bitarray('000110111010011111001001010111001011011010100010101100001000011110111111110100000111101100010101010100100111')],
|
||||
[bitarray('001110101010000100000001000000011111011110111011011111000111100100011011010110101101001001000111001101011101'), bitarray('001110000011100011000100110111000111011111001001110100000010010001001010010010101111010101111000011011111011')],
|
||||
[bitarray('001011101111111001000100011000001101000111100010110101001110000101000110011011101001101101100001011000010100'), bitarray('010010001111110111101001101101110110000010011110110001100010010000010000110011100010101011000011110000011000')],
|
||||
[bitarray('010110011011111100001101010011000111110001001011000101011011011001011000000010111111010101001000011101111101'), bitarray('111111111011010100001110001101011000010011001101011100110011011101011101100010110000001111001100100000000010')],
|
||||
[bitarray('001010011100101100100000000001001111101011100110010101000111010010100011011011111001110001000011001001011111'), bitarray('110000100100101001000101111111100011010011001010110001000011011101101100100101100111110000000110101110010001')],
|
||||
[bitarray('010011111111100001100111110101011100111100100111110010011111101100011100110100100111000101100100100001001010'), bitarray('011011111010000010001011010111000100110001000001000001101111001010101011000011110111000011001011001100101111')],
|
||||
[bitarray('111101100010001101101100011010011111011010000110000110011011010101011000111100110010010001101000000111011100'), bitarray('010000001110011111011101111010010111100001100000110001101100101000000110100111011100101000011100111011101111')],
|
||||
[bitarray('101001000000100001101110111000101111000001110100110011000011100101011010110101100101111000001010111001110010'), bitarray('110110000100001101011000100000100100101001000111101101010100111000110000111101100000001010011000101010110111')],
|
||||
[bitarray('111100100010111001101111111011110110000010101100010000011000011100100100110000100011110001101111110111010100'), bitarray('001010001110010000011011011101000100110100110000111101001110111111010110001010001110010000011010001100010111')],
|
||||
[bitarray('101000100110111100101001110110110110010010000110110001011101000111011001101100010100111100001000110111110110'), bitarray('011011100101111000011101000111011001101101110110100100101100111111110001010001001111110100011000100100100011')],
|
||||
[bitarray('100001110100101011110100010100010001011000110100100000010100001100010111101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'connected': [
|
||||
[bitarray('111001011000100011000101010001010001010001000011011110011011101001001100111010000010100010100001001001110100'), bitarray('010101010100110010001010010101110010111011101101010110000001010101010101011001010001000110001000011110111010')],
|
||||
[bitarray('110111101110010010100001001101010001010001010011010011011100011011101111111011011101011110000001000101110101'), bitarray('001000100010000111111100001011111011110011101100010010000000011101010011010101110101011010001101010011011110')],
|
||||
[bitarray('110111001101010110100011000100110001001100010110000110111010011010101000111011001110011010100011001101110111'), bitarray('000100110100001110011000001110101110111101011000100111100101011001110011011000010000011011011001100101001111')],
|
||||
[bitarray('111101011010100111100101000000010101001001010111000010001011110100111011111001001011100011000111010000110111'), bitarray('010101010001001010011100101101101111110001111000100011100111000000010011001000010101010111001111101000111011')],
|
||||
[bitarray('100011010011111010000100110000001101010011110010100111000101011101010100110001001001110111001001111001111110'), bitarray('111101010100101101101110110100011011100100001110110001111101111011110000001111001101110011010111100000001111')],
|
||||
[bitarray('101101101101110101011101000100101000100111010101010111111001111001011111110001111000101000000001000111110001'), bitarray('010110010101111011101101000110001100110010100000011000101100010010010110001111111001001111000000100001101001')],
|
||||
[bitarray('110110000000011100001100010011110101011010111001011111010001100001011001100110000001010001010011001111111001'), bitarray('101110010101010111101100111001001110110010100111101001110100000000101010110101010111100100011111011011110110')],
|
||||
[bitarray('110011000000100000000001011011101000001101111101100101001011110011010111100010110101111001100011000010101100'), bitarray('010111011000010101001111011111110010101111010100100001000101001011001111011000000001010000001110111100101011')],
|
||||
[bitarray('100110110100101000100101110000010100010011000100001001111000010001000110000011111000000010101110101110110101'), bitarray('000100101001100101001001011100101001110110100011010010110110111000110011101100001000101010000110110100000000')],
|
||||
[bitarray('100011110001010110000011011101110101010100010111100100100011101110110111100000001000011011100111010001000010'), bitarray('001101110001010100110010001111111100111000101101010110110000011000100000010101001010100101010000000101110100')],
|
||||
[bitarray('110100101010101110110111100110011010000011010110001011011010011101000111001101000001101111011000010111010101'), bitarray('100011011100011000100011110111111111111011100110011001011110110011110111101111111000110000110011101001100110')],
|
||||
[bitarray('100111100100111001001110001001000101100001001001000100101100011101100110110110100110110001100101001001110110'), bitarray('011111001000111110110101010101000010101110000111100100100111110000110001010110100100011001111101011001100011')],
|
||||
[bitarray('111011101100010110100001001100010111000001000110000011011000000011011011100111111011011011100111001101010111'), bitarray('001000001001100011111101010100110101001011101110001011001110111101111101011100010111100110110001011100100010')],
|
||||
[bitarray('110111100000110010000111000000000111000011011000100010001110100110001110110111100000110010000110011000100011'), bitarray('011110001110110010001001100011011010111110100110000011100001001000010100000011100101001000000001011111000011')],
|
||||
[bitarray('110011000100011011000100000000110110000001001111000100010101110001011111101011110010011010000001001000010010'), bitarray('011100110001111000110111101110000001111011101111011110100011011100010101000101010101011110011000011011101010')],
|
||||
[bitarray('000110010010010011100011011011000010010100000011000010111101010011000100111101001001100111100111011000010111'), bitarray('001100010101000010001100110100111001110001101001100011000101011100110101000000010101000111011010101100101101')],
|
||||
[bitarray('111001111000100111100111011101110011010101010000011110001100100100101111100011110000011110100011001001010000'), bitarray('000100110000110100000101110111100111001101000000101110001011011011010010001001110010110001101111011110010001')],
|
||||
[bitarray('111101111000101011000100011001010011011101000000011110011100100001111010111001101011101011100101001000010111'), bitarray('011000110001000011001111101000011101111101111010100111000101000000000001001000000001011111011010110100001001')],
|
||||
[bitarray('110001001010101111000111011000100101001100100010010111101100101001111010110101111000101011000101000000100011'), bitarray('000100010100010011011111101101111111110001001001101111000100000000010000000101110011011010001111100100011100')],
|
||||
[bitarray('111111001101011010100001001100110001001100000001001010111100010111011010110011111100011010100011001101010101'), bitarray('001101100100001110001100001110111100111111001101011110000011000101010111011101110001000110011011010011011010')],
|
||||
[bitarray('110011101100010010000000011101010101010101000011000011101000001111111110110010000011101110100001000001110000'), bitarray('001000010011110110111111000001110111111110010000100010100001011000110001011100000110111110011100011100010001')],
|
||||
[bitarray('110111001101010010000011000101110001011100100001010011001010010011101011111011111110011010000001001100110001'), bitarray('000000000001001010001011001110001100001101001111101111001110001101111111111011011101000100010101000101100110')],
|
||||
[bitarray('100111111000011111000101011100110001000001011110110010111000011001010001100001010010110011010011100100100111'), bitarray('011000010100100011001000011111101101001000100000000000000010000001000000001000100000010000000100010000000000')]
|
||||
'0': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('000110011010000101000001001001011010110001000001101010011000001000010110001010101000001000100011000100111011'), bitarray('000010011011001111010000100100001011010111001000110100100001010000011101011010001110001001011101001111101010')],
|
||||
[bitarray('000011001010101101111101010101011010011001001101010111001010011100011011000011101100110101001101001111111111'), bitarray('010101110001100010000111110110011010100100100101001100001110011010110110100110001110100000100011110010001110')],
|
||||
[bitarray('101000100011010100101101011100100010101111100100000000001110010101001001110101010110000001001110001101110000'), bitarray('111101110100110000001110100000001101110100110110101000001010010010100000101101000110110011101011110110110111')],
|
||||
[bitarray('111001100111111001000000101011000111000011001100111011011001100111110001111001100000100001100010101001110001'), bitarray('000111100111011011010101001100100001111101110010100001000010111101000100001111000000010111000001000101100100')],
|
||||
[bitarray('111000100001110101010101111100000101010000001000010010010101100110101111111001000100111101101001110100100010'), bitarray('000100111000110101000000000100011011100001100010111000001101100001110100011101110000010000010100011110010111')],
|
||||
[bitarray('101101110100101111110100001001000110010100000110100101110000010001110110111111111010110011100000010100100010'), bitarray('010010010101110100110110011100001101101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'1': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('001111101011000100000101011101000110111010111110010100001011011000100110000111001000110000000110000010100001'), bitarray('011011001111100111000111001101011000000011101000111000100011111101100100001011000110000100010011101101000011')],
|
||||
[bitarray('011011001010100100100011010101110111110001000000011110010101010101011011111100010001000000100000000001100011'), bitarray('001010101101100011110000111010000001111000100010001100100001001001010100011010101000101011010001101010110111')],
|
||||
[bitarray('111000100001001001100011001001010100111001010001010010001111000011001101101100010110000101100010100111000111'), bitarray('000011011000111100000100011100000101101101010010111000000111101011100010011010100101011011001010101001101011')],
|
||||
[bitarray('100100000000100100100001100011010011010001001110001110011000001010110111110001100100110001100000100110100001'), bitarray('001111101001110110001100100110000101100101000101101100101101111110110111011001101000100001011110111001110011')],
|
||||
[bitarray('111100010001110001101110110111110110000011001100010000001100010001000110110100111101010001101011100010000000'), bitarray('000001100000100000001001111000010111010011001100111110100110011100110101011101010011110110010000110001110000')],
|
||||
[bitarray('110011101011111011100000011100000000011010100111111100010110011101001101110010001001100011000101011101100010'), bitarray('011000111100100101100010101111000101110010011000100011000100011101100010011000111100100101100010101011000101')],
|
||||
[bitarray('110010011000100011000100011101100010011000111100100101100010101011000101101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'2': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('110000000100010000000111110101100001000011101100110101111000111100111111100000100000100000001000101001000000'), bitarray('001110101010000000010101110101101110100100100011100101101010111000010010101101010010100100111111010001100101')],
|
||||
[bitarray('110000100001111001001101100111000110000110111110010100011100000001010011100000100110110000001010101110110110'), bitarray('011111010100110100001000001011011110101100011000010000001101110010100110010000111110010000011101111110001111')],
|
||||
[bitarray('101000100010011101001000110110000111000000000011000110010000001001011011111100010101010111010101011101000100'), bitarray('011100010001100010011011100010110010110110011000100011000100011101100010011000111101101001000010101011110100')],
|
||||
[bitarray('111110011010100011100100011101000010010000011100100001100010111011110100110110011000100011000100011101100010'), bitarray('011000101101100001100010100011110110101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'3': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('010010100001100001000010001101011011001000111110001111000001000111100011010011101110011001000010011100101110'), bitarray('000101101010111011000011011101101111000111011100111101100110011000001100001010100110101000011000000101110010')],
|
||||
[bitarray('010010101010100100100101011001111111011100100101010000101101101100100110010010101000100000100110010101011100'), bitarray('010100110111010000111110111100110011101101010100011100100010000001000101101110000101101011011010111111111010')],
|
||||
[bitarray('101000100000010100000000111100100100110101001101101100010100011110101010101000000011011100000010111100010101'), bitarray('110101001100101100000001000110011010100101100101101100100111111000000101001011011011110011100110011110101010')],
|
||||
[bitarray('100000000110111000111111010001110111001011011001011010011001100110000111111100000001110101011001010001010110'), bitarray('001010100001110010011110110000011110100000100111111100011100011001000101001011001011010010011100101111100110')],
|
||||
[bitarray('111100010010111101001001000101110110000110000111100011011000100100001110100100101001010000101110111011110000'), bitarray('000001101111010100011100110111011010111001010010101001001010101011110110011000100110000000011101111110011110')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'4': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('001111001110110001100001110011011110000111111111011111011001101000001110010011001010111000000110111111111100'), bitarray('011110010000100110001110101111010010100000010010001000001101000001101001001100001010000111000111001110101111')],
|
||||
[bitarray('111000110110000101001001011001111001010001000000101010000100001100000011101100100110010100101101001111001101'), bitarray('011000000100110010001011101001011001110000010010000001001010010111110111110010100100001000000101110000000110')],
|
||||
[bitarray('101001110011100101001010011010001100011000001110000001000110011100000011100001010000110001101000000011000101'), bitarray('101011100010001110011001011010110000111101110110111000001110011011100000111110101100110011011001001000101001')],
|
||||
[bitarray('101000110011100101101111010011000000101000101110001011011100110000011011100100110000101101101110010011000010'), bitarray('101000001100010011111010111000011011101100010100110001101110000000000011110100100000100111000101010010011100')],
|
||||
[bitarray('111100100101101001101111110100000110010010000011100000010000101011100010101001010011110000001101101000110010'), bitarray('010101110011000001010101011011000000101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'5': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('000110011110101101100001011101001101000100011001100100001011111010011010001011101000100101101110000101011111'), bitarray('010101111111000011111000001100011000100100000011001100101100001000001101011101111011010011110101010011001011')],
|
||||
[bitarray('101000000000000000101101000000011100010000011101001111000110001110101011100001110001010000000111111100101000'), bitarray('010100111111101111011011110110000111111001000111011101000001111100001001011001110101011011001111100100011010')],
|
||||
[bitarray('111100110111010001011000011101010010101010111010100101111001000010000110100000010100110101111111010000000000'), bitarray('101001110101111011000101000011111001100100000000101001101011100000000101110000010111100100011001010001000111')],
|
||||
[bitarray('101000110000101100001011100000010110001111101010010000010000110001001011101100000100110001101011111011110011'), bitarray('111000011100000100010011111010110100101100110100101101101000111110101011011010100110011011111000101100000011')],
|
||||
[bitarray('110101110010110111100011001100001111011000101101110010110101101000110100110100111010110110100011011000100101'), bitarray('100001000101110011010100100111001000011100010011101111110000011110000111000001001000100011011000101010001110')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'6': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('111000010110100001101000010011100011000111101011011111110101000111001110110000110101010111100111010100010101'), bitarray('001101100101110011011110111111110110101100010000010001111011111110100010000101000000001110110010010000011100')],
|
||||
[bitarray('100101110110100000101101111011100100001101001000100101111010101100110100111111001000011010100100110100111101'), bitarray('111110101111011111111011001110110100001011110011100110001010101101111110101001100010111010001111011001101111')],
|
||||
[bitarray('110101011001100010000111000100110000101011101100100011000110010000100110100111111000010010100101001101010001'), bitarray('101110100000010110100100100000001101100010110001001110000111001101010100000011111110101001010001001101111000')],
|
||||
[bitarray('111101001010101010100100010100100111100010101100110111110010011000110110100100011110111111000111001101000011'), bitarray('110100101111011010000001110101110010111011110011111010100101010000110001011011001011101011101001100111101011')],
|
||||
[bitarray('101110110111100111000101001001010111010000001000010110111010011010011010111110010011101110100000000000110011'), bitarray('001000100101110010111111011100110100111010101010101011100111011101100110000100111100110101010000101010010000')],
|
||||
[bitarray('110001010011010011011001011000100101010001000110000101011010000000010000001100010101011011101000111000100100'), bitarray('000001100010101001010100001010100100110011001000111111000010011101000100010111110001110000100100011000001001')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'7': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('010010110001100100000010000100111111101010100000111011011001111010001000010110111100000100000100001101101100'), bitarray('101100001111000010001011011111001101011111011000111101100000010001101111111001010111100000000110111110100010')],
|
||||
[bitarray('000110011010110001011000011101001101011110100101000110111000101111000000100101010011000101111001011001000001'), bitarray('000111000111100101010110011110101011111101010101000000011101001001110011000010001100001100000000010001000011')],
|
||||
[bitarray('110100000000001100100000001101000000000010011111100011010011110011000011100000110101000101100101001101100111'), bitarray('001111100111011010010000100000011011111000100001001000000011000101010000010110001011111011010011110111000011')],
|
||||
[bitarray('110001010101111001100010101010000000001011011101111110001110101010110010100101000010110000000100100010100011'), bitarray('000010100110010111101011101001101111110101010110110101100000101011010010001011011001111010011101100110100111')],
|
||||
[bitarray('101101010010111100100111100111000110001110110100001010011100101101111011100100110011101000100000100110000110'), bitarray('011000101110010110011000011011110011100001010111100000001110111010110101010100101100110001001100101000010100')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'8': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('110000011010100110100000001001001110000010011000100100001000110100111111101000110100101011101100101101101001'), bitarray('111111001100011110100011111011001101101011100011001111000010011001101110011100010000010011010101010101011010')],
|
||||
[bitarray('110011110101011110000101000101100101100011010100100000101111001101110111110010010101000111100010011101000101'), bitarray('000110010110010101000011001111000101101111010011011110000010011101000010001100010001100001110011100011000111')],
|
||||
[bitarray('111110101011100011100100010101000100010000101101100101010000100010100001101110101101101010000011010100100110'), bitarray('001001000101010100010101100000001101101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'9': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('010010001110100101111111001101110010011110111100001000011101000110010111010110111100100001001110011101010101'), bitarray('000010101110010000011010001111000101110000100001001000100011000000100100010010001100101011000000101111110001')],
|
||||
[bitarray('111100110010001100000010000000000101011110111101101111010000111111100011110000100011001000000011000001100001'), bitarray('001011101100100011000110110111000110110100110000001101000011011001110110111001100101000010001001010111011011')],
|
||||
[bitarray('110100010010000000000011001001110011000011101100100011000000110111000011100100110100000101100101001101100110'), bitarray('001011100110010010010010100000001011100001000111011000101000010111110110111001010000101100010110001000100011')],
|
||||
[bitarray('100101110101010100001101100100010101110001101010011111010011101000101110101000110001000100001001100110011001'), bitarray('000001010101110000010011110010010010111000110000111101001101111011000111001011001001000001001001011001000100')],
|
||||
[bitarray('110001010001100001101001100011110100000100010110010100001101101110011111111000110101010011100111010100100111'), bitarray('000100000100100010011000100110010101110110001000100111000100011101000100010000111101101000110101100010110011')],
|
||||
[bitarray('111110101010101111000110011101000110011001011101110001100111100011010001101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'disabled': [
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
|
||||
[bitarray('001111000111111001000001001101111110111101100010011111001010011011101111000011110110111101100001000101011010'), bitarray('111100000010010011101000011111011100001111110101111100000011000101011100011011011100101010000011111110110011')],
|
||||
[bitarray('000000100100010011111110010011100100011100001001001011100101101011101000010110111111101101011011100010110100'), bitarray('011111100001110010001110111011011110000011101001010000011011110001001101011011011110110010001111000000100101')],
|
||||
[bitarray('010110111100001000111110010011101111100010001100001000100101111000110101000010101010000000010111111010011011'), bitarray('000110000101101001000001001100100001000111011010010100100100011100001101011101100000001010010111001111110101')],
|
||||
[bitarray('010010001000101100000100010001001000011001100110001100011001101100010101000011101100100101100100011001010101'), bitarray('100100111111111011010101011110110001001111111000100101100010101101111110000010100111110010100010001111111111')],
|
||||
[bitarray('100000100000011100000011111000000000110100001101100001100000001111111111110100110100011101000101111001110100'), bitarray('111001100110000000100111011101010001100001000001001000100110110001110001100010100111110001010111101100000001')],
|
||||
[bitarray('110000100111011101100100110101100010110001000100000000000010011101010001111100110110010101100101111101000001'), bitarray('111101100110000100100011011100110001101001100101011001001011001110110101001111011000000100101101110100001011')],
|
||||
[bitarray('100100110100000100101001111100010111111111010011001011110010010111000001110100110000110001001111101010010010'), bitarray('000010111010000101011100001101000001100101100111100111110101010001010111000001100000101000010101011101110110')],
|
||||
[bitarray('101001110110101010000100000000110001100110001110000001111001110101011100100101100000011010111010101100011001'), bitarray('100010100000110101101001011111110010100110111001001011000000001100010111001011110000110110111100110010011111')],
|
||||
[bitarray('110111111101011110100011010001010001000001110000001011101001000010001101110110101010101011100110011101000010'), bitarray('001101101001110101010001101111000001101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
],
|
||||
'enabled': [
|
||||
[bitarray('010011101100010000101011000011111110110001110110001001110101000111111001011010001100000001100011101111001101'), bitarray('001111101111000000110100010110011101010111011000111001100000000001001010110001100110110000100001110110100010')],
|
||||
[bitarray('011010101011101100000111011001011010010101000101001000001101111001110101010010001000101000000111011101101001'), bitarray('011000010100001000001001110101000100110001000111001101000110001011100100100010000000111010000001001111010001')],
|
||||
[bitarray('100000000010010100100000110000010011111001001100101000000101011111011101100101110100010100000011001101000011'), bitarray('101111010101101110001001100111111111111101010110001101000000101101110110101010011000011100000101101111111101')],
|
||||
[bitarray('100001100111101100000111111000100000000010001011101011000111010110111111110000100000101100000100111001101101'), bitarray('010001001010111000000111001101110111101001000111100100000100110000000011000111111000101010000001011110011101')],
|
||||
[bitarray('110100110000111000100101101001100100101010010010111011011001010110110011111100110100100101101000011011100000'), bitarray('001010011110000010110001000111011100110101100111110001001111011011100100000000000100011011010111110000100010')],
|
||||
[bitarray('100000110100001001101101011110010011010000100010011100111111011010100011110101010110001111000011011100010111'), bitarray('011011101100111011011011010101011011000001001100101011101100001101111010111011111100010101100111001001110110')],
|
||||
[bitarray('110101101110001110100111011001110010011011000000110100010011101010001000101101011011001100101001110010110010'), bitarray('010010000000010001111001001001100010101011001010101001000000001000000000000001000100010000001000000010000000')]
|
||||
]
|
||||
}
|
||||
|
||||
+6703
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,91 @@
|
||||
|
||||
'''
|
||||
Settings for HBNet Web Server.
|
||||
'''
|
||||
# Database options
|
||||
# Using SQLite is simple and easiest. Comment out this line and uncomment the MySQL
|
||||
# line to use a MySQL/MariaDB server.
|
||||
db_location = 'sqlite:///hbnet.sqlite'
|
||||
|
||||
# Uncomment and change this line to use a MySQL DB. It is best to start with a fresh
|
||||
# DB without data in it.
|
||||
|
||||
#db_location = 'mysql+pymysql://DB_USERNAME:DB_PASSWORD@DB_HOST:MySQL_PORT/DB_NAME'
|
||||
|
||||
|
||||
# Title of the HBNet Web Service/DMR network
|
||||
title = 'HBNet Web Service'
|
||||
# Port to run server
|
||||
hws_port = 8080
|
||||
# IP to run server on
|
||||
hws_host = '127.0.0.1'
|
||||
# Publicly accessible URL of the web server. THIS IS REQUIRED AND MUST BE CORRECT.
|
||||
url = 'http://localhost:8080'
|
||||
# Replace below with some random string such as an SHA256
|
||||
secret_key = 'SUPER SECRET LONG KEY'
|
||||
|
||||
# Default state for newly created user accounts. Setting to False will require
|
||||
# the approval of an admin user before the user can login.
|
||||
default_account_state = True
|
||||
|
||||
# Legacy passphrase used in hblink.cfg
|
||||
legacy_passphrase = 'passw0rd'
|
||||
|
||||
# Coordinates to center map over
|
||||
center_map = [45.372, -121.6972]
|
||||
# Default map zoom level
|
||||
map_zoom = 5
|
||||
|
||||
# Passphrase calculation config. If REMOTE_CONFIG is not used in your DMR server config
|
||||
# (hblink.cfg), then the values in section [USER_MANAGER] MUST match the values below.
|
||||
# If REMOTE_CONFIG is enabled, the DMR server (hblink) will automatically use the values below.
|
||||
# These config options affect the generation of user passphrases.
|
||||
|
||||
# Set to a value between 1 - 99. This value is used in the normal calculation.
|
||||
append_int = 1
|
||||
|
||||
# Set to a value between 1 - 99. This value is used for compromised passphrases.
|
||||
burn_int = 5
|
||||
|
||||
# Set to a value between 1 - 99 This value is used in the normal calculation.
|
||||
extra_int_1 = 5
|
||||
|
||||
# Set to a value between 1 - 99 This value is used in the normal calculation.
|
||||
extra_int_2 = 8
|
||||
|
||||
# Set to a length of about 10 characters.
|
||||
extra_1 = 'TeSt'
|
||||
extra_2 = 'DmR4'
|
||||
|
||||
# Shorten generated passphrases
|
||||
use_short_passphrase = True
|
||||
|
||||
# Character length of shortened passphrase
|
||||
shorten_length = 6
|
||||
# How often to pick character from long passphrase when shortening.
|
||||
shorten_sample = 4
|
||||
|
||||
# Email settings
|
||||
MAIL_SERVER = 'smtp.gmail.com'
|
||||
MAIL_PORT = 465
|
||||
MAIL_USE_SSL = True
|
||||
MAIL_USE_TLS = False
|
||||
MAIL_USERNAME = 'app@gmail.com'
|
||||
MAIL_PASSWORD = 'password'
|
||||
MAIL_DEFAULT_SENDER = '"' + title + '" <app@gmail.com>'
|
||||
|
||||
# User settings settings
|
||||
USER_ENABLE_EMAIL = True
|
||||
USER_ENABLE_USERNAME = True
|
||||
USER_REQUIRE_RETYPE_PASSWORD = True
|
||||
USER_ENABLE_CHANGE_USERNAME = False
|
||||
USER_ENABLE_MULTIPLE_EMAILS = True
|
||||
USER_ENABLE_CONFIRM_EMAIL = True
|
||||
USER_ENABLE_REGISTER = True
|
||||
USER_AUTO_LOGIN_AFTER_CONFIRM = False
|
||||
USER_SHOW_USERNAME_DOES_NOT_EXIST = True
|
||||
|
||||
|
||||
# Time format for display on some pages
|
||||
time_format = '%H:%M:%S - %m/%d/%y'
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
def gen_script(dmr_id, passphrase):
|
||||
script = '''
|
||||
DMR ID: ''' + str(dmr_id) + ''' \n Passphrase: ''' + str(passphrase) + '''
|
||||
'''
|
||||
return script
|
||||
@@ -0,0 +1,43 @@
|
||||
# Function to generate a script for Pi-Star that adds MASTER instances and generated passphrases to DMR_Hosts.txt.
|
||||
|
||||
def gen_script(dmr_id, svr_lst):
|
||||
auth_contents = ''
|
||||
header = '''
|
||||
## DMR_hosts.txt, generated by HBNet.
|
||||
|
||||
########################################################################################################
|
||||
### Name DMR-ID IP/Hostname Password Port #
|
||||
########################################################################################################
|
||||
\n'''
|
||||
for i in svr_lst:
|
||||
## print(i[1])
|
||||
auth_contents = auth_contents + str(i[0]) + '''\t\t\t\t''' + str(dmr_id) + '''\t''' + i[1] + '''\t\t\t\t''' + i[2] + '''\t\t''' + str(i[3]) + '\n'
|
||||
## print(header)
|
||||
## print(auth_contents)
|
||||
|
||||
|
||||
## return header + auth_contents
|
||||
|
||||
output = '''
|
||||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
os.chdir('/root')
|
||||
if Path('/root/DMR_Hosts.txt').is_file():
|
||||
print('DMR_Hosts.txt exists, adding entries...')
|
||||
with open('/root/DMR_Hosts.txt', 'a') as dmr_hosts:
|
||||
dmr_hosts.write("""''' + auth_contents + '''""")
|
||||
dmr_hosts.close()
|
||||
|
||||
else:
|
||||
Path('/root/DMR_Hosts.txt').touch()
|
||||
print('DMR_Hosts.txt does not exist, creating...')
|
||||
with open('/root/DMR_Hosts.txt', 'w') as dmr_hosts:
|
||||
dmr_hosts.write("""''' + header + auth_contents + '""")' + '''
|
||||
dmr_hosts.close()
|
||||
print('DMR Host file updates.')'''
|
||||
print(output)
|
||||
return output
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
configparser>=3.0.0
|
||||
flask
|
||||
flask_user
|
||||
flask_sqlalchemy
|
||||
email_validator
|
||||
flask_babelex
|
||||
pymysql
|
||||
folium
|
||||
requests
|
||||
libscrc
|
||||
dmr_utils3
|
||||
cryptography
|
||||
uwsgi
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
@@ -0,0 +1,70 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<h1 style="text-align: center;">Manage Mail</h1>
|
||||
|
||||
Use <strong>*all</strong> to send an internal message to all users. To send a message to multiple users, use a comma (<strong>,</strong>) to separate usernames.
|
||||
|
||||
|
||||
|
||||
<div id="compose" class="collapse">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Send internal message to another user</div>
|
||||
<div class="card-body">
|
||||
|
||||
<form action="{{ current_user.username or current_user.email }}?send_mail=true" method="post">
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="basic-addon1">Username</span>
|
||||
<input type="text" id="username" name="username" class="form-control" aria-label="Username" aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Message</span>
|
||||
<textarea id="message" name="message" class="form-control" aria-label="Message"></textarea>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<p style="text-align: center;"><input class="btn btn-primary" type="submit" value="Send" /></form></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{% if show_mail %}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<p style="text-align: right;"><button data-bs-toggle="collapse" data-bs-target="#compose" class="btn btn-primary">Compose</button></p>
|
||||
|
||||
<table data-toggle="table" data-pagination="true" data-search="true" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<th>Message</th>
|
||||
<th>Time</th>
|
||||
<th>Options</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{markup_content}}
|
||||
|
||||
</tbody></table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if not show_mail %}
|
||||
{{markup_content}}
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,25 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<p> </p>
|
||||
<h1 style="text-align: center;">Last Known Location</h1>
|
||||
|
||||
<div class="row container-fluid" >
|
||||
<div class="col-sm-12">
|
||||
<table data-toggle="table" data-pagination="true" data-search="true" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Callsign</th>
|
||||
<th>Latitude</th>
|
||||
<th>Longitude</th>
|
||||
<th>Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{markup_content}}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,31 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<h1 style="text-align: center;">Bulletin Board</h1>
|
||||
<p style="text-align: center;"><a href="bulletin_rss.xml"><em>RSS Feed</em></a><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5QIcFBAOXAevLAAAAZZJREFUSMftlbtKA0EUhj8jWhi8gaIEC29oxEoRFESLgIXYiWVSKoj6CCrBBwj6CBHNE1hEWy21ETQqiIW1wXhPo81ZOBw2apbdVPvDsDPnP8M/5zKzECJEQKivYO8DFoAYEAGKtTpQEvhW4w3IA+tAVy2F9fgEskA8COHUL8LOKAMZoMmLQF0FewcwImmNAzPANBB18b0BFoGroNLfBiyLgI2+BMwF3XgNwCrwYsQ//BBPSRPdAoeybjE+A8ClS+Sjfnf1E5A2dW4FzoxfwWvD/XWd7oAxI24jz3gVnpS7eiEpt+KvQEL5D5qal/245zFgU+pnXzMd+Zrh9/3q5l7g3CXtTs0bgWvFffn5vDa7iKcVv2K4DS8i3cAOsAuMm8h12ovqqrVL/R3upFrRKPBgHgctvm0iSynuWNnf5bf6byy5dPKe4nukhg6XU9yW2TfsJlDpNCUX27OaP8pD4WBCzQtmX381EUeAI3Xqe6m5xoHpYAezJuJkNb9Fh0tI4+SlXhpTwJBaZ+XbCcwr+6kcPESI2uAHmAijFaMnEmYAAAAASUVORK5CYII=" /></p>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<table data-toggle="table" data-pagination="true" data-search="true" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Callsign</th>
|
||||
<th>Bulltein</th>
|
||||
<th>Time</th>
|
||||
<th>Server</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{markup_content}}
|
||||
|
||||
</tbody></table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,31 @@
|
||||
{% extends 'flask_user/_authorized_base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% from "flask_user/_macros.html" import render_field, render_checkbox_field, render_submit_field %}
|
||||
<h1>{%trans%}User profile{%endtrans%}</h1>
|
||||
|
||||
<form action="" method="POST" class="form" role="form">
|
||||
{{ form.hidden_tag() }}
|
||||
{% for field in form %}
|
||||
{% if not field.flags.hidden %}
|
||||
{% if field.type=='SubmitField' %}
|
||||
{{ render_submit_field(field, tabindex=loop.index*10) }}
|
||||
{% else %}
|
||||
{{ render_field(field, tabindex=loop.index*10) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</form>
|
||||
<br/>
|
||||
{% if not user_manager.USER_ENABLE_AUTH0 %}
|
||||
{% if user_manager.USER_ENABLE_CHANGE_USERNAME %}
|
||||
<p><a href="{{ url_for('user.change_username') }}">{%trans%}Change username{%endtrans%}</a></p>
|
||||
{% endif %}
|
||||
{% if user_manager.USER_ENABLE_CHANGE_PASSWORD %}
|
||||
<p><a href="{{ url_for('user.change_password') }}">{%trans%}<button type="button" class="btn btn-warning">Change Portal Passord</button>{%endtrans%}</a></p>
|
||||
{% endif %}
|
||||
<p><a href="../update_ids"><strong><button type="button" class="btn btn-danger">Update your information from RadioID.net</button></strong></a></p>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,8 @@
|
||||
<p>Dear {{ user.email }} - {{ user.username }},</p>
|
||||
|
||||
{% block message %}
|
||||
{% endblock %}
|
||||
|
||||
<p>Sincerely,<br/>
|
||||
{{ app_name }}
|
||||
</p>
|
||||
@@ -0,0 +1,74 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% from "flask_user/_macros.html" import render_field, render_checkbox_field, render_submit_field %}
|
||||
<h1>{%trans%}Sign in{%endtrans%}</h1>
|
||||
<p> </p>
|
||||
|
||||
<strong>Your username MUST be your callsign or email address.</strong>
|
||||
<p> </p>
|
||||
|
||||
<form action="" method="POST" class="form" role="form">
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
{# Username or Email field #}
|
||||
{% set field = form.username if user_manager.USER_ENABLE_USERNAME else form.email %}
|
||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||
{# Label on left, "New here? Register." on right #}
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="{{ field.id }}" class="control-label"><strong>{{ field.label.text }}</strong></label>
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
{% if user_manager.USER_ENABLE_REGISTER and not user_manager.USER_REQUIRE_INVITATION %}
|
||||
<a href="{{ url_for('user.register') }}" tabindex='190'>
|
||||
{%trans%}New here? Register.{%endtrans%}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{{ field(class_='form-control', tabindex=110) }}
|
||||
{% if field.errors %}
|
||||
{% for e in field.errors %}
|
||||
|
||||
|
||||
<p class="help-block"><strong>{{ e }}</strong></p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
{# Password field #}
|
||||
{% set field = form.password %}
|
||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||
{# Label on left, "Forgot your Password?" on right #}
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="{{ field.id }}" class="control-label"><strong>{{ field.label.text }}</strong></label>
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
{% if user_manager.USER_ENABLE_FORGOT_PASSWORD %}
|
||||
<a href="{{ url_for('user.forgot_password') }}" tabindex='195'>
|
||||
{%trans%}Forgot your Password?{%endtrans%}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{{ field(class_='form-control', tabindex=120) }}
|
||||
{% if field.errors %}
|
||||
{% for e in field.errors %}
|
||||
|
||||
|
||||
<p class="help-block"><strong>{{ e }}</strong></p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{# Remember me #}
|
||||
{% if user_manager.USER_ENABLE_REMEMBER_ME %}
|
||||
{{ render_checkbox_field(login_form.remember_me, tabindex=130) }}
|
||||
{% endif %}
|
||||
|
||||
{# Submit button #}
|
||||
{{ render_submit_field(form.submit, tabindex=180) }}
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,66 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% from "flask_user/_macros.html" import render_field, render_submit_field %}
|
||||
<h1>{%trans%}Register{%endtrans%}</h1>
|
||||
<p> </p>
|
||||
|
||||
<strong>Your username MUST be your callsign.</strong> After filling out the fields, a confirmation link may be emailed to you.
|
||||
<hr />
|
||||
<p> </p>
|
||||
By registering, you acknowledge that you agree to the Terms of Use.
|
||||
<p> </p>
|
||||
|
||||
<p style="text-align: center;"><a href="/tos"><button type="button" class="btn btn-primary">Terms of Use</button></a></p>
|
||||
<p> </p>
|
||||
<hr />
|
||||
<p> </p>
|
||||
|
||||
<form action="" method="POST" novalidate formnovalidate class="form" role="form">
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
{# Username or Email #}
|
||||
{% set field = form.username if user_manager.USER_ENABLE_USERNAME else form.email %}
|
||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||
{# Label on left, "Already registered? Sign in." on right #}
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="{{ field.id }}" class="control-label"><strong>{{ field.label.text }}</strong></label>
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
{% if user_manager.USER_ENABLE_REGISTER %}
|
||||
<a href="{{ url_for('user.login') }}" tabindex='290'>
|
||||
{%trans%}Already registered? Sign in.{%endtrans%}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ field(class_='form-control', tabindex=210) }}
|
||||
{% if field.errors %}
|
||||
{% for e in field.errors %}
|
||||
|
||||
|
||||
<p class="help-block"><strong>{{ e }}</strong></p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
{% if user_manager.USER_ENABLE_EMAIL and user_manager.USER_ENABLE_USERNAME %}
|
||||
{{ render_field(form.email, tabindex=220) }}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{{ render_field(form.password, tabindex=230) }}
|
||||
|
||||
{% if user_manager.USER_REQUIRE_RETYPE_PASSWORD %}
|
||||
{{ render_field(form.retype_password, tabindex=240) }}
|
||||
{% endif %}
|
||||
|
||||
{{ render_submit_field(form.submit, tabindex=280) }}
|
||||
</form>
|
||||
|
||||
<p> </p>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,182 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{ user_manager.USER_APP_NAME }}</title>
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.5/dist/bootstrap-table.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
|
||||
|
||||
|
||||
<!-- In-lining styles to avoid needing a separate .css file -->
|
||||
<style>
|
||||
hr { border-color: #cccccc; margin: 0; }
|
||||
.no-margins { margin: 0px; }
|
||||
.with-margins { margin: 10px; }
|
||||
.col-centered { float: none; margin: 0 auto; }
|
||||
</style>
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
{# *** Allow sub-templates to insert extra html to the head section *** #}
|
||||
{% block extra_css %}{% endblock %}
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
|
||||
<p><img class="img-responsive" style="display: block; margin-left: auto; margin-right: auto;" src="{{ url_for('static', filename='HBnet.png') }}" alt="Logo" width="300" height="144" /></p>
|
||||
<h2 class="card-body" style="text-align: center;">{{ user_manager.USER_APP_NAME }}</h2>
|
||||
<hr />
|
||||
|
||||
<!-- A grey horizontal navbar that becomes vertical on small screens -->
|
||||
<nav class="navbar navbar-expand-sm bg-light">
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- Links -->
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{url}}/"><i class="bi bi-house-fill"></i> Home </a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{url}}/talkgroups"><i class="bi bi-card-list"></i> Talkgroups </a>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{url}}/map"><i class="bi bi-map"></i> Map </a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="aprs_menu" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="bi bi-hash"></i> Data
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="aprs_menu">
|
||||
<li><a class="dropdown-item" href="{{url}}/aprs"><i class="bi bi-geo"></i> APRS Dashboard </a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/sms"><i class="bi bi-chat-right-text"></i> SMS Log </a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/bb"><i class="bi bi-clipboard"></i> Bulletin Board </a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/ss"><i class="bi bi-people"></i> Social Status </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{url}}/news"><i class="bi bi-newspaper"></i> News </a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{url}}/help"><i class="bi bi-question-square"></i> Help </a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<ul class="navbar-nav">
|
||||
{% if not call_or_get(current_user.is_authenticated) %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('user.login') }}"><i class="bi bi-door-open"></i> Sign In </a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('user.register') }}"><i class="bi bi-person-plus"></i> Register </a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if call_or_get(current_user.is_authenticated) %}
|
||||
<!--Admin Menu -->
|
||||
{% if call_or_get(current_user.has_roles('Admin')) %}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="aprs_menu" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="bi bi-tools"></i> Admin
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="mmdvm_admin">
|
||||
<li><a class="dropdown-item" href="{{url}}/manage_servers">Manage Servers</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/manage_peers">Manage Peers</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/manage_masters">Manage Masters</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/manage_rules">Manage Rules</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/add_user">Add User</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/list_users">Manage Users</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/approve_users">Waiting Approval</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/manage_news">Manage News</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/misc_settings">Misc Options</a></li>
|
||||
<li><a class="dropdown-item" href="{{url}}/auth_log">Authorization Log</a></li>
|
||||
<a class="dropdown-item" href="{{url}}/all_mail/{{ current_user.username or current_user.email }}">Manage Mail</a>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{url}}/mail/{{ current_user.username or current_user.email }}"><i class="bi bi-mailbox"></i> Mailbox </a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{url}}/generate_passphrase"><i class="bi bi-info-square"></i> Passphrase(s) </a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('user.edit_user_profile') }}"><i class="bi bi-file-person"></i> Change {{ current_user.username or current_user.email }} </a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('user.logout') }}"><i class="bi bi-door-closed"></i> Sign Out </a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
{% block body %}
|
||||
|
||||
<hr class="no-margins"/>
|
||||
|
||||
<div id="main-div" class="with-margins">
|
||||
{# One-time system messages called Flash messages #}
|
||||
{% block flash_messages %}
|
||||
{%- with messages = get_flashed_messages(with_categories=true) -%}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
{% if category=='error' %}
|
||||
{% set category='danger' %}
|
||||
{% endif %}
|
||||
<div class="alert alert-{{category}}">{{ message|safe }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{%- endwith %}
|
||||
{% endblock %}
|
||||
{% block main %}
|
||||
{% block content %}
|
||||
|
||||
{{markup_content}}
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<hr class="no-margins"/>
|
||||
<div id="footer-div" class="clearfix with-margins">
|
||||
<p style="text-align: center;"><strong>{{ user_manager.USER_APP_NAME }}<br /></strong><a href="https://hbnet.xyz">HBNet Project</a><br />V. <strong>Dev</strong> </p>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
||||
<!-- Bootstrap -->
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
|
||||
<script src="https://unpkg.com/bootstrap-table@1.18.3/dist/bootstrap-table.min.js"></script>
|
||||
|
||||
|
||||
{# *** Allow sub-templates to insert extra html to the bottom of the body *** #}
|
||||
{% block extra_js %}{% endblock %}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,37 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<h3 style="text-align: center;">Registration</h3>
|
||||
<p>To register for access , click the <a href="/user/register">Register</a> link. <strong>Your username MUST be your callsign. </strong>Information for you account is pulled from <a href="https://www.radioid.net/">RadioID.net</a>, including all associated DMR IDs with your callsign. After filling out the fields, a confirmation link may be emailed to you. After confirming your email address, your account may be reviewed and approved by an administrator. You may receive an email when your account is approved.</p>
|
||||
<p> </p>
|
||||
<h3 style="text-align: center;">Hotspot/Repeater Login</h3>
|
||||
<p>To find your passphrase(s) for use with the MMDVM server(s), click on the <a href="/generate_passphrase">Passphrase(s)</a> link. This page will display a unique passphrase for each of your DMR IDs. Use the desired DMR ID and passphrase in your hotspot/repeater configuration. Each passphrase is also spelled phonetically for ease of manual entry. A special script to automatically add our MMDVM servers to Pi-Star is available by clicking on link provided on the View Passphrase(s) page (also available <a href="/generate_passphrase/pi-star">here</a>).</p>
|
||||
<p> </p>
|
||||
<h3 style="text-align: center;">Updating DMR ID Information</h3>
|
||||
<p>If you recently added a DMR ID to <a href="https://www.radioid.net/">RadioID.net</a>, or made any change, you can update your account by clicking on the <a href="/update_ids">update link</a> on the <a href="/user/edit_user_profile">user profile settings</a> page.</p>
|
||||
<p> </p>
|
||||
<h3 style="text-align: center;">Talkgroups</h3>
|
||||
<p>You may view a list of all talkgroups by going to the <a href="talkgroups">Talkgroups</a> page. Click on the talkgroup name for more information. A CSV file is available for download and may be used in the CPS of some radios. Talkgroups listed there may not be available on all servers if there are multiple. You may find a list of talkgroups available on each server by going to the <a href="/generate_passphrase">Passphrase(s)</a> page.</p>
|
||||
<p> </p>
|
||||
<h3 style="text-align: center;">MMDVM Options</h3>
|
||||
<p>Options are like a type of command that your hotspot/repeater sends to the server for various functions. The following options are supported:</p>
|
||||
<div class="container-fluid">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Option</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>NO_MAP</td>
|
||||
<td>This option will prevent your hotspot/repeater from plotting on the map. <strong>This option may also be entered into the Location field of your hotspot, if your hotspot doesn't have an options field.</strong></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p>You can add multiple options by separating them using a semicolon (<strong>;</strong>). <br />
|
||||
Example: <pre>OPTION_1;OPTION_2</pre>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,29 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
<p> </p>
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
{{content_block}}
|
||||
|
||||
|
||||
<div class="col-lg-6">
|
||||
|
||||
<p> </p>
|
||||
<table style="margin-left: auto; margin-right: auto;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="text-align: center;">
|
||||
<h4>Latest News:</h4>
|
||||
{{news}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,68 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<h1 style="text-align: center;">Mail</h1>
|
||||
|
||||
|
||||
|
||||
<div id="compose" class="collapse">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Send internal message to another user</div>
|
||||
<div class="card-body">
|
||||
|
||||
<form action="{{ current_user.username or current_user.email }}?send_mail=true" method="post">
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="basic-addon1">Username</span>
|
||||
<input type="text" id="username" name="username" class="form-control" aria-label="Username" aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Message</span>
|
||||
<textarea id="message" name="message" class="form-control" aria-label="Message"></textarea>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<p style="text-align: center;"><input class="btn btn-primary" type="submit" value="Send" /></form></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{% if show_mail %}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<p style="text-align: right;"><button data-bs-toggle="collapse" data-bs-target="#compose" class="btn btn-primary">Compose</button></p>
|
||||
|
||||
<table data-toggle="table" data-pagination="true" data-search="true" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<th>Message</th>
|
||||
<th>Time</th>
|
||||
<th>Options</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{markup_content}}
|
||||
|
||||
</tbody></table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if not show_mail %}
|
||||
{{markup_content}}
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,28 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<p> </p>
|
||||
<div class="well">Map of connected peers and GPS locations. <br />
|
||||
To diasble map plotting for your hotspot or repeater, see the <strong>MMDVM Options</strong> section in <a href="/help"><strong>Help</strong></a>.
|
||||
<p> </p>
|
||||
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><span style="color: #ff0000;"><strong>Red</strong></span> = Peer location (no APRS)</td>
|
||||
<td><span style="color: #0000ff;"><strong>Blue</strong></span> = GPS location (APRS)</td>
|
||||
<td><strong><span style="color: #00ff00;">Green</span></strong> = Peer location (APRS)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="row container-fluid" >
|
||||
<div class="col-xs-12">
|
||||
{{markup_content}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,9 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
<p style="text-align: center;"><a href="/news?all_news=true"><strong><button type="button" class="btn btn-primary">View All News</button></strong></a></p>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">{{markup_content}}</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,34 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div class="card" >
|
||||
<div class="panel-heading" style="text-align: center;"><h4>Pi-Star Instructions</h4></div>
|
||||
<div class="panel-body">
|
||||
<p> </p>
|
||||
A script to enable the use of this network on a Pi-Star device is available. This script will automatically add information, including your generated passphrase and each Master/Proxy instance
|
||||
on this network, to your device's DMR_Hosts.txt. This will allow you to connect to this network in the Pi-Star configuration page.
|
||||
<p> </p>
|
||||
|
||||
A script(s) is generated for each of your DMR IDs when you load this page. Each link/command is valid for only one use. If you need execute a command again,
|
||||
simply reload the page to get a fresh link.
|
||||
<p> </p>
|
||||
<hr />
|
||||
<p> </p>
|
||||
|
||||
<p><strong>1</strong>: Log into your Pi-Star device via SSH. <br />
|
||||
<strong>2</strong>: Become <strong>root</strong> user. DMR_Hosts.txt is stored in /root, thus you need to be root to modify it.
|
||||
<pre>sudo su</pre><br />
|
||||
<strong>3</strong>: Decide which DMR ID you want Pi-Star to login with. Copy and past one of the commands below to update DMR_Hosts.txt. Each command is specific to a DMR ID.<br />
|
||||
|
||||
<p> </p>
|
||||
|
||||
{{markup_content}}
|
||||
<p> </p>
|
||||
|
||||
If you were sucessful, you can now go into the Pi-Star configuration and select this network from the dropdown list.
|
||||
</div>
|
||||
</div>
|
||||
<p> </p>
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,14 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<p> </p>
|
||||
|
||||
<div class="row container-fluid" >
|
||||
<div class="col-xs-12">
|
||||
{{markup_content}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,31 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<h1 style="text-align: center;">SMS Log</h1>
|
||||
<p style="text-align: center;"><a href="/sms.xml"><em>RSS Feed</em></a><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5QIcFBAOXAevLAAAAZZJREFUSMftlbtKA0EUhj8jWhi8gaIEC29oxEoRFESLgIXYiWVSKoj6CCrBBwj6CBHNE1hEWy21ETQqiIW1wXhPo81ZOBw2apbdVPvDsDPnP8M/5zKzECJEQKivYO8DFoAYEAGKtTpQEvhW4w3IA+tAVy2F9fgEskA8COHUL8LOKAMZoMmLQF0FewcwImmNAzPANBB18b0BFoGroNLfBiyLgI2+BMwF3XgNwCrwYsQ//BBPSRPdAoeybjE+A8ClS+Sjfnf1E5A2dW4FzoxfwWvD/XWd7oAxI24jz3gVnpS7eiEpt+KvQEL5D5qal/245zFgU+pnXzMd+Zrh9/3q5l7g3CXtTs0bgWvFffn5vDa7iKcVv2K4DS8i3cAOsAuMm8h12ovqqrVL/R3upFrRKPBgHgctvm0iSynuWNnf5bf6byy5dPKe4nukhg6XU9yW2TfsJlDpNCUX27OaP8pD4WBCzQtmX381EUeAI3Xqe6m5xoHpYAezJuJkNb9Fh0tI4+SlXhpTwJBaZ+XbCcwr+6kcPESI2uAHmAijFaMnEmYAAAAASUVORK5CYII=" /></p>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<table data-toggle="table" data-pagination="true" data-search="true" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Sender</th>
|
||||
<th>Receiver</th>
|
||||
<th>Message</th>
|
||||
<th>Server</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{markup_content}}
|
||||
|
||||
</tbody></table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,34 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<h1 style="text-align: center;">Social Status</h1>
|
||||
<p style="text-align: center;"><a href="/ss/{{user_id}}.xml"><em>RSS Feed</em></a><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5QIcFBAOXAevLAAAAZZJREFUSMftlbtKA0EUhj8jWhi8gaIEC29oxEoRFESLgIXYiWVSKoj6CCrBBwj6CBHNE1hEWy21ETQqiIW1wXhPo81ZOBw2apbdVPvDsDPnP8M/5zKzECJEQKivYO8DFoAYEAGKtTpQEvhW4w3IA+tAVy2F9fgEskA8COHUL8LOKAMZoMmLQF0FewcwImmNAzPANBB18b0BFoGroNLfBiyLgI2+BMwF3XgNwCrwYsQ//BBPSRPdAoeybjE+A8ClS+Sjfnf1E5A2dW4FzoxfwWvD/XWd7oAxI24jz3gVnpS7eiEpt+KvQEL5D5qal/245zFgU+pnXzMd+Zrh9/3q5l7g3CXtTs0bgWvFffn5vDa7iKcVv2K4DS8i3cAOsAuMm8h12ovqqrVL/R3upFrRKPBgHgctvm0iSynuWNnf5bf6byy5dPKe4nukhg6XU9yW2TfsJlDpNCUX27OaP8pD4WBCzQtmX381EUeAI3Xqe6m5xoHpYAezJuJkNb9Fh0tI4+SlXhpTwJBaZ+XbCcwr+6kcPESI2uAHmAijFaMnEmYAAAAASUVORK5CYII=" /></p>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
{{markup_content}}
|
||||
|
||||
<p style="text-align: center;">Post History</p>
|
||||
|
||||
<table data-toggle="table" data-pagination="true" data-search="true" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Post</th>
|
||||
<th>Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{all_post}}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,33 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<h1 style="text-align: center;">Social Status List</h1>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">Last Known Status</div>
|
||||
<div class="card-body">
|
||||
|
||||
<table data-toggle="table" data-pagination="true" data-search="true" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<th>Post</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{markup_content}}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="card-footer">Footer</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,9 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
<p style="text-align: center;"><a href="/talkgroups"><strong><button type="button" class="btn btn-primary">All Talkgroups</button></strong></a></p>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">{{markup_content}}</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,36 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<p> </p>
|
||||
<p style="text-align: center;"><strong>Note:</strong> Talkgroups listed here may not be available on all servers. See <a href="/generate_passphrase">Passphrase(s)</a> for complete list of talkgroup availability per server.</p>
|
||||
<p style="text-align: center;"><a href="hbnet_tg.csv"><strong>Download talkgroup CSV</strong></a> | <a href="hbnet_tg_anytone.csv"><strong>Download talkgroup CSV (Anytone format)</strong></a></p>
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- <table class="table table-striped table-bordered" style="width:100%" id="all_tg"> -->
|
||||
|
||||
<table data-toggle="table" data-pagination="true" data-search="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 146.1px; text-align: center;">Name</th>
|
||||
<th style="width: 89.9px; text-align: center;">TG</th>
|
||||
<th style="width: 339px; text-align: center;">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{markup_content}}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="row container-fluid" >
|
||||
<div class="col-xs-12">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,30 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<h1 style="text-align: center;">Tiny Pages</h1>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
|
||||
<form action="?add_page=true" method="post">
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="basic-addon1"><strong>?</strong></span>
|
||||
<input type="text" id="username" placeholder="Query" name="query" class="form-control" aria-label="Query" aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Content</span>
|
||||
<textarea id="message" name="content" class="form-control" aria-label="Content"></textarea>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<p style="text-align: center;"><input class="btn btn-primary" type="submit" value="Add" /></form></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,32 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<h1 style="text-align: center;">Tiny Pages</h1>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
{% if call_or_get(current_user.is_authenticated) %}
|
||||
<button type="button" class="btn btn-primary">Add Tiny Page</button>
|
||||
{% endif %}
|
||||
<table data-toggle="table" data-pagination="true" data-search="true" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Query</th>
|
||||
<th>Content</th>
|
||||
<th>Author</th>
|
||||
<th>Options</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{markup_content}}
|
||||
|
||||
</tbody></table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,64 @@
|
||||
{% extends 'flask_user/_public_base.html' %}
|
||||
{% block content %}
|
||||
<p> </p>
|
||||
<div class="card bg-light card-body mb-3">
|
||||
<h4 style="text-align: center;"><a href="/generate_passphrase/pi-star"><button type="button" class="btn btn-warning">Automatic Pi-Star Setup Script</button></a> </h4>
|
||||
<br>
|
||||
|
||||
<h4 style="text-align: center;"><button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#options_modal">
|
||||
MMDVM Options
|
||||
</button></h4>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-6">{{server_content}}</div>
|
||||
<div class="col-sm-6">{{passphrase_content}}</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Options Modal -->
|
||||
<div class="modal fade" id="options_modal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<!-- Modal Header -->
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Modal Heading</h4>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
|
||||
<!-- Modal body -->
|
||||
<div class="modal-body">
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Option</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>NO_MAP</td>
|
||||
<td>This option will prevent your hotspot/repeater from plotting on the map. <strong>This option may also be entered into the Location field of your hotspot, if your hotspot doesn't have an options field.</strong></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Modal footer -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p> </p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,11 @@
|
||||
[uwsgi]
|
||||
module = wsgi:app
|
||||
|
||||
master = true
|
||||
processes = 2
|
||||
|
||||
socket = /tmp/hbnet_web_service.sock
|
||||
chmod-socket = 666
|
||||
vacuum = true
|
||||
|
||||
die-on-term = true
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
from app import hbnet_web_service
|
||||
|
||||
app = hbnet_web_service()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# app = create_app()
|
||||
|
||||
app.run()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user