434 Commits

Author SHA1 Message Date
Cameron Thompson
af7fc536f8 Update installer 2025-07-25 21:55:42 -04:00
Cameron Thompson
3fc86d7a28 Install procd and depnds to skeleton 2025-07-25 21:54:39 -04:00
Cameron Thompson
01a8c2136b update installer 2025-07-24 23:49:27 -04:00
Cameron Thompson
b55088db19 begin prep for procd 2025-07-24 23:49:03 -04:00
Cameron Thompson
322e237364 add missing list file (empty) 2025-07-24 23:06:17 -04:00
Cameron Thompson
c614574313 Update installer 2025-07-24 22:56:28 -04:00
Cameron Thompson
9176bb3ef3 Replace wget with link to uclient-fetch 2025-07-24 22:55:37 -04:00
Cameron Thompson
ebaca3add3 Update installer 2025-07-24 22:35:39 -04:00
Cameron Thompson
2dc23e5b64 Register librt and usign as installed with opkg 2025-07-24 22:35:09 -04:00
Cameron Thompson
154b54c416 add wget ssl 2025-07-24 22:29:53 -04:00
Cameron Thompson
cc5ee2b322 Update installer 2025-07-24 21:16:48 -04:00
Cameron Thompson
e24d6663a2 Update banner 2025-07-24 21:16:03 -04:00
Cameron Thompson
e03f67049e Fix src declaration; add arch.conf 2025-07-24 21:12:38 -04:00
Cameron Thompson
930229d0aa Install usign to OpenWRT-skel 2025-07-24 20:55:37 -04:00
Cameron Thompson
bdd6ce1a86 Symlink libselinux to lib 2025-07-21 23:20:42 -04:00
Cameron Thompson
2326e3237f test and debug 2025-07-21 23:04:29 -04:00
Cameron Thompson
a4794ad36f Final Prep 2025-07-21 22:59:17 -04:00
Cameron Thompson
b0332e9c6f Add base files 2025-07-21 21:50:04 -04:00
Cameron Thompson
687e28030a Add more packages 2025-07-21 20:41:04 -04:00
Cameron Thompson
43d81d24d7 Add remount org rootfs as ro 2025-07-21 19:36:50 -04:00
Cameron Thompson
f0dc1565cf Revert "Update openwrt-overlayfs"
This reverts commit 5fdf1a8413.
2025-07-21 19:29:56 -04:00
Cameron Thompson
5fdf1a8413 Update openwrt-overlayfs 2025-07-21 19:17:15 -04:00
Cameron Thompson
0ae82c8a65 Add atcmd from kuno 2025-07-20 22:59:39 -04:00
Cameron Thompson
adca963196 Initial parts of the OpenWRT subsystem skeleton 2025-07-20 22:52:23 -04:00
Cameron Thompson
d61384c396 mount-fix progress 2025-07-20 20:23:02 -04:00
Cameron Thompson
b6ff2a3832 Small edits 2025-07-20 00:01:08 -04:00
Cameron Thompson
6936b9e5c8 The beginning of something new... 2025-07-15 00:43:45 -04:00
Cameron Thompson
feb7b2d6b1 Re-add changes after force sync 2025-07-15 00:43:00 -04:00
Cameron Thompson
47aaea465b Prep for SDXLEMUR main branch 2025-05-31 20:18:31 -04:00
Cameron Thompson
a48cb19db8 Merge pull request #168 from clndwhr/bug/fix-sms-phone-number
[BUG FIX] Fix Parsing for the phone number on received SMS
2025-05-31 20:11:12 -04:00
Cameron Thompson
630b897cd5 Merge pull request #167 from 1alessandro1/patch-2
Update year, maybe other branches need this too
2025-05-31 20:10:18 -04:00
Christopher Landwehr
2bc2ae3844 had to adjust for SMS Short codes in New Zealand where the minimum can be 3 digits (12 length hex string) 2025-05-22 14:05:18 -04:00
Christopher Landwehr
5ea71c3ccb Change the conditional to check on the hexString length and what it starts with vs just with what it starts with as a HEX string > 17 should indidcate the string is actual Hexadecimal and likely UTF-16BE, or starting with 003/002B and length >15 2025-05-22 13:55:50 -04:00
1alessandro1
179c9fa702 Update year 2025-05-22 00:55:41 +02:00
Cameron Thompson
6dd3eb8ea2 Update README.md 2025-05-16 23:43:09 -04:00
Cameron Thompson
5030f2c0bd Update deployment
- Updated simpleadmin content deployment script to obtain content from latest PR's #163 and #165

- Updated all deployment scripts to reflect a gitroot branch of development-SDXLEMUR

- Removed an unused deployment script that is no longer needed.
2025-05-16 23:40:53 -04:00
Cameron Thompson
94053b777e Merge pull request #165 from clndwhr/bug/fix-PCI-and-EARFCN-on-Homepage
[BUG FIX] PCI and EARFCN for NSA on Simple Admin Home Page
2025-05-16 23:12:02 -04:00
Cameron Thompson
b4cd059b76 Revert more overhaul stuff 2025-05-16 23:10:20 -04:00
Cameron Thompson
696cbf3054 Revert "Progress..."
This reverts commit ec07fb07ac.
2025-05-16 23:09:39 -04:00
Cameron Thompson
6e9acd8c87 Merge pull request #163 from clndwhr/bug/fix-bandwidth-reporting-and-adjust-tac
[BUG FIX] Bandwidth reporting and TAC Adjustment
2025-05-16 23:08:01 -04:00
Cameron Thompson
23038054bd Revert more overhaul stuff 2025-05-16 23:07:00 -04:00
Cameron Thompson
90d53cfe1d Revert "Progress..."
This reverts commit ec07fb07ac.
2025-05-16 23:03:40 -04:00
Cameron Thompson
2ef3ea4cb7 Revert "Merge branch 'SDXLEMUR' into development-SDXLEMUR"
This reverts commit 8c80eb7c0f, reversing
changes made to 8d7b02ca92.
2025-05-16 22:54:55 -04:00
Cameron Thompson
8c80eb7c0f Merge branch 'SDXLEMUR' into development-SDXLEMUR 2025-05-16 22:53:11 -04:00
Christopher Landwehr
72845b4360 migrate and cleanup code for SA codebase and structures 2025-05-16 11:36:33 -04:00
Christopher Landwehr
6c7ed50953 adjusting the logic for PCI on NSA(ENDC), and fixing the index for EARCN PCC on NSA(ENDC) 2025-05-16 10:48:57 -04:00
Christopher Landwehr
5996be64f4 updated NR_BANDWIDTH_LOOKUP to th eaccurate reference 2025-05-12 22:31:03 -04:00
Christopher Landwehr
2cbe8b76ab code reduction 2025-05-12 22:30:41 -04:00
Christopher Landwehr
f021311c93 Tac formatting 2025-05-12 22:30:31 -04:00
Christopher Landwehr
71f7dacf72 offline fonts and font-awesome icons 2025-05-12 22:01:54 -04:00
Christopher Landwehr
517f41c590 adjusting the reported Bandwidth mapping, utilzed the same functionality as QuecManager, updated TAC to show Base10 and Base16 value 2025-05-12 21:27:36 -04:00
Christopher Landwehr
69800c0608 Merge branch 'development-SDXLEMUR' of https://github.com/clndwhr/quectel-rgmii-toolkit into development-SDXLEMUR
# Conflicts:
#	README.md
2025-05-12 21:25:51 -04:00
Cameron Thompson
8d7b02ca92 Update README.md 2025-05-12 21:11:49 -04:00
Cameron Thompson
7ee03707e3 Update README.md 2025-05-12 21:10:57 -04:00
Cameron Thompson
4a76a5d032 Merge pull request #117 from 1alessandro1/SDXLEMUR
Convert eNB to decimal
2025-04-02 22:41:51 -04:00
Cameron Thompson
6c3cf93ffd Merge pull request #116 from 1alessandro1/patch-1
Fix typo
2025-01-28 20:43:14 -05:00
1alessandro1
924e06a153 Convert eNB to decimal 2025-01-27 23:52:38 +01:00
1alessandro1
a6fbc35f18 Fix typo 2025-01-27 23:33:16 +01:00
Cameron Thompson
ec07fb07ac Progress... 2024-12-20 16:31:13 -05:00
Cameron Thompson
d52f2c1b0f Begin rework process of opkg/opt 2024-12-09 18:48:33 +00:00
Cameron Thompson
370eb276a0 Update update_tailscale.sh 2024-11-22 19:35:29 -05:00
Cameron Thompson
550552d1a1 Update start_menu.sh 2024-11-20 22:27:53 -05:00
Cameron Thompson
b2758616cc Fix wrong link 2024-11-13 03:05:13 +00:00
Cameron Thompson
6f72fb4568 Update for new gitroot 2024-11-06 00:32:24 -05:00
Cameron Thompson
3235bd2c46 Update update_tailscale.sh 2024-11-01 00:17:38 -04:00
Cameron Thompson
d48f2f9c59 Update RMxxx_rgmii_toolkit.sh 2024-10-30 23:39:11 +00:00
Cameron Thompson
4b9785ceff Update RMxxx_rgmii_toolkit.sh 2024-10-30 19:18:59 -04:00
Cameron Thompson
64ff33c056 Update at-list.md
Add disable automapn command
2024-09-25 00:30:41 -04:00
Cameron Thompson
fffa77f106 Update at-list.md
Add more details
2024-09-25 00:20:25 -04:00
Cameron Thompson
0673ed1020 github directories can be downloaded 2024-09-16 23:56:57 -04:00
Cameron Thompson
acddaf7b08 Update download 2024-09-07 14:51:52 -04:00
Cameron Thompson
3117d70408 Update download
-Po not supported by busybox grep
2024-09-07 14:39:24 -04:00
Cameron Thompson
0e93104d53 Update at-list.md 2024-09-07 14:02:39 -04:00
Cameron Thompson
b4646a6875 draft 2024-09-04 23:34:36 -04:00
Cameron Thompson
96158cf859 edits 2024-08-25 23:16:44 -04:00
Cameron Thompson
2b961a40ef edits 2024-08-25 23:10:36 -04:00
Cameron Thompson
780e3b4cc8 Update download 2024-08-25 22:37:25 -04:00
Cameron Thompson
c32e90a436 Update download 2024-08-25 22:33:39 -04:00
Cameron Thompson
c3931dd009 Add more diagnostics 2024-08-25 22:24:52 -04:00
Cameron Thompson
643412f4ae Add diagnostic echos 2024-08-25 22:09:03 -04:00
Cameron Thompson
00ca424ae6 Update download 2024-08-25 00:22:17 -04:00
Cameron Thompson
949863c70e Create download
Create a download command that uses curl and falls back to wget. Should be able to download entire directories recursively from github as well.
2024-08-24 23:25:22 -04:00
Cameron Thompson
44f3a7aeed Update update_tailscale.sh
Updated to install latest 1.70.0
2024-07-23 01:24:39 -04:00
Cameron Thompson
ca190cebd1 Revert Changes 2024-07-14 12:23:25 -04:00
Cameron Thompson
435c472b16 Revert changes 2024-07-14 02:51:54 -04:00
Cameron Thompson
9c2870eb61 Update update_simpleadmin.sh 2024-07-14 01:49:15 -04:00
Cameron Thompson
a061212ff4 fix syntax 2024-07-14 01:57:04 -04:00
Cameron Thompson
91d1ade6a4 Fix syntax 2024-07-14 01:56:40 -04:00
Cameron Thompson
f872efca51 Merge pull request #69 from dr-dolomite/feature-watchcat
User AT command implementation
2024-07-14 01:55:20 -04:00
Cameron Thompson
1cd14a2225 Add ARCH check 2024-07-14 01:16:49 -04:00
Russel Yasol
39907e983a improved bandlocking box 2024-07-14 13:10:46 +08:00
Russel Yasol
0e3497b8f4 changed at scripts to use atcmd instead 2024-07-14 13:01:42 +08:00
Cameron Thompson
5fffcfd80d Update tailscale to 1.68.2 2024-07-14 00:45:01 -04:00
Cameron Thompson
f7780a589e Update get_atcommand
Uses atcmd11 now instead of microcom
2024-07-14 00:32:59 -04:00
Cameron Thompson
f2592a3dbb Merge branch 'development' of https://github.com/iamromulan/quectel-rgmii-toolkit into development 2024-07-13 23:23:26 -04:00
Cameron Thompson
865adc2fcd Add atcmd11
Separate commands for separate AT streams
2024-07-13 23:23:20 -04:00
Cameron Thompson
3f32d4001b Merge pull request #68 from dr-dolomite/feature-watchcat
Hot fix and band locking improvement and 502 support
2024-07-13 22:52:15 -04:00
Russel Yasol
dfce6c2b4f added support for rm502 2024-07-14 10:49:42 +08:00
Cameron Thompson
41b2c6a4f9 Update screenshots 2024-07-13 22:38:12 -04:00
Russel Yasol
157f0d61c3 added various fixes for simple network 2024-07-14 10:26:54 +08:00
Cameron Thompson
b8cd5b3a2a Merge pull request #67 from dr-dolomite/feature-watchcat
Added Various Changes and Fixes for Simple Network
2024-07-13 21:01:37 -04:00
Russel Yasol
08889533f4 added various fixes for simple network 2024-07-14 08:44:09 +08:00
Cameron Thompson
88d300303c Merge pull request #66 from dr-dolomite/feature-watchcat
Hot Fix
2024-07-03 20:03:01 -04:00
Russel Yasol
f0377e5f9d removed experimental live signal 2024-07-02 12:04:06 +08:00
Cameron Thompson
65ceb39c1f Merge pull request #65 from dr-dolomite/feature-watchcat
Fixed SINR and RSRQ Swapped values when using NSA
2024-07-01 20:20:03 -04:00
Russel Yasol
28536d1d06 Merge branch 'feature-watchcat' of https://github.com/dr-dolomite/quectel-rgmii-toolkit into feature-watchcat 2024-07-02 08:17:29 +08:00
Russel Yasol
4de5a1d5df fixed NSA SINR and RSRQ values being swapped 2024-07-02 08:17:13 +08:00
Cameron Thompson
14b45941b0 Merge pull request #64 from dr-dolomite/feature-watchcat
Added Various Changes
2024-07-01 19:52:28 -04:00
Cameron Thompson
14f1c228e1 Update update_simpleadmin.sh
Updated to reflect file changes
2024-07-01 19:52:01 -04:00
Russel Yasol
6b9c912a24 added traffic stat and fixed scan and watchat links 2024-07-01 19:45:01 +08:00
Cameron Thompson
f6290708bf Merge pull request #59 from dr-dolomite/development-socat
Changes for Beta 1.0
2024-05-31 18:24:02 -04:00
Russel Yasol
a1598a7206 adding initial files for watchcat script 2024-05-31 19:50:55 +08:00
Russel Yasol
96566daeea finished minor changes for beta release 2024-05-28 18:46:37 +08:00
Russel Yasol
0e5785cb79 Merge branch 'development-socat' of https://github.com/dr-dolomite/quectel-rgmii-toolkit into development-socat 2024-05-28 14:26:12 +08:00
Russel Yasol
4a3a7775dd added changes to home, integrated sms from snjzb, and fixed minor error 2024-05-28 14:25:12 +08:00
Russel Yasol
61cdfebc8a index refactoring not finish 2024-05-27 22:48:37 +08:00
Cameron Thompson
7c413fe5a0 Capture whole Firmware rev in ttyd 2024-05-26 15:55:18 -04:00
iamromulan
70e9af1273 Fix version number 2024-05-26 15:46:33 -04:00
Cameron Thompson
155e8dd9bb Merge pull request #57 from dr-dolomite/development-socat
Added Changes for Version 0.9
2024-05-24 20:39:13 -04:00
iamromulan
99a7084594 Update update_simpleadmin.sh
Co-Authored-By: snjzb <170070306+snjzb@users.noreply.github.com>
2024-05-24 20:38:39 -04:00
Russel Yasol
9f800af0fd added sms, deviceinfo, settings, and watchat changes 2024-05-25 07:54:30 +08:00
Cameron Thompson
b1cd03ec72 Remove Requires from unit 2024-05-24 13:03:50 -04:00
Cameron Thompson
3965081d97 Ensure opt.mount is available
Ensure that opt.mount is complete before starting lighttpd
2024-05-24 12:22:52 -04:00
iamromulan
9ea53d593d fix chmod 2024-05-23 23:33:02 -04:00
iamromulan
b4bc15f8ef Dumb mistake fix 2024-05-23 23:06:45 -04:00
iamromulan
e6a0c00ce8 Fix mistakes for update script 2024-05-23 22:26:16 -04:00
Cameron Thompson
f6739360ee Merge pull request #56 from dr-dolomite/development-socat
Added Various Changes
2024-05-23 20:31:31 -04:00
Russel Yasol
0ada4e6f64 added reboot when sim swap was called 2024-05-24 06:18:44 +08:00
Russel Yasol
e7eb32479c fixed incorrect function call 2024-05-24 06:01:00 +08:00
Russel Yasol
3c56c295e0 added signal icons to scanner page 2024-05-23 23:33:44 +08:00
Cameron Thompson
f1b08de405 Merge pull request #55 from dr-dolomite/development-socat
Hot Fix for Index (Home Page) Async Problem
2024-05-23 00:43:00 -04:00
Russel Yasol
b642d1e283 hot fix for csq async problem 2024-05-23 07:11:01 +08:00
Cameron Thompson
9ca4451ef4 Use curl instead
Downloads ttyd and tailscale with curl now. Needed for newer RM520 firmwares.
2024-05-22 15:20:05 -04:00
Cameron Thompson
08b799a906 Merge pull request #53 from dr-dolomite/development-socat
Added Various Changes for Alpha 0.8
2024-05-19 00:06:01 -04:00
Russel Yasol
46696cdf28 added various changes for alpha 0.8 2024-05-19 10:59:44 +08:00
iamromulan
744871a90b Make sure curl is on all firmware versions pt2 2024-05-17 23:36:21 -04:00
iamromulan
79f835fd0f Make sure curl is on all firmware versions 2024-05-17 23:24:46 -04:00
Cameron Thompson
5e8bcd1d3f Merge pull request #52 from dr-dolomite/development-socat
Added Various Changes Ready For Merge
2024-05-14 00:48:43 -04:00
Russel Yasol
bf6637996c changed version to 0.7 2024-05-14 12:39:08 +08:00
Russel Yasol
9783d7ac3c Merge branch 'development-socat' of https://github.com/dr-dolomite/quectel-rgmii-toolkit into development-socat 2024-05-14 12:36:28 +08:00
Russel Yasol
12cebf6900 added various changes 2024-05-14 12:36:11 +08:00
iamromulan
5f387e7b17 menu is executable 2024-05-14 00:17:33 -04:00
iamromulan
bf0c2028b1 Update start_menu.sh 2024-05-14 00:14:37 -04:00
iamromulan
0858b03da2 Update start_menu.sh 2024-05-13 23:20:42 -04:00
iamromulan
408cf583dd Install Console Menu 2024-05-13 22:35:32 -04:00
iamromulan
b30daf8ce7 Add new files to installation script 2024-05-13 21:06:37 -04:00
Russel Yasol
b260cf369e added logic check for missing hour on uptime 2024-05-14 06:58:58 +08:00
Russel Yasol
43ed2669f6 added logic check for uptime parse 2024-05-14 06:48:45 +08:00
Russel Yasol
6f96491273 fixed parsing for uptime 2024-05-13 21:22:25 +08:00
Russel Yasol
06b84b48a4 added support for parsing days in uptime 2024-05-13 20:52:13 +08:00
Russel Yasol
acc37fd937 added device uptime 2024-05-13 19:57:09 +08:00
Russel Yasol
9bd4049ace added phone number to deviceinfo 2024-05-13 18:25:44 +08:00
Russel Yasol
49af87089b added nav link for scanner page 2024-05-13 18:09:58 +08:00
Russel Yasol
38b6b7ab00 added scanner page 2024-05-13 08:49:37 +08:00
Russel Yasol
51ec7e4a78 added improved cell scanner parsing 2024-05-12 12:46:59 +08:00
Cameron Thompson
ff23e5cfac Merge pull request #50 from dr-dolomite/development-socat
NSA Mode Bandwidth Parsing and SMS Layout Fixes
2024-05-11 23:14:10 -04:00
Russel Yasol
345cdf27a7 Merge branch 'development-socat' of https://github.com/dr-dolomite/quectel-rgmii-toolkit into development-socat 2024-05-12 11:00:03 +08:00
Russel Yasol
2c062c51ff fixed network settings endless loop 2024-05-12 10:51:41 +08:00
Russel Yasol
892371adc9 Merge branch 'development' into development-socat 2024-05-12 09:00:27 +08:00
Russel Yasol
969602cfdc added init() to network save change 2024-05-12 08:59:12 +08:00
Russel Yasol
b300f024b6 Merge branch 'development-socat' of https://github.com/dr-dolomite/quectel-rgmii-toolkit into development-socat 2024-05-11 10:42:19 +08:00
Russel Yasol
e93970e679 fixed NSA bandwidth parsing and SMS layout 2024-05-11 10:42:10 +08:00
iamromulan
c4fd0d6c7d Fix read/write issues 2024-05-10 20:56:40 -04:00
iamromulan
603096ce81 Fix tailscale update
Binaries should download to /usrdata/root temporarily now.
2024-05-10 20:50:00 -04:00
iamromulan
dc58ec1792 Remove double console link 2024-05-10 20:37:10 -04:00
Cameron Thompson
67cc67641b Console menu progress.... 2024-05-10 18:02:37 -04:00
iamromulan
eb05cfad0b make silent 2024-05-10 15:38:23 -04:00
iamromulan
cb0d9e776d Remove old temp service first
Removes any leftover temp update service if they exist
2024-05-10 15:34:54 -04:00
iamromulan
b89145e9e4 Fix double / issue
Can now configure tailscale again
2024-05-10 15:03:25 -04:00
Cameron Thompson
a671c2e4c0 Merge pull request #48 from dr-dolomite/development-socat
Fixed TTL Script and Removed Unnecessary Links and Files
2024-05-10 14:55:08 -04:00
iamromulan
43e680697f Make /script/* executable 2024-05-10 14:53:31 -04:00
Russel Yasol
af05f087c7 fixed ttl return data parsing 2024-05-10 18:18:04 +08:00
Russel Yasol
30937e20ba added ttl log to console 2024-05-10 18:12:26 +08:00
Russel Yasol
faae115732 changed parsed message from NR-SA to None 2024-05-10 11:35:58 +08:00
Russel Yasol
365925b210 updated refresh rate to 3 2024-05-10 11:34:34 +08:00
Russel Yasol
97be66cfe7 improved some parsing to show relevant info 2024-05-10 11:29:22 +08:00
Russel Yasol
d9879a4d4e removed progress bar when signal percentage is 0 to present the value 2024-05-10 10:49:36 +08:00
Russel Yasol
b4dac716de added negative value handler for sinr calculation 2024-05-10 10:22:21 +08:00
Russel Yasol
19cd8c6948 changed simpleadmin version number and repo link 2024-05-10 10:18:48 +08:00
Russel Yasol
e08fdbe279 removed unnecessary console links and ttl files 2024-05-10 10:16:30 +08:00
Cameron Thompson
ffbea70a7d Merge pull request #46 from dr-dolomite/development-socat
Added Improvements for BW Parsing, Improved Function Queuing for Simple Network and Fixed TTL Settings
2024-05-09 15:40:54 -04:00
iamromulan
60cee73a24 Add new directory and ttl script to installer 2024-05-09 15:40:34 -04:00
Russel Yasol
b56c5c5652 made getCurrentSettings to only run when band parsing were finished 2024-05-09 19:50:43 +08:00
Russel Yasol
10d93c733e fixed set ttl settings 2024-05-09 19:37:43 +08:00
Russel Yasol
562a8594da added console to navbar 2024-05-09 19:08:59 +08:00
Russel Yasol
bf156b9181 improved bw parsing and simple network function queuing 2024-05-09 19:06:00 +08:00
Cameron Thompson
0b26f94d82 Add Console nav link
linked to /console to access ttyd shell
2024-05-08 20:53:46 -04:00
Cameron Thompson
f934c84140 Merge pull request #45 from dr-dolomite/development-socat
Fixed Network Settings Parsing Bug
2024-05-08 20:46:36 -04:00
Russel Yasol
41b6caf5db fixed Fetching bands message not showing 2024-05-09 08:46:35 +08:00
Russel Yasol
bb9da92136 fixed Fetching bands message not showing 2024-05-09 08:44:27 +08:00
Russel Yasol
e56d521435 fixed network settings unsynced promises 2024-05-09 08:39:36 +08:00
Cameron Thompson
06668284a6 Merge pull request #44 from dr-dolomite/main
Added NSA Fix
2024-05-08 20:03:20 -04:00
Russel Yasol
5de91eae55 Merge pull request #4 from dr-dolomite/development-socat
Sync Changes from Development
2024-05-09 08:00:32 +08:00
Russel Yasol
6d6a9ae091 Merge pull request #3 from iamromulan/development
Sync changes
2024-05-09 07:58:54 +08:00
Russel Yasol
0d4e19daf2 Merge branch 'development-socat' of https://github.com/dr-dolomite/quectel-rgmii-toolkit into development-socat 2024-05-09 07:58:23 +08:00
Russel Yasol
387f86ed31 added missing NR5G-NSA check on LTE only statement 2024-05-09 07:41:51 +08:00
Cameron Thompson
b8ae6fc95f Add favicon.ico to installation script 2024-05-08 11:39:07 -04:00
Cameron Thompson
d176d8d251 Merge pull request #42 from dr-dolomite/development-socat
Added LTE Network Mode Parsing Bug Fix and Browser Tab Icon
2024-05-08 11:34:40 -04:00
iamromulan
2534045ef5 Maintain current version of TTL cgi 2024-05-08 11:34:12 -04:00
Russel Yasol
685f666ee5 Merge pull request #2 from dr-dolomite/development-socat
Syncing Confirmed Changes from Development to Main
2024-05-08 17:39:16 +08:00
Russel Yasol
e07d5b8bc4 Merge branch 'development-socat' of https://github.com/dr-dolomite/quectel-rgmii-toolkit into development-socat 2024-05-08 17:35:47 +08:00
Russel Yasol
a6203a585d cleaned unneeded logs on index and fixed cell lock on network settings 2024-05-08 17:35:32 +08:00
Russel Yasol
5b30e2d3d1 merging remote changes 2024-05-08 17:14:22 +08:00
Russel Yasol
31a82aed6a Merge branch 'development' into development-socat 2024-05-08 17:07:48 +08:00
Russel Yasol
79a4439fbf added logo 2024-05-08 16:22:55 +08:00
Russel Yasol
25daa60b62 fixed other LTE parsing bugs for testing 2024-05-08 15:56:45 +08:00
Russel Yasol
d84b8dd3c3 lte parsing fix 2024-05-08 15:28:23 +08:00
Russel Yasol
5369e15a84 fixed file dir locations 2024-05-08 15:25:46 +08:00
iamromulan
2bea6efdf1 Restore new version of ttl cgi 2024-05-05 04:56:12 -04:00
iamromulan
88afb00cb7 Move files to correct place 2024-05-05 04:49:44 -04:00
Cameron Thompson
12439f73eb Update index.html
Co-Authored-By: Russel Yasol <73575327+dr-dolomite@users.noreply.github.com>
2024-05-05 01:57:34 -04:00
iamromulan
db4ee5cc46 Reapply "Merge pull request #41 from dr-dolomite/development-socat"
This reverts commit 0543a18a40.
2024-05-05 01:44:29 -04:00
iamromulan
0543a18a40 Revert "Merge pull request #41 from dr-dolomite/development-socat"
This reverts commit d916c987b5, reversing
changes made to 17a846fb12.
2024-05-05 05:34:44 -04:00
Cameron Thompson
d916c987b5 Merge pull request #41 from dr-dolomite/development-socat
Merging Recent Changes
2024-05-05 00:56:43 -04:00
Russel Yasol
41ee583c8d added recent changes 2024-05-05 11:07:49 +08:00
Russel Yasol
4680237d49 Merge pull request #1 from iamromulan/development
Merge with Development
2024-05-05 11:02:42 +08:00
Cameron Thompson
17a846fb12 Revert "Update sms.html"
This reverts commit ba8c278eca.
2024-05-04 13:19:39 -04:00
Cameron Thompson
f37a22ef5b Revert "Update settings.html"
This reverts commit 2fb14c315e.
2024-05-04 13:19:32 -04:00
Cameron Thompson
3ab9751fef Revert "Update network.html"
This reverts commit 21affeb5e4.
2024-05-04 13:19:27 -04:00
Cameron Thompson
0567bf9984 Revert "Update deviceinfo.html"
This reverts commit 36329df218.
2024-05-04 13:19:17 -04:00
Cameron Thompson
d043c14f5a Revert "Update index.html"
This reverts commit 26728698ac.
2024-05-04 13:19:10 -04:00
Cameron Thompson
ba8c278eca Update sms.html 2024-05-04 13:09:13 -04:00
Cameron Thompson
2fb14c315e Update settings.html 2024-05-04 13:08:45 -04:00
Cameron Thompson
21affeb5e4 Update network.html 2024-05-04 13:07:56 -04:00
Cameron Thompson
ad288d4bd4 Update logout.html 2024-05-04 13:07:10 -04:00
Cameron Thompson
36329df218 Update deviceinfo.html 2024-05-04 13:04:15 -04:00
Cameron Thompson
26728698ac Update index.html 2024-05-04 13:03:39 -04:00
iamromulan
88f76ae642 Update GITTREE to current branch 2024-05-04 01:17:03 -04:00
Cameron Thompson
2cc65b7dba Update sms.html 2024-05-04 00:50:47 -04:00
Cameron Thompson
f81c7318e5 Update settings.html 2024-05-04 00:47:51 -04:00
Cameron Thompson
070f348062 Update network.html 2024-05-04 00:44:34 -04:00
Cameron Thompson
75a539df2d Update deviceinfo.html 2024-05-04 00:40:33 -04:00
Cameron Thompson
8f0655b040 Update index.html 2024-05-04 00:33:56 -04:00
iamromulan
0ba950f9fa Update TTL cgi 2024-05-04 00:10:19 -04:00
Cameron Thompson
d94fe733e1 Update update_simpleadmin.sh 2024-05-04 00:03:58 -04:00
iamromulan
926b0d3415 remove 2024-05-03 23:52:55 -04:00
iamromulan
54ddb6a0a3 Enable Installation 2024-05-03 23:03:56 -04:00
iamromulan
2192f11b50 Delete simpleadmin_generate_status.service 2024-05-03 22:23:18 -04:00
Cameron Thompson
16c455eb69 Update ttyd.service 2024-05-03 22:21:52 -04:00
iamromulan
5b0e5ef051 Remove no longer needed scripts 2024-05-03 22:21:02 -04:00
iamromulan
c9d0e45aa3 Merge @dr-dolomite 's for-merging branch
-Create new development-v2 branch to work on simpleadmin v2

-Merged @dr-dolomite work from:
2d197220a4

Co-Authored-By: Russel Yasol <73575327+dr-dolomite@users.noreply.github.com>
2024-05-03 15:47:01 -04:00
iamromulan
906688f458 Create ping watchdog 2024-04-29 23:00:27 -04:00
iamromulan
631ab97a9c Building menus 2024-04-22 00:15:53 -04:00
Cameron Thompson
c395467364 Progress... 2024-04-21 14:43:44 -04:00
iamromulan
4a7aac1464 Create ethernet_watchdog.sh 2024-04-21 12:11:01 -04:00
Cameron Thompson
516ca5cd1b Merge pull request #37 from RouteTable/development
Small tweak to download logout.html during installation of simpleadmin
2024-04-20 23:04:45 -04:00
RouteTable
0458890c89 Update update_simpleadmin.sh to wget logout.html during install/update 2024-04-20 20:47:11 -05:00
Cameron Thompson
222e45a0f4 Merge pull request #36 from RouteTable/development
Added basic Logout functionality and change to TTL status refresh
2024-04-19 23:50:06 -04:00
iamromulan
b785e259ea Update ap_settings.sh 2024-04-19 19:04:28 -04:00
iamromulan
752ba5d51a Update start_menu.sh 2024-04-19 18:52:43 -04:00
Cameron Thompson
61d1cd64b0 Update start_menu.sh 2024-04-19 16:34:29 -04:00
Cameron Thompson
9a2493cbfe Move to simpleadmin
Since ttyd is part of simpleadmin this belongs here
2024-04-19 16:01:08 -04:00
RouteTable
c646ce8945 Fix for TTL status refresh after setting TTL
Added a function to sleep for 1 second, and then a fetch to get_ttl to refresh the status
2024-04-19 02:15:37 -05:00
RouteTable
10d291151f Update ttl.html to add logout 2024-04-19 00:23:06 -05:00
RouteTable
a85a0b17f2 Create logout.html 2024-04-19 00:12:31 -05:00
RouteTable
1be4607d5d Update speedtest.html to add logout 2024-04-19 00:11:20 -05:00
RouteTable
1c0d097d82 Update ttl.html to add logout 2024-04-19 00:10:35 -05:00
RouteTable
0fe6326e2c Update sms.html to add logout 2024-04-19 00:09:24 -05:00
RouteTable
b1e5a40085 Update bandlock.html to add logout 2024-04-19 00:08:51 -05:00
RouteTable
5ba4c6b713 Update atcommander.html to add logout 2024-04-19 00:08:18 -05:00
RouteTable
5c79a22795 Update index.html to add logout 2024-04-19 00:07:31 -05:00
Cameron Thompson
1f42134cdf Merge pull request #35 from RouteTable/development
Updated to resolve tailscale update issue with filesystem readonly.
2024-04-18 23:30:23 -04:00
iamromulan
4bf1d8a9a9 Add console menu
Adding all new post-login menu
2024-04-18 23:28:20 -04:00
RouteTable
e18ec1764c Updated to resolve tailscale update issue with filesystem readonly. 2024-04-18 02:36:56 -05:00
RouteTable
fea72c96c4 Updated to resolve tailscale update issue with filesystem readonly. 2024-04-18 02:34:32 -05:00
Cameron Thompson
47063d7e8d Merge pull request #33 from snowzach/snowzach_ttl_fixes
Not everything needs sudo in set_ttl
2024-04-16 08:27:29 -04:00
Zach Brown
5cc0c08225 Not everything needs sudo in set_ttl 2024-04-16 12:05:19 +00:00
Cameron Thompson
cbdf13fce5 Fixed missing library for htpasswd utility 2024-04-15 19:25:05 -04:00
Cameron Thompson
82c2abd1b1 Fix Password issues
-You can now set a password longer than 8 characters; borrowing the htpasswd utility from Apache for this

-In the future to change the simpleadmin password, run simplepasswd from the console.
2024-04-14 13:25:40 -04:00
iamromulan
e11075edd4 Create simplepasswd 2024-04-14 12:39:09 -04:00
Cameron Thompson
0f4be98c07 Add htpasswd binary 2024-04-14 03:22:55 -04:00
iamromulan
01608d47b5 fix syntax error 2024-04-14 01:54:51 -04:00
iamromulan
7ddfe0b627 Define path for set_ttl 2024-04-14 01:30:40 -04:00
iamromulan
003a903d97 make ttlvalue file editable 2024-04-14 01:13:37 -04:00
iamromulan
8f61488e23 Add missing sudo 2024-04-14 00:32:24 -04:00
iamromulan
c2e7727bfe Add echo and cat to sudo www-data
-should fix ttl not being set
2024-04-14 00:25:00 -04:00
iamromulan
0c62275c95 Move .htpasswd to /opt/etc 2024-04-13 23:25:55 -04:00
iamromulan
db98e44aae Fix link 2024-04-13 23:16:06 -04:00
iamromulan
62146117fe Fix ttyd install/uninstall 2024-04-13 23:04:38 -04:00
iamromulan
dd98716a44 Fix permissions (again) 2024-04-13 22:55:24 -04:00
iamromulan
221178abb0 Fix permissions 2024-04-13 22:45:23 -04:00
iamromulan
ec2853878e Fix link 2024-04-13 22:37:21 -04:00
iamromulan
de8ca3eacb Add SSHd uninstall function 2024-04-13 22:34:05 -04:00
iamromulan
87f1733830 Phase 1 bug fixes
-Added menu option to set Simpleadmin password
-Added menu option to set root/console/ttyd/login password
-Fixed link for update_simpleadmin.sh
2024-04-13 22:21:37 -04:00
iamromulan
7f17818a9c Simpleupdates Phase 1
-Moved several installation functions to individual scripts that will run as systemd processes for updating/installing; This is phase 1 in creating an automatic update system
-Merged ttyd into simpleadmin as it is now part of simpleadmin as "console"
2024-04-13 21:56:39 -04:00
Cameron Thompson
406e586702 Merge pull request #31 from snowzach/fixes
Fixes for ttl
2024-04-13 13:36:51 -04:00
Zach Brown
723b69f662 Fixes for setting ttl 2024-04-13 13:09:54 +00:00
Cameron Thompson
817970bb71 Update RMxxx_rgmii_toolkit.sh 2024-04-13 01:20:57 -04:00
Cameron Thompson
e612482dc4 Update RMxxx_rgmii_toolkit.sh 2024-04-13 01:15:58 -04:00
Cameron Thompson
78e07160e2 Update RMxxx_rgmii_toolkit.sh 2024-04-13 01:11:06 -04:00
Cameron Thompson
df93948f23 Update RMxxx_rgmii_toolkit.sh 2024-04-13 01:05:48 -04:00
Cameron Thompson
89f22e1524 Update RMxxx_rgmii_toolkit.sh
Added  --force-removal-of-dependent-packages for uninstalling lighttpd
2024-04-13 00:58:49 -04:00
Cameron Thompson
22a319d0c8 Update RMxxx_rgmii_toolkit.sh
Add --force-remove to uninstall process
2024-04-13 00:54:13 -04:00
iamromulan
9579e75ab3 Move lighttpd files to simpleadmin
-Set admin as the username
-Gave sshd it's own function
2024-04-13 00:43:52 -04:00
Cameron Thompson
47ebc2a5ab Delete simpleadmin/systemd/simpleadmin_httpd.service
No longer needed
2024-04-12 22:32:21 -04:00
Cameron Thompson
a76fb0dcb0 Update RMxxx_rgmii_toolkit.sh
Update expected ttyd port to be 8080
2024-04-12 11:27:46 -04:00
Cameron Thompson
9f90a3bbab Update lighttpd.conf
Update port to 8080 for ttyd proxy
2024-04-12 11:16:22 -04:00
Cameron Thompson
1c41a857a0 Update ttyd.service
Change to port 8080, tailscale UI set to 8088 already
2024-04-12 11:15:21 -04:00
Cameron Thompson
818505e706 Update update_ttyd.sh
Fix incorrect branch
2024-04-12 11:04:38 -04:00
Cameron Thompson
a9c2e9c152 Update RMxxx_rgmii_toolkit.sh 2024-04-11 00:30:11 -04:00
Cameron Thompson
3fae1fcf61 Update RMxxx_rgmii_toolkit.sh 2024-04-11 00:27:35 -04:00
Cameron Thompson
16eafeea42 Merge pull request #29 from snowzach/lighttpd
-Simpleadmin on 80/443 https
-ttyd now part of simpleadmin
-simpleadmin now password protected
-sshd installation option
2024-04-11 00:21:11 -04:00
Cameron Thompson
1663b34e1d Prep to merge 2024-04-10 23:41:21 -04:00
Zach Brown
315b937e8f Ensure lighttpd installed for ttyd 2024-04-10 12:42:49 +00:00
Zach Brown
dc7f3f17d2 last minor updates 2024-04-10 12:20:12 +00:00
Cameron Thompson
91fbff193d Update simpleupdate 2024-04-10 00:57:56 -04:00
Cameron Thompson
99716d722c Delete simpleupdated 2024-04-10 00:50:12 -04:00
Cameron Thompson
fd6e528500 Update simpleupdated.service 2024-04-10 00:48:32 -04:00
Cameron Thompson
d12672c5ff Update simpleupdate 2024-04-10 00:47:53 -04:00
Cameron Thompson
ff56fbf190 Combine daemon and CLI into one script 2024-04-10 00:45:02 -04:00
Zach Brown
0b3cce7a1f Fix password 2024-04-10 02:58:25 +00:00
Zach Brown
b5166a969e Fix password bug 2024-04-10 02:47:03 +00:00
Zach Brown
b63b4d4cea Add password config 2024-04-10 02:45:12 +00:00
Cameron Thompson
ce5e328bae Update simpleupdated
Reduce to check date every 30 seconds to ensure every minute is captured 

Added logging last 100 lines to /tmp/simpleupdate.log

Configuration Validation: Ensures that only one update frequency setting is active and correctly defined, avoiding misconfigurations.
2024-04-09 21:10:27 -04:00
Cameron Thompson
ddd553f40e Create simpleupdate
CLI for config of the conf file
2024-04-09 20:39:30 -04:00
Zach Brown
59b3bfa6ba Add useradd for sshd 2024-04-09 21:34:44 +00:00
Zach Brown
c081b5c63f Clearly this causes some issue 2024-04-09 21:11:46 +00:00
Zach Brown
65a8dadbb6 Fix script 2024-04-09 20:32:57 +00:00
Zach Brown
2024ec569c Fixes 2024-04-09 19:18:06 +00:00
Zach Brown
223e704adc Fix OPKG installer 2024-04-09 17:08:26 +00:00
Zach Brown
74790da711 SSH updates 2024-04-09 15:48:46 +00:00
Zach Brown
c82d9496a7 Made a few changes to lighttpd 2024-04-09 02:20:15 +00:00
Zach Brown
05c387d539 First WIP of rework to lighttpd 2024-04-07 01:46:29 +00:00
Cameron Thompson
22cd4be6c8 Stats update in 2-3 seconds 2024-04-04 01:36:07 -04:00
Cameron Thompson
0eb07f75ef 1.6 Seconds stats 2024-04-04 01:33:34 -04:00
Cameron Thompson
c528e33876 Re-add useful AT commands section for now 2024-04-03 21:03:55 -04:00
Cameron Thompson
369b877e41 Create simpleadmin.conf 2024-04-01 00:40:20 -04:00
Cameron Thompson
9b9052843e Begin work on creating simpleupdates
-New update system to handle automatic updates
-work in progress
2024-04-01 00:36:06 -04:00
Cameron Thompson
86da9f8412 Add notes about speedtest, remove unused def. 2024-03-31 01:41:38 -04:00
Cameron Thompson
ed7f22c0ba Merge pull request #23 from dr-dolomite/development
Added Improvements to Simple Network Page
2024-03-29 21:13:51 -04:00
Russel Yasol
664b7b6bed Merge branch 'iamromulan:development' into development 2024-03-30 08:05:33 +08:00
Russel Yasol
ca895cab0d fixed max cell input to 10 2024-03-29 23:47:36 +08:00
Russel Yasol
618f978018 improved LTE cell id function 2024-03-29 23:39:24 +08:00
Russel Yasol
802c90e7b4 updated cell lock info 2024-03-29 21:33:47 +08:00
Russel Yasol
6ad0f026e6 added fix for NSA Scanning 2024-03-29 21:29:02 +08:00
Russel Yasol
21c9099606 removed duplicate reboot button 2024-03-29 21:25:55 +08:00
Russel Yasol
b0545018f2 added more query shortcuts 2024-03-29 21:24:55 +08:00
Russel Yasol
19c233e02b added cell lock max to 10 2024-03-29 21:09:41 +08:00
Cameron Thompson
8de5015d46 Merge pull request #22 from dr-dolomite/development
Added Other Bandlocking Page Functionalities
2024-03-28 08:34:48 -04:00
Russel Yasol
bb2921c8fe added some responsiveness for Simple Network 2024-03-28 13:47:54 +08:00
Russel Yasol
dfbbfe9ba5 added utilities and query 2024-03-28 13:00:59 +08:00
Cameron Thompson
4458b582d6 Add new html to installer 2024-03-28 00:55:34 -04:00
Cameron Thompson
da10c7b300 Merge pull request #21 from dr-dolomite/development
Added GUI Bandlocking and Cell Locking
2024-03-28 00:52:13 -04:00
Cameron Thompson
33f81954d7 Delete tailscale/tailscale
no longer needed
2024-03-28 00:49:08 -04:00
Cameron Thompson
8ad7da63f1 Delete tailscale/tailscaled
No longer needed
2024-03-28 00:48:51 -04:00
Cameron Thompson
d387d5417b Update tailscale installer
Now gets tailscale and tailscaled directly from source
updated to 1.62.1
2024-03-28 00:47:59 -04:00
Cameron Thompson
5bd84a7fb1 Delete ttyd/ttyd
remove unneeded file
2024-03-28 00:21:08 -04:00
Cameron Thompson
039c3d0855 update ttyd source to 1.7.5
https://github.com/tsl0922/ttyd/releases/tag/1.7.5
2024-03-28 00:20:29 -04:00
Cameron Thompson
0b33a3991e Fix simpleadmin not installing 2024-03-27 20:32:52 -04:00
Russel Yasol
968e003fa5 added cell locking functionality 2024-03-28 00:50:51 +08:00
Russel Yasol
6eff6d28cb removed trailing ` at parse script 2024-03-27 10:59:28 +08:00
Russel Yasol
3a506a5eb2 added GUI bandlocking 2024-03-27 10:55:54 +08:00
Cameron Thompson
cadf231422 Update RMxxx_rgmii_toolkit.sh 2024-03-26 01:44:10 -04:00
Cameron Thompson
6e3ccb63d7 Update installentware.sh
-Now installs:
mc: GUI file browser
htop: graphical view of system resources
dfc: graphical view of disk space
lsof: list open files (show what's using a particular thing/file)
2024-03-26 01:25:06 -04:00
Cameron Thompson
ea86c78d73 Update RMxxx_rgmii_toolkit.sh
-Update ttyd installation process to allow Updating and Uninstalling; Added new dependency check

-Add fast.com CLI (tops out at 40mbps)
2024-03-26 01:11:40 -04:00
Cameron Thompson
a42e85bcf2 Added Login Patch
-Now patches the login and passwd binaries to allow a normal login process
-Sets the $PATH and $HOME of the root user to reflect efficient use of the environment
(These changes were moved from the ttyd installation process as it is useful to more than just ttyd)
2024-03-25 23:29:04 -04:00
Cameron Thompson
31b58c431c Add Speedtest CLI installer 2024-03-25 01:27:32 -04:00
Cameron Thompson
f8c84d2779 Update ttyd.bash
update path to atcmd
2024-03-25 01:01:47 -04:00
Cameron Thompson
81b0a9e0ba Update ttyd.bash
Updated to use atcmd to obtain info
Now shows the firmware version and serial number
2024-03-25 00:53:13 -04:00
Cameron Thompson
fb108bd043 Merge pull request #20 from dr-dolomite/development
Added NSA Parsing Fix
2024-03-25 00:15:22 -04:00
Russel Yasol
013ce81c09 Merge branch 'development' of https://github.com/dr-dolomite/quectel-rgmii-toolkit into development 2024-03-25 08:56:59 +08:00
Russel Yasol
488486bcdc added dedicated NR-CA NSA parser 2024-03-25 08:52:54 +08:00
Cameron Thompson
93621b3f64 Update TTYd installation
-Now copies passwd from /etc to /opt/etc in the case of SELINUX is enabled on the module
-Sets the root user's home folder to /usrdata/root to allow for default writability and more available space
-Creates a .profile to be placed in the home directory that sets the correct $PATH This file can be used to execute a startup menu later.
-Creates /usrdata/root/bin for binaries to be pushed to later. This is added to the $PATH as well by .profile
2024-03-24 20:17:23 -04:00
Cameron Thompson
e1fb14118b Add the ability to specify an AT command as an argument
Usage:
atcmd '<command>'
or
atcmd (starts an interactive session as before)

Example:
root@sdxlemur:~# atcmd 'ATI'
ATI
Quectel
RM521F-GL
Revision: RM521FGLEAR05A02M4G

OK
2024-03-24 17:51:48 -04:00
Cameron Thompson
2d6067799d Merge pull request #19 from dr-dolomite/development
Added various new features and fixes
2024-03-24 16:02:59 -04:00
Cameron Thompson
f9c9f97e95 Merge branch 'development' into development 2024-03-24 16:02:38 -04:00
Russel Yasol
f58ccff0bf added dedicated NR-CA SA parser 2024-03-25 00:06:44 +08:00
Russel Yasol
b423866d0d added reboot button 2024-03-24 22:38:21 +08:00
Russel Yasol
4a3307f683 added ATI as the default command 2024-03-24 21:50:24 +08:00
Cameron Thompson
4b92fdbaf0 Re-add sed
dea33f9ad9 (r140145133)
2024-03-23 16:36:03 -04:00
Cameron Thompson
a3b4e40027 Sync changes with simpleadmintest 2024-03-21 23:29:16 -04:00
Cameron Thompson
e19dc87405 Re-add sed; Fixes stats page 2024-03-21 22:33:21 -04:00
Cameron Thompson
bc2a2500ad Merge pull request #17 from dr-dolomite/development
Added Speedtest Page
2024-03-21 20:18:06 -04:00
dr-dolomite
f2e4f26b81 added speedtest page 2024-03-21 19:55:09 +08:00
Cameron Thompson
43827d835c Merge pull request #16 from dr-dolomite/development
For Testing: For NR5G SA Carrier Aggregation SCC Parsing
2024-03-21 00:06:02 -04:00
dr-dolomite
de954c1ec4 Merge branch 'development' of https://github.com/dr-dolomite/quectel-rgmii-toolkit into development 2024-03-21 08:57:43 +08:00
dr-dolomite
3b739faf66 temporarily removed sed for SA 2024-03-21 08:57:29 +08:00
dr-dolomite
9fae1763e4 added template for client side fetching 2024-03-21 06:03:36 +08:00
Cameron Thompson
35993bf722 Fixed ttyd not starting at boot 2024-03-19 20:05:56 -07:00
Cameron Thompson
24559dc6f2 Merge pull request #13 from dr-dolomite/development
AT Command Page Input Change
2024-03-17 22:23:23 -04:00
Cameron Thompson
871708de51 Merge pull request #12 from dr-dolomite/main
Fixed APN and SCC parsing
2024-03-17 22:22:54 -04:00
dr-dolomite
9591200848 Merge branch 'development' of https://github.com/dr-dolomite/quectel-rgmii-toolkit into development 2024-03-18 10:08:33 +08:00
dr-dolomite
71fb0b2245 at input now accepts return key 2024-03-18 10:08:16 +08:00
Russel Yasol
e82218e264 Merge branch 'iamromulan:development' into development 2024-03-18 09:57:13 +08:00
dr-dolomite
81260a5289 removed unneeded json file 2024-03-18 09:48:08 +08:00
dr-dolomite
7007844977 fixed APN to fetch the third field directly 2024-03-18 09:47:38 +08:00
dr-dolomite
19a10334cb added conditions when querying SCC bands 2024-03-18 08:44:44 +08:00
Cameron Thompson
d553d6d55a Merge pull request #10 from dr-dolomite/main
Added Minor Fixes and Dynamic Wait Time for AT Command Page
2024-03-17 13:34:01 -04:00
Cameron Thompson
93450eb399 Merge branch 'development' into main 2024-03-17 13:32:43 -04:00
iamromulan
fdb488f478 Sync PR#11 from main
Co-Authored-By: Tarun Reddy <tarun@reddyemail.com>
2024-03-17 13:12:44 -04:00
Cameron Thompson
bce789a5b9 Update development README.md 2024-03-17 11:59:50 -04:00
iamromulan
182159fe71 Update Development Branch README 2024-03-17 11:47:10 -04:00
dr-dolomite
0ce9b05ef3 fixed NR_BAND where it includes the PCC when 2 SA NRBANDS were detected 2024-03-17 21:40:09 +08:00
dr-dolomite
d8c1799789 added fix for json parsing failing on 2 NR5G bands 2024-03-17 21:16:24 +08:00
dr-dolomite
80b34719a5 incorporated atcmd dynamic wait time to get_atcommand 2024-03-17 17:07:18 +08:00
dr-dolomite
b450fd2813 added clear button and disabled states 2024-03-17 15:49:40 +08:00
dr-dolomite
28c4430ca5 fixed APN not showing, moved to generic branding, and added sms for testing 2024-03-17 13:39:10 +08:00
Cameron Thompson
2970209753 Update installentware.sh
Remove extra quotes
2024-03-16 22:15:32 -04:00
Cameron Thompson
92fb8ab335 Update RMxxx_rgmii_toolkit.sh
Updated ttyd installation
2024-03-16 21:51:49 -04:00
Cameron Thompson
911df02bd8 Update RMxxx_rgmii_toolkit.sh
Add more info to the portable/built-in AT Command Function
Defined the Github username
2024-03-16 20:23:07 -04:00
Cameron Thompson
95b10ece14 Update installentware.sh
Add color to menu option when looking for existing opkg installed from factory
2024-03-16 20:21:47 -04:00
Cameron Thompson
b7a28b0598 Delete old atcmd 2024-03-16 20:04:16 -04:00
Cameron Thompson
dc8149ad67 Update get_atcommand to use ttyOUT2
Using the intended AT command stream now. Should be more responsive.
2024-03-16 19:45:18 -04:00
Cameron Thompson
8c69205582 Update atcmd 2024-03-16 19:33:35 -04:00
Cameron Thompson
2bdbf613e8 Update atcmd 2024-03-16 19:27:40 -04:00
Cameron Thompson
3eeb641309 Update atcmd 2024-03-16 19:22:12 -04:00
Cameron Thompson
91b8dde145 Update atcmd 2024-03-16 19:13:39 -04:00
Cameron Thompson
2f01f9cacc Add Color to atcmd 2024-03-16 18:53:56 -04:00
Cameron Thompson
efd859e302 Update atcmd 2024-03-16 18:43:58 -04:00
Cameron Thompson
df20fbeca3 Update atcmd 2024-03-16 18:38:46 -04:00
Cameron Thompson
b9916a4c1d Update atcmd 2024-03-16 18:30:57 -04:00
Cameron Thompson
cf39a48263 at-socat-bridge major update toolkit fix
Fixed the chmod +x command failing
2024-03-16 18:13:45 -04:00
iamromulan
127db81532 Major at-socat-bridge update
-Now uses both smd11 and smd7 for separate AT streams
-smd11 is linked to ttyOUT
-smd7 is linked to ttyOUT2

ttyOUT is intended for automated AT commands (for parse scripts, etc)

ttyOUT2 is intended for manual user initiated AT commands; the new atcmd bin is now linked to /bin as well for utilization of ttyOUT2 by shell. Just type the command atcmd to run it.

Separating these streams will improve responsiveness and help the progress of more development.
2024-03-16 17:49:52 -04:00
iamromulan
eb1ae610a0 Merge chnages from PR#9
https: //github.com/iamromulan/quectel-rgmii-toolkit/pull/9
Co-Authored-By: Russel Yasol <73575327+dr-dolomite@users.noreply.github.com>
2024-03-16 15:54:43 -04:00
iamromulan
ff887444f7 Create LICENSE 2024-03-13 16:19:24 -04:00
iamromulan
87dab7a813 Fix missing function call 2024-03-11 23:32:41 -04:00
iamromulan
b16f76b9bc Update README.md 2024-03-11 23:18:18 -04:00
iamromulan
3dff54a90d Add check for existing opkg 2024-03-11 23:12:02 -04:00
iamromulan
415ee31bbf Fixed unknown NSA 5G band parse
Fixed
2024-02-29 00:18:20 -05:00
iamromulan
cef714f755 Remove Python ref (very old) 2024-02-27 01:09:26 -05:00
iamromulan
9cd62ec422 Add systemd unit for smd7 bridge kill
-Kills existing bridge between smd7 and at_usb2 (Confirmed Not the USB COM port that shows in Windows)
2024-02-27 00:19:03 -05:00
iamromulan
369e3ad673 Add new files for 2nd Socat bridge
-Create a new set of systemd units to chose from for the creation of ttyIN2 and ttyOUT2 for a 2nd separate AT channel
-Create a new script that kills the smd7 port bridge when smd7 is needed for use by ttyOUT or ttyOUT2
2024-02-26 22:43:47 -05:00
iamromulan
26a74b1e24 Update RMxxx_rgmii_toolkit.sh 2024-02-26 19:59:08 -05:00
iamromulan
07e4e797b7 Add TTYd option 2024-02-26 19:56:22 -05:00
iamromulan
17c8b1f901 Create ttyd.service 2024-02-26 19:15:36 -05:00
iamromulan
b1f001b066 Add ttyd.bash
Example script file for TTYD to start up
2024-02-26 01:18:36 -05:00
iamromulan
f320f94e4c Move uninstall function 2024-02-26 00:44:08 -05:00
iamromulan
c543a1e9ab Update Entware installer trigger 2024-02-26 00:34:46 -05:00
iamromulan
1ebd61b7cb Remove indentations 2024-02-26 00:29:14 -05:00
iamromulan
68a84397b0 Update installentware.sh
Improve Installation process
Add colors to echo
2024-02-26 00:21:40 -05:00
iamromulan
c724d64d04 Add uninstall option
Add uninstall option, cleanup
2024-02-25 23:47:59 -05:00
iamromulan
edee6c61ca Sync with main 2024-02-25 23:22:46 -05:00
iamromulan
2c40cacc18 Add $GITTREE to entware link
Add $GITTREE to entware link
2024-02-25 21:52:05 -05:00
iamromulan
a175d0597a Merge last fixes from Main 2024-02-25 21:41:34 -05:00
587 changed files with 48673 additions and 2134 deletions

145
README.md
View File

@@ -1,147 +1,8 @@
# RGMII Toolkit
Software deployment Toolkit for Quectel RM5xxx series 5G modems utilizing an m.2 to RJ45 adapter (RGMII)
#### [JUMP TO HOW TO USE](#how-to-use)
**Currently:** This will allow you to install or if already installed, update, remove, or modify:
- Simple Admin: A simple web interface for managing your Quectel m.2 modem through it's gateway address
- It will install socat-at-bridge: sets up ttyOUT and ttyOUT2 for AT commands. You'll be able to use the `atcmd` command as well for an interactive at command session from adb, ssh, or ttyd
- It will install simplefirewall: A simple firewall that blocks definable incoming ports and a TTL mangle option/modifier. As of now only the TTL is controllable through Simple Admin. You can edit port block options and TTL from the 3rd option in the toolkit
- Tailscale: A magic VPN for accessing Simple Admin, SSH, and ttyd on the go. The Toolkit installs the Tailscale client directly to the modem and allows you to login and configure other settings. Head over to tailscale.com to sign up for a free account and learn more.
- Schedule a Daily Reboot at a specified time
- A fix for certain modems that don't start in CFUN=1 mode
- Entware/OPKG: A package installer/manager/repo
- Run `opkg help` to see how to use it
- These packages are installable: https://bin.entware.net/armv7sf-k3.2/Packages.html
- TTYd: A shell session right from your browser
- Currently this uses port 443 but SSL/TLS is not in use (http only for now)
- Entware/OPKG is required so it will install it if it isn't installed
- This will replace the stock Quectel login and passwd binaries with ones from entware
Current Branch: **overhaul-SDXLEMUR**
Current Status: ⚠️ **DO NOT USE OR DEPLOY/BROKEN STATE** ⚠️
**My goal** is for this to also include any new useful scripts or software for this modem and others that support RGMII mode.
## Screenshots
- Currently creating an OpenWRT overlay sub-system
![Home Page](https://github.com/iamromulan/quectel-rgmii-configuration-notes/blob/main/images/iamromulansimpleindex.png?raw=true)
![AT Commands](https://github.com/iamromulan/quectel-rgmii-configuration-notes/blob/main/images/iamromulanatcommands.png?raw=true)
![TTL](https://github.com/iamromulan/quectel-rgmii-configuration-notes/blob/main/images/iamromulansimpleTTL.png?raw=true)
![Toolkit](https://github.com/iamromulan/quectel-rgmii-configuration-notes/blob/main/images/iamromulantoolkit.png?raw=true)
## How to Use
**To run the Toolkit:**
- Open ADB & Fastboot++ covered in [Using ADB](https://github.com/iamromulan/quectel-rgmii-configuration-notes?tab=readme-ov-file#unlocking-and-using-adb) or just use adb
- Make sure your modem is connected by USB to your computer
- Run `adb devices` to make sure your modem is detected by adb
- Run `adb shell ping 8.8.8.8` to make sure the shell can access the internet. If you get an error, make sure the modem is connected to a cellular network and make sure `AT+QMAPWAC=1` as covered in the troubleshooting section: [I Can't get internet access from the Ethernet port (Common)](https://github.com/iamromulan/quectel-rgmii-configuration-notes/tree/main?tab=readme-ov-file#i-cant-get-internet-access-from-the-ethernet-port-common)
- If you don't get an error you should be getting replies back endlessly, press `CTRL-C` to stop it.
- Simply Copy/Paste this into your Command Prompt/Shell
```bash
adb shell "cd /tmp && wget -O RMxxx_rgmii_toolkit.sh https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/main/RMxxx_rgmii_toolkit.sh && chmod +x RMxxx_rgmii_toolkit.sh && ./RMxxx_rgmii_toolkit.sh" && cd /
```
**Or, if you want to stay in the modems shell when you are done**
```
adb shell
```
Then run
```
cd /tmp && wget -O RMxxx_rgmii_toolkit.sh https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/main/RMxxx_rgmii_toolkit.sh && chmod +x RMxxx_rgmii_toolkit.sh && ./RMxxx_rgmii_toolkit.sh && cd /
```
**You should see:**
![Toolkit](https://github.com/iamromulan/quectel-rgmii-configuration-notes/blob/main/images/iamromulantoolkit.png?raw=true)
## Tailscale Installation and Config
> :warning: Your modem must already be connected to the internet for this to install
### Installation:
Open up the toolkit main menu and **press 4** to enter the Tailscale menu
![Toolkit](https://github.com/iamromulan/quectel-rgmii-configuration-notes/blob/main/images/tailscalemenu.png?raw=true)
**Press 1, wait for it to install. This is a very large file for the system so give it some time.**
**Once done and it says Tailscale installed successfully press 2/enter to configure it.**
![Toolkit](https://github.com/iamromulan/quectel-rgmii-configuration-notes/blob/main/images/tailscaleconfig.png?raw=true)
If you want to, enable the Tailscale Web UI on port 8088 for configuration from the browser later by **pressing 1/enter**.
To do it in the toolkit:
First time connecting you'll be given a link to login with
- Press 3 to just connect only.
- Press 4 to connect and enable SSH access (remote command line) over tailscale.
- Press 5 to reconnect with SSH off while connected with SSH on
- Press 6 to disconnect
- Press 7 to Logout
That's it! From another device running tailscale you should be able to access your modem through the IP assigned to it by your tailnet. To access SSH from another device on the tailnet, open a terminal/command prompt and type
tailscale ssh root@(IP or Hostname)
IP or Hostname being the IP or hostname assigned to it in your tailnet
- Note that your SSH client must be able to give you a link to sign in with upon connecting. That's how the session is authorized. Works fine in Windows CMD or on Android use JuiceSSH.
## Advanced/Beta
### Entware/OPKG installation
It isn't perfect yet so it goes here under Advanced/Beta for now.
Here's what you gotta know about going into it:
- After installing, the `opkg` command will work
- You can run `opkg list` to see a list of installable packages, or head over to https://bin.entware.net/armv7sf-k3.2/Packages.html
- Everything opkg does is installed to /opt
- `/opt` is actually located at `/usrdata/opt` to save space but is
mounted at `/opt`
- Anything `opkg` installs will not be available in the system path by
default but you can get around this either:
#### Temporarily:
Run this at the start of each adb shell or SSH shell session
export PATH=/opt/bin:/opt/sbin:$PATH
#### Permanently:
Symbolic linking each binary installed by the package to `/bin` and `/sbin` from `/opt/bin` and `/opt/sbin`
For example, if you were to install zerotier:
opkg install zerotier
ln -sf /opt/bin/zerotier-one /bin
ln -sf /opt/bin/zerotier-cli /bin
ln -sf /opt/bin/zerotier-idtool /bin
Now you can run those 3 binaries from the shell anytime since they are linked in a place already part of the system path.
I plan to create a watchdog service for /opt/bin and /opt/sbin that will automaticly link new packages to /bin or /sbin later on in order to combat this.
### TTYd installation
It isn't perfect yet so it goes here under Advanced/Beta for now.
Here's what you gotta know about going into it:
- This listens on port 443 for http requests (no SSL/TLS yet)
- This will automaticly install entware and patch the login and passwd binaries with ones from entware
- It will ask you to set a password for the `root` user account
- TTYd doesn't seem to be too mobile friendly for now but I optimized it the best i could for now so it is at least usable through a smartphone browser. Hopefully the startup script can be improved even more later.
## Acknowledgements
### GitHub Users/Individuals:
Thank You to:
[Nate Carlson](https://github.com/natecarlson) for the Original Telnet Deamon/socat bridge usage and the Original RGMII Notes
[aesthernr](https://github.com/aesthernr) for creating the Original Simple Admin
[rbflurry](https://github.com/rbflurry/) for inital Simple Admin fixes
[dr-dolomite](https://github.com/dr-dolomite) for some major stat page improvements and this repos first approved external PR!
### Existing projects:
Simpleadmin heavily uses the AT Command Parsing Scripts (Basically a copy with new changes and tweaks) of Dairyman's Rooter Source https://github.com/ofmodemsandmen/ROOterSource2203
Tailscale was obtained through Tailscale's static build page. Since these modems have a 32-bit ARM processor on-board I used the arm package. https://pkgs.tailscale.com/stable/#static
Entware/opkg was obtained through [Entware's wiki](https://github.com/Entware/Entware/wiki/Alternative-install-vs-standard) and the installer heavily modified by [iamromulan](https://github.com/iamromulan) for use with Quectel modems
TTYd was obtained from the [TTYd Project](https://github.com/tsl0922/ttyd)

109
at-list.md Normal file
View File

@@ -0,0 +1,109 @@
# Useful AT Commands
You can send more than one command at once by sperating them with ``;`` and not including the AT part. ``AT+QENG="servingcell";+QCAINFO`` for example to see the info from both ``AT+QENG="servingcell"`` and ``AT+QCAINFO``
## PCIe RC Ethernet mode setup
### For RM500-RM521 modems
``AT+QETH="eth_driver","r8125",1;+QCFG="pcie/mode",1;+QCFG="usbnet",1;+QMAP="MPDN_rule",0,1,0,1,1,"FF:FF:FF:FF:FF:FF";+QMAP="DHCPV4DNS","disable";+QCFG="usbcfg",0x2C7C,0x0801,1,1,1,1,1,2,0;+CFUN=1,1``
This will do the following:
- Set the 2.5Gig Ethernet driver as active
- Enable PCIe RC mode
- Set to ECM mode via USB and AP mode connection behavior
- Enable IPPT
- Enable DNS IPPT (disables onboard proxy)
- Force Enables ADB Access
- Reboots after all the above
### For x70 modems (RM550/551)
For BETA versions of firmware: the adb value 2 trick still works so one and done:
``AT+QCFG="pcie/mode",1;+QCFG="usbnet",1;+QCFG="usbcfg",0x2C7C,0x0122,1,1,1,1,1,2,0;+CFUN=1,1``
OR if you are running the latest non-beta firmware
``AT+QCFG="pcie/mode",1;+QCFG="usbnet",1``
Then unlock ADB:
Ask the modem for its adb code by sending: ``AT+QADBKEY?``
It'll respond with something like ``+QADBKEY: 29229988``
Take that number and paste it in this generator: https://onecompiler.com/python/3znepjcsq (hint: where it says STDIN)
You should get something like
``AT+QADBKEY="mrX4zOPwdSIEjfM"``
Send that command to the modem and adb will be able to be turned on with the next command
Now you can turn it on with the usbcfg command ``AT+QCFG="usbcfg"``
***Be super careful, this controls what ports are on/off over USB.***
Run it and you will get the current settings. Something like this:
``+QCFG: "usbcfg",0x2C7C,0x0122,1,1,1,1,1,0,0``
Send ``AT+QCFG="usbcfg",0x2C7C,0x0122,1,1,1,1,1,1,0`` to enable adb
Now you can reboot: ``AT+CFUN=1,1``
This will do the following:
- Enable PCIe RC mode (Driver selection is automatic now)
- Set to ECM mode via USB and AP mode connection behavior
- Force Enables ADB Access
- Reboots after all the above
Tip: APN automatic selection will somtimes choose the wrong APN. You may need to set your APN after powering up with the SIM inserted.
## The List
- ``AT+CFUN=1,1`` (reboot)
- ``AT+CFUN=0;CFUN=1`` (Disconnect then reconnect)(tip: run this after chnaging APN and you don't have to reboot)
- ``AT+QMAPWAC? ``(get current status of auto connect, 0=disabled 1=enabled)
- ``AT+QMAPWAC=1`` (enable auto connect internet for ethernet)
- ``AT+QMAPWAC=0`` (disable auto connect for ethernet; use when you want internet over USB to work; IPPT must be disabled)
- ``AT+QUIMSLOT?`` (get active sim slot; 1=Slot 1; 2=Slot 2)
- ``AT+QUIMSLOT=1`` (switch to sim slot 1)
- ``AT+QUIMSLOT=2`` (switch to sim slot 2)
- ``AT+CGDCONT?`` (Get active APN profle st 1 through 8)
- ``AT+QMBNCFG="AutoSel",0;+QMBNCFG="Deactivate"`` (Disable Automatic APN selection)(You will need to set your APN when you switch SIMs or Slots)(Can also set APN after you switch the run ``AT+CFUN=0;CFUN=1``
- ``AT+CGDCONT=1,"IPV4V6","APNHERE"`` (Sets APN profile 1 to APNHERE using both IPV4 and IPV6)
- ``AT+GSN`` (Show current IMEI)
- ``AT+EGMR=0,7`` (Show current IMEI)
- ``AT+EGMR=1,7,"IMEIGOESHERE"`` (sets/repairs IMEI)
- ``AT+QCFG="usbcfg",0x2C7C,0x0801,1,1,1,1,1,2,0`` (enables adb bypasses adb key)
- ``AT+QENG="servingcell"`` (shows anchor band and network connection status)
- ``AT+QCAINFO`` (Show all connected bands/CA info)
- ``AT+QNWPREFCFG="mode_pref"`` (Check what the current network search mode is set to)
- ``AT+QNWPREFCFG="mode_pref",AUTO`` (Set network search mode to automatic)
- ``AT+QNWPREFCFG="mode_pref",NR5G:LTE`` (Set network search mode to 5GNR and 4GLTE only)
- ``AT+QNWPREFCFG="mode_pref",NR5G`` (Set network search mode to 5GNR only)
- ``AT+QNWPREFCFG="mode_pref",LTE`` (Set network search mode to 4GLTE only)
- ``AT+QNWPREFCFG="nr5g_disable_mode"`` (Check to see if SA or NSA NR5G is disabled)
- ``AT+QNWPREFCFG="nr5g_disable_mode",0`` (Enable Both SA and NSA 5GNR)
- ``AT+QNWPREFCFG="nr5g_disable_mode",1`` (Disable SA 5GNR only)
- ``AT+QNWPREFCFG="nr5g_disable_mode",2`` (Disable NSA 5GNR only)
- ``AT+QNWPREFCFG="nr5g_band"`` (Get current SA 5GNR bandlock settings)
- ``AT+QNWPREFCFG="nsa_nr5g_band"`` (Get current NSA 5GNR bandlock settings)
- ``AT+QNWPREFCFG="nr5g_band",1:2:3:4:5:6`` (Example: Lock to SA 5G/NR bands n1,n2,n3,n4,n5, and n6)
- ``AT+QNWPREFCFG="nsa_nr5g_band",1:2:3:4:5:6`` (Example: Lock to SA 5G/NR bands n1,n2,n3,n4,n5, and n6)
- ``AT+QNWPREFCFG="lte_band"`` (Get current 4GLTE bandlock settings)
- ``AT+QNWPREFCFG="lte_band",1:2:3:4:5:6`` (Example: Lock to 4G/LTE bands 1,2,3,4,5, and 6)
- ``AT+QMAP="WWAN"`` (Show currently assigned IPv4 and IPv6 from the provider)
- ``AT+QMAP="LANIP"`` (Show current DHCP range and Gateway address for VLAN0)
- ``AT+QMAP="LANIP",IP_start_range,IP_end_range,Gateway_IP `` (Set IPv4 Start/End range and Gateway IP of DHCP for VLAN0)
- ``AT+QMAP="DHCPV4DNS","disable"`` (disable the onboard DNS proxy; recommended for IPPT)
- ``AT+QMAP="MPDN_rule",0,1,0,1,1,"FF:FF:FF:FF:FF:FF"`` (Turn on IP Passthrough for Ethernet)
(:warning: On the RM551E-GL you must specify the ethernet devices MAC address instead of FF:FF:FF...)
- ``AT+QMAP="MPDN_rule",0`` (turn off IPPT/clear MPDN rule 0; Remember to run AT+QMAPWAC=1 and reboot after)

View File

@@ -0,0 +1,15 @@
Package: atinout
Version: 0.9.1
Depends: libc
Source: feeds/kiddin9/atinout
SourceName: atinout
License: GPLv2
LicenseFiles: LICENSE
Section: net
SourceDateEpoch: 1731357966
URL: http://atinout.sourceforge.net/
Maintainer: Adrian Guenter <a@gntr.me>
Architecture: arm_cortex-a7_neon-vfpv4
Installed-Size: 20480
Description: Atinout is a program that will execute AT commands in sequence and
capture the response from the modem.

View File

@@ -0,0 +1,5 @@
#!/bin/sh
[ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0
[ -s ${IPKG_INSTROOT}/lib/functions.sh ] || exit 0
. ${IPKG_INSTROOT}/lib/functions.sh
default_postinst $0 $@

View File

@@ -0,0 +1,4 @@
#!/bin/sh
[ -s ${IPKG_INSTROOT}/lib/functions.sh ] || exit 0
. ${IPKG_INSTROOT}/lib/functions.sh
default_prerm $0 $@

View File

@@ -0,0 +1 @@
2.0

View File

@@ -0,0 +1,2 @@
/etc/config/
/etc/atinout/

View File

@@ -0,0 +1 @@
2.0

View File

@@ -0,0 +1,15 @@
[Unit]
Description=Set up OpenWRT overlay filesystem
DefaultDependencies=no
Requires=qmi_shutdown_modemd.service
After=qmi_shutdown_modemd.service
ConditionPathExists=/usr/sbin/openwrt-overlay.sh
[Service]
Type=oneshot
ExecStart=/usr/sbin/openwrt-overlay.sh
RemainAfterExit=true
[Install]
WantedBy=openwrt-subsystem.target

View File

@@ -0,0 +1,7 @@
[Unit]
Description=OpenWRT Subsystem Target
Requires=openwrt-overlay.service
After=qmi_shutdown_modemd.service openwrt-overlay.service
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,81 @@
#!/bin/sh
newroot() {
/bin/echo "Begin mount fix process to make a usable userspace for OpenWRT Subsystem"
# Forcefully unmount /etc
/bin/echo "Unmounting the bind at /etc"
/bin/umount -lf /etc
# Remount root filesystem as read-write
/bin/echo "Remounting / as read-write"
/bin/mount -o remount,rw /
# Make mount namespaces private
mount --make-rprivate /
# Ensure necessary directories exist for overlay and pivot_root
/bin/echo "Creating new overlay system"
if [ ! -d /usrdata/rootfs ]; then
mkdir -p /usrdata/rootfs
fi
if [ ! -d /usrdata/rootfs-workdir ]; then
mkdir -p /usrdata/rootfs-workdir
fi
if [ ! -d /rootfs ]; then
mkdir -p /rootfs
fi
# Mount the new overlay filesystem
/bin/mount -t overlay overlay -o lowerdir=/,upperdir=/usrdata/rootfs,workdir=/usrdata/rootfs-workdir /rootfs
# Create the real_rootfs directory in the new root
if [ ! -d /rootfs/real_rootfs ]; then
mkdir -p /rootfs/real_rootfs
fi
# Pivot root to the new root
/bin/echo "Pivoting Root / to /rootfs; Be back soon!!"
/sbin/pivot_root /rootfs /rootfs/real_rootfs >/dev/null 2>&1
# Move the mounted filesystems to the new locations
/bin/echo "Moving previous mount points to the new root"
/bin/mount --move /real_rootfs/sys /sys
/bin/mount --move /real_rootfs/proc /proc
/bin/mount --move /real_rootfs/tmp /tmp
/bin/mount --move /real_rootfs/dev /dev
/bin/mount --move /real_rootfs/firmware /firmware
/bin/mount --move /real_rootfs/usrdata /usrdata
/bin/mount --move /real_rootfs/persist /persist
/bin/mount --move /real_rootfs/cache /cache
/bin/mount --move /real_rootfs/data /data
/bin/mount --move /real_rootfs/run /run
/bin/mount --move /real_rootfs/etc/machine-id /etc/machine-id
/bin/mount --move /real_rootfs/var/volatile /var/volatile
/bin/mount --move /real_rootfs/systemrw /systemrw
# Bind-mount core mountpoints back into real_rootfs for chroot/debug
/bin/echo "Binding previous mount points to the old root"
/bin/mount --bind /dev /real_rootfs/dev
/bin/mount --bind /proc /real_rootfs/proc
/bin/mount --bind /sys /real_rootfs/sys
/bin/mount --bind /tmp /real_rootfs/tmp
/bin/mount --bind /run /real_rootfs/run
/bin/mount --bind /firmware /real_rootfs/firmware
/bin/mount --bind /persist /real_rootfs/persist
/bin/mount --bind /cache /real_rootfs/cache
/bin/mount --bind /data /real_rootfs/data
/bin/mount --bind /systemrw /real_rootfs/systemrw
/bin/mount --bind /usrdata /real_rootfs/usrdata
/bin/mount --bind /etc /real_rootfs/etc
/bin/mount --bind /etc/machine-id /real_rootfs/etc/machine-id
/bin/mount --bind /var/volatile /real_rootfs/var/volatile
# Mount orginal rootfs as RO
/bin/mount -o remount,ro /real_rootfs
echo "Complete"
}
newroot

View File

@@ -0,0 +1,15 @@
[Unit]
Description=Set up OpenWRT overlay filesystem
DefaultDependencies=no
Requires=qmi_shutdown_modemd.service
After=qmi_shutdown_modemd.service
ConditionPathExists=/usr/sbin/openwrt-overlay.sh
[Service]
Type=oneshot
ExecStart=/usr/sbin/openwrt-overlay.sh
RemainAfterExit=true
[Install]
WantedBy=openwrt-subsystem.target

View File

@@ -0,0 +1,7 @@
[Unit]
Description=OpenWRT Subsystem Target
Requires=openwrt-overlay.service
After=qmi_shutdown_modemd.service openwrt-overlay.service
[Install]
WantedBy=multi-user.target

View File

@@ -1,8 +1,15 @@
#!/bin/sh
# Define toolkit paths
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/usrdata/root/bin
GITUSER="iamromulan"
GITTREE="main"
REPONAME="quectel-rgmii-toolkit"
GITTREE="SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
TMP_DIR="/tmp"
USRDATA_DIR="/usrdata"
SOCAT_AT_DIR="/usrdata/socat-at-bridge"
@@ -11,13 +18,7 @@ SIMPLE_ADMIN_DIR="/usrdata/simpleadmin"
SIMPLE_FIREWALL_DIR="/usrdata/simplefirewall"
SIMPLE_FIREWALL_SCRIPT="$SIMPLE_FIREWALL_DIR/simplefirewall.sh"
SIMPLE_FIREWALL_SYSTEMD_DIR="$SIMPLE_FIREWALL_DIR/systemd"
SIMPLE_FIREWALL_SERVICE="/lib/systemd/system/simplefirewall.service"
GITHUB_URL="https://github.com/$GITUSER/quectel-rgmii-toolkit/archive/refs/heads/$GITTREE.zip"
GITHUB_SIMPADMIN_FULL_URL="https://github.com/$GITUSER/quectel-rgmii-toolkit/archive/refs/heads/simpleadminfull.zip"
GITHUB_SIMPADMIN_NOCMD_URL="https://github.com/$GITUSER/quectel-rgmii-toolkit/archive/refs/heads/simpleadminnoatcmds.zip"
GITHUB_SIMPADMIN_TTL_URL="https://github.com/$GITUSER/quectel-rgmii-toolkit/archive/refs/heads/simpleadminttlonly.zip"
GITHUB_SIMPADMIN_TEST_URL="https://github.com/$GITUSER/quectel-rgmii-toolkit/archive/refs/heads/simpleadmintest.zip"
TAILSCALE_DIR="/usrdata/tailscale/"
TAILSCALE_DIR="/usrdata/tailscale"
TAILSCALE_SYSD_DIR="/usrdata/tailscale/systemd"
# AT Command Script Variables and Functions
DEVICE_FILE="/dev/smd7"
@@ -103,118 +104,115 @@ send_at_commands() {
fi
}
# Check if Simple Admin is installed
is_simple_admin_installed() {
[ -d "$SIMPLE_ADMIN_DIR" ] && return 0 || return 1
}
# Check for existing Entware/opkg installation, install if not installed
ensure_entware_installed() {
remount_rw
if [ ! -f "/opt/bin/opkg" ]; then
echo -e "\e[1;32mInstalling Entware/OPKG\e[0m"
cd /tmp && wget -O installentware.sh "$GITROOT/installentware.sh" && chmod +x installentware.sh && ./installentware.sh
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mEntware/OPKG installation failed. Please check your internet connection or the repository URL.\e[0m"
exit 1
fi
cd /
else
echo -e "\e[1;32mEntware/OPKG is already installed.\e[0m"
if [ "$(readlink /bin/login)" != "/opt/bin/login" ]; then
opkg update && opkg install shadow-login shadow-passwd shadow-useradd
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mPackage installation failed. Please check your internet connection and try again.\e[0m"
exit 1
fi
# Function to install/update AT Socat Bridge
install_update_at_socat() {
remount_rw
# Replace the login and passwd binaries and set home for root to a writable directory
rm /opt/etc/shadow
rm /opt/etc/passwd
cp /etc/shadow /opt/etc/
cp /etc/passwd /opt/etc
mkdir -p /usrdata/root/bin
touch /usrdata/root/.profile
echo "# Set PATH for all shells" > /usrdata/root/.profile
echo "export PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin" >> /usrdata/root/.profile
chmod +x /usrdata/root/.profile
sed -i '1s|/home/root:/bin/sh|/usrdata/root:/bin/bash|' /opt/etc/passwd
rm /bin/login /usr/bin/passwd
ln -sf /opt/bin/login /bin
ln -sf /opt/bin/passwd /usr/bin/
ln -sf /opt/bin/useradd /usr/bin/
echo -e "\e[1;31mPlease set the root password.\e[0m"
/opt/bin/passwd
# Install basic and useful utilities
opkg install mc htop dfc lsof
ln -sf /opt/bin/mc /bin
ln -sf /opt/bin/htop /bin
ln -sf /opt/bin/dfc /bin
ln -sf /opt/bin/lsof /bin
fi
if [ ! -f "/usrdata/root/.profile" ]; then
opkg update && opkg install shadow-useradd
mkdir -p /usrdata/root/bin
touch /usrdata/root/.profile
echo "# Set PATH for all shells" > /usrdata/root/.profile
echo "export PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin" >> /usrdata/root/.profile
chmod +x /usrdata/root/.profile
sed -i '1s|/home/root:/bin/sh|/usrdata/root:/bin/bash|' /opt/etc/passwd
fi
fi
if [ ! -f "/opt/sbin/useradd" ]; then
echo "useradd does not exist. Installing shadow-useradd..."
opkg install shadow-useradd
else
echo "useradd already exists. Continuing..."
fi
# Stop and disable existing services/files before installing new ones
echo -e "\033[0;32mRemoving installed AT Socat Bridge services...\033[0m"
systemctl stop at-telnet-daemon > /dev/null 2>&1
systemctl disable at-telnet-daemon > /dev/null 2>&1
systemctl stop socat-smd11 > /dev/null 2>&1
systemctl stop socat-smd11-to-ttyIN > /dev/null 2>&1
systemctl stop socat-smd11-from-ttyIN > /dev/null 2>&1
systemctl stop socat-smd7 > /dev/null 2>&1
systemctl stop socat-smd7-to-ttyIN2 > /dev/null 2>&1
systemctl stop socat-smd7-to-ttyIN > /dev/null 2>&1
systemctl stop socat-smd7-from-ttyIN2 > /dev/null 2>&1
systemctl stop socat-smd7-from-ttyIN > /dev/null 2>&1
rm /lib/systemd/system/at-telnet-daemon.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11-to-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11-from-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-to-ttyIN2.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-to-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-from-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-from-ttyIN2.service > /dev/null 2>&1
systemctl daemon-reload > /dev/null 2>&1
rm -rf "$SOCAT_AT_DIR" > /dev/null 2>&1
# Install service units
echo -e "\033[0;32mInstalling AT Socat Bridge services...\033[0m"
mkdir $SOCAT_AT_DIR
cd $SOCAT_AT_DIR
mkdir $SOCAT_AT_SYSD_DIR
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/socat-at-bridge/socat-armel-static
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/socat-at-bridge/killsmd7bridge
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/socat-at-bridge/atcmd
cd $SOCAT_AT_SYSD_DIR
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/socat-at-bridge/systemd_units/socat-smd11.service
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/socat-at-bridge/systemd_units/socat-smd11-from-ttyIN.service
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/socat-at-bridge/systemd_units/socat-smd11-to-ttyIN.service
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/socat-at-bridge/systemd_units/socat-killsmd7bridge.service
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/socat-at-bridge/systemd_units/socat-smd7-from-ttyIN2.service
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/socat-at-bridge/systemd_units/socat-smd7-to-ttyIN2.service
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/socat-at-bridge/systemd_units/socat-smd7.service
# Set execute permissions
cd $SOCAT_AT_DIR
chmod +x socat-armel-static
chmod +x killsmd7bridge
chmod +x atcmd
# Link new command for AT Commands from the shell
ln -sf $SOCAT_AT_DIR/atcmd /bin
# Install service units
echo -e "\033[0;32mAdding AT Socat Bridge systemd service units...\033[0m"
cp -rf $SOCAT_AT_SYSD_DIR/*.service /lib/systemd/system
ln -sf /lib/systemd/system/socat-killsmd7bridge.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd11.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd11-to-ttyIN.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd11-from-ttyIN.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd7.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd7-to-ttyIN2.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd7-from-ttyIN2.service /lib/systemd/system/multi-user.target.wants/
systemctl daemon-reload
systemctl start socat-smd11
sleep 2s
systemctl start socat-smd11-to-ttyIN
systemctl start socat-smd11-from-ttyIN
echo -e "\033[0;32mAT Socat Bridge service online: smd11 to ttyOUT\033[0m"
systemctl start socat-killsmd7bridge
sleep 1s
systemctl start socat-smd7
sleep 2s
systemctl start socat-smd7-to-ttyIN2
systemctl start socat-smd7-from-ttyIN2
echo -e "\033[0;32mAT Socat Bridge service online: smd7 to ttyOUT2\033[0m"
remount_ro
cd /
echo -e "\033[0;32mAT Socat Bridge services Installed!\033[0m"
if [ ! -f "/usr/bin/curl" ] && [ ! -f "/opt/bin/curl" ]; then
echo "curl does not exist. Installing curl..."
opkg update && opkg install curl
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mFailed to install curl. Please check your internet connection and try again.\e[0m"
exit 1
fi
else
echo "curl already exists. Continuing..."
fi
}
# Function to install Simple Firewall
install_simple_firewall() {
systemctl stop simplefirewall
systemctl stop ttl-override
echo -e "\033[0;32mInstalling/Updating Simple Firewall...\033[0m"
mount -o remount,rw /
mkdir -p "$SIMPLE_FIREWALL_DIR"
mkdir -p "$SIMPLE_FIREWALL_SYSTEMD_DIR"
wget -O "$SIMPLE_FIREWALL_DIR/simplefirewall.sh" https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simplefirewall/simplefirewall.sh
wget -O "$SIMPLE_FIREWALL_DIR/ttl-override" https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simplefirewall/ttl-override
wget -O "$SIMPLE_FIREWALL_DIR/ttlvalue" https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simplefirewall/ttlvalue
chmod +x "$SIMPLE_FIREWALL_DIR/simplefirewall.sh"
chmod +x "$SIMPLE_FIREWALL_DIR/ttl-override"
wget -O "$SIMPLE_FIREWALL_SYSTEMD_DIR/simplefirewall.service" https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simplefirewall/systemd/simplefirewall.service
wget -O "$SIMPLE_FIREWALL_SYSTEMD_DIR/ttl-override.service" https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simplefirewall/systemd/ttl-override.service
cp -rf $SIMPLE_FIREWALL_SYSTEMD_DIR/* /lib/systemd/system
ln -sf "/lib/systemd/system/simplefirewall.service" "/lib/systemd/system/multi-user.target.wants/"
ln -sf "/lib/systemd/system/ttl-override.service" "/lib/systemd/system/multi-user.target.wants/"
#Uninstall Entware if the Users chooses
uninstall_entware() {
echo -e '\033[31mInfo: Starting Entware/OPKG uninstallation...\033[0m'
# Stop services
systemctl stop rc.unslung.service
/opt/etc/init.d/rc.unslung stop
rm /lib/systemd/system/multi-user.target.wants/rc.unslung.service
rm /lib/systemd/system/rc.unslung.service
systemctl stop opt.mount
rm /lib/systemd/system/multi-user.target.wants/start-opt-mount.service
rm /lib/systemd/system/opt.mount
rm /lib/systemd/system/start-opt-mount.service
# Unmount /opt if mounted
mountpoint -q /opt && umount /opt
# Remove Entware installation directory
rm -rf /usrdata/opt
rm -rf /opt
# Reload systemctl daemon
systemctl daemon-reload
systemctl start simplefirewall
systemctl start ttl-override
remount_ro
echo -e "\033[0;32mSimple Firewall installation/update complete.\033[0m"
# Optionally, clean up any modifications to /etc/profile or other system files
# Restore original link to login binary compiled by Quectel
rm /bin/login
ln /bin/login.shadow /bin/login
echo -e '\033[32mInfo: Entware/OPKG has been uninstalled successfully.\033[0m'
}
# function to configure the fetures of simplefirewall
configure_simple_firewall() {
if [ ! -f "$SIMPLE_FIREWALL_SCRIPT" ]; then
echo -e "\033[0;31mSimplefirewall is not installed, would you like to install it?\033[0m"
@@ -306,116 +304,56 @@ configure_simple_firewall() {
echo -e "\e[1;32mFirewall configuration updated.\e[0m"
}
set_simpleadmin_passwd(){
ensure_entware_installed
opkg update
opkg install libaprutil
wget -O /usrdata/root/bin/htpasswd $GITROOT/simpleadmin/htpasswd && chmod +x /usrdata/root/bin/htpasswd
wget -O /usrdata/root/bin/simplepasswd $GITROOT/simpleadmin/simplepasswd && chmod +x /usrdata/root/bin/simplepasswd
echo -e "\e[1;32mTo change your simpleadmin (admin) password in the future...\e[0m"
echo -e "\e[1;32mIn the console type simplepasswd and press enter\e[0m"
/usrdata/root/bin/simplepasswd
}
set_root_passwd() {
echo -e "\e[1;31mPlease set the root/console password.\e[0m"
/opt/bin/passwd
}
# Function to install/update Simple Admin
install_simple_admin() {
while true; do
echo -e "\e[1;32mWhat version of Simple Admin do you want to install? This will start a webserver on port 8080\e[0m"
echo -e "\e[1;32m1) Full Install\e[0m"
echo -e "\e[1;34m2) No AT Commands, List only\e[0m"
echo -e "\e[1;33m3) TTL Only\e[0m"
echo -e "\e[1;31m4) Install Test Build (work in progress/not ready yet)\e[0m"
echo -e "\e[0;33m5) Return to Main Menu\e[0m"
echo -e "\e[1;32mSelect your choice: \e[0m"
read choice
case $choice in
1)
install_update_at_socat
install_simple_firewall
remount_rw
cd $TMP_DIR
wget $GITHUB_SIMPADMIN_FULL_URL -O simpleadminfull.zip
unzip -o simpleadminfull.zip
cp -Rf quectel-rgmii-toolkit-simpleadminfull/simpleadmin/ $USRDATA_DIR
chmod +x $SIMPLE_ADMIN_DIR/scripts/*
chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/*
cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system
systemctl daemon-reload
ln -sf /lib/systemd/system/simpleadmin_httpd.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/simpleadmin_generate_status.service /lib/systemd/system/multi-user.target.wants/
systemctl start simpleadmin_generate_status
systemctl start simpleadmin_httpd
remount_ro
echo "Cleaning up..."
rm /tmp/simpleadminfull.zip
rm -rf /tmp/quectel-rgmii-toolkit-simpleadminfull/
break
;;
2)
install_update_at_socat
install_simple_firewall
remount_rw
cd $TMP_DIR
wget $GITHUB_SIMPADMIN_NOCMD_URL -O simpleadminnoatcmds.zip
unzip -o simpleadminnoatcmds.zip
cp -Rf quectel-rgmii-toolkit-simpleadminnoatcmds/simpleadmin/ $USRDATA_DIR
chmod +x $SIMPLE_ADMIN_DIR/scripts/*
chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/*
cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system
systemctl daemon-reload
ln -sf /lib/systemd/system/simpleadmin_httpd.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/simpleadmin_generate_status.service /lib/systemd/system/multi-user.target.wants/
systemctl start simpleadmin_generate_status
systemctl start simpleadmin_httpd
remount_ro
echo "Cleaning up..."
rm /tmp/simpleadminnoatcmds.zip
rm -rf /tmp/quectel-rgmii-toolkit-simpleadminnoatcmds/
break
;;
3)
install_simple_firewall
remount_rw
cd $TMP_DIR
wget $GITHUB_SIMPADMIN_TTL_URL -O simpleadminttlonly.zip
unzip -o simpleadminttlonly.zip
cp -Rf quectel-rgmii-toolkit-simpleadminttlonly/simpleadmin/ $USRDATA_DIR
chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/*
cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system
systemctl daemon-reload
ln -sf /lib/systemd/system/simpleadmin_httpd.service /lib/systemd/system/multi-user.target.wants/
systemctl start simpleadmin_httpd
remount_ro
echo "Cleaning up..."
rm /tmp/simpleadminttlonly.zip
rm -rf /tmp/quectel-rgmii-toolkit-simpleadminttlonly/
break
;;
4)
install_update_at_socat
install_simple_firewall
remount_rw
cd $TMP_DIR
wget $GITHUB_SIMPADMIN_TEST_URL -O simpleadmintest.zip
unzip -o simpleadmintest.zip
cp -Rf quectel-rgmii-toolkit-simpleadmintest/simpleadmin/ $USRDATA_DIR
chmod +x $SIMPLE_ADMIN_DIR/scripts/*
chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/*
cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system
systemctl daemon-reload
ln -sf /lib/systemd/system/simpleadmin_httpd.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/simpleadmin_generate_status.service /lib/systemd/system/multi-user.target.wants/
systemctl start simpleadmin_generate_status
systemctl start simpleadmin_httpd
remount_ro
break
;;
5)
echo "Returning to main menu..."
break
;;
*)
echo "Invalid choice. Please try again."
;;
esac
done
echo -e "\e[1;32mInstalling Simpleadmin 2.0\e[0m"
ensure_entware_installed
echo -e "\e[1;31m2) Installing Simpleadmin 2.0\e[0m"
mkdir /usrdata/simpleupdates > /dev/null 2>&1
mkdir /usrdata/simpleupdates/scripts > /dev/null 2>&1
wget -O /usrdata/simpleupdates/scripts/update_socat-at-bridge.sh $GITROOT/simpleupdates/scripts/update_socat-at-bridge.sh && chmod +x /usrdata/simpleupdates/scripts/update_socat-at-bridge.sh
echo -e "\e[1;32mInstalling/updating dependency: socat-at-bridge\e[0m"
echo -e "\e[1;32mPlease Wait....\e[0m"
/usrdata/simpleupdates/scripts/update_socat-at-bridge.sh
echo -e "\e[1;32m Dependency: socat-at-bridge has been updated/installed.\e[0m"
sleep 1
wget -O /usrdata/simpleupdates/scripts/update_simplefirewall.sh $GITROOT/simpleupdates/scripts/update_simplefirewall.sh && chmod +x /usrdata/simpleupdates/scripts/update_simplefirewall.sh
echo -e "\e[1;32mInstalling/updating dependency: simplefirewall\e[0m"
echo -e "\e[1;32mPlease Wait....\e[0m"
/usrdata/simpleupdates/scripts/update_simplefirewall.sh
echo -e "\e[1;32m Dependency: simplefirewall has been updated/installed.\e[0m"
sleep 1
set_simpleadmin_passwd
wget -O /usrdata/simpleupdates/scripts/update_simpleadmin.sh $GITROOT/simpleupdates/scripts/update_simpleadmin.sh && chmod +x /usrdata/simpleupdates/scripts/update_simpleadmin.sh
echo -e "\e[1;32mInstalling/updating: Simpleadmin content\e[0m"
echo -e "\e[1;32mPlease Wait....\e[0m"
/usrdata/simpleupdates/scripts/update_simpleadmin.sh
echo -e "\e[1;32mSimpleadmin content has been updated/installed.\e[0m"
sleep 1
break
}
# Function to Uninstall Simpleadmin and dependencies
uninstall_simpleadmin_components() {
echo -e "\e[1;32mStarting the uninstallation process for Simpleadmin components.\e[0m"
echo -e "\e[1;32mNote: Uninstalling certain components may affect the functionality of others.\e[0m"
echo -e "\e[1;36mIf you are upgrading from an older version of the toolkit uninstall/say yes to all everything.\e[0m"
remount_rw
# Uninstall Simple Firewall
@@ -443,49 +381,67 @@ uninstall_simpleadmin_components() {
read -p "Enter your choice (1 or 2): " choice_socat_at_bridge
if [ "$choice_socat_at_bridge" -eq 1 ]; then
echo -e "\033[0;32mRemoving installed AT Socat Bridge services...\033[0m"
systemctl stop at-telnet-daemon > /dev/null 2>&1
systemctl disable at-telnet-daemon > /dev/null 2>&1
systemctl stop socat-smd11 > /dev/null 2>&1
systemctl stop socat-smd11-to-ttyIN > /dev/null 2>&1
systemctl stop socat-smd11-from-ttyIN > /dev/null 2>&1
systemctl stop socat-smd7 > /dev/null 2>&1
systemctl stop socat-smd7-to-ttyIN2 > /dev/null 2>&1
systemctl stop socat-smd7-to-ttyIN > /dev/null 2>&1
systemctl stop socat-smd7-from-ttyIN2 > /dev/null 2>&1
systemctl stop socat-smd7-from-ttyIN > /dev/null 2>&1
rm /lib/systemd/system/at-telnet-daemon.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11-to-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11-from-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-to-ttyIN2.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-to-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-from-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-from-ttyIN2.service > /dev/null 2>&1
systemctl daemon-reload > /dev/null 2>&1
rm -rf "$SOCAT_AT_DIR" > /dev/null 2>&1
rm -rf "$SOCAT_AT_DIR" > /dev/null 2>&1
rm -rf "/usrdata/micropython" > /dev/null 2>&1
rm -rf "/usrdata/at-telnet" > /dev/null 2>&1
echo -e "\033[0;32mAT Socat Bridge services removed!...\033[0m"
systemctl stop at-telnet-daemon > /dev/null 2>&1
systemctl disable at-telnet-daemon > /dev/null 2>&1
systemctl stop socat-smd11 > /dev/null 2>&1
systemctl stop socat-smd11-to-ttyIN > /dev/null 2>&1
systemctl stop socat-smd11-from-ttyIN > /dev/null 2>&1
systemctl stop socat-smd7 > /dev/null 2>&1
systemctl stop socat-smd7-to-ttyIN2 > /dev/null 2>&1
systemctl stop socat-smd7-to-ttyIN > /dev/null 2>&1
systemctl stop socat-smd7-from-ttyIN2 > /dev/null 2>&1
systemctl stop socat-smd7-from-ttyIN > /dev/null 2>&1
rm /lib/systemd/system/at-telnet-daemon.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11-to-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11-from-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-to-ttyIN2.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-to-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-from-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-from-ttyIN2.service > /dev/null 2>&1
systemctl daemon-reload > /dev/null 2>&1
rm -rf "$SOCAT_AT_DIR" > /dev/null 2>&1
rm -rf "$SOCAT_AT_DIR" > /dev/null 2>&1
rm -rf "/usrdata/micropython" > /dev/null 2>&1
rm -rf "/usrdata/at-telnet" > /dev/null 2>&1
echo -e "\033[0;32mAT Socat Bridge services removed!...\033[0m"
fi
# Uninstall the rest of Simpleadmin
echo -e "\e[1;32mDo you want to uninstall the rest of Simpleadmin?\e[0m"
# Uninstall ttyd
echo -e "\e[1;32mDo you want to uninstall ttyd (simpleadmin console)?\e[0m"
echo -e "\e[1;31mWarning: Do not uninstall if you are currently using ttyd to do this!!!\e[0m"
echo -e "\e[1;32m1) Yes\e[0m"
echo -e "\e[1;31m2) No\e[0m"
read -p "Enter your choice (1 or 2): " choice_simpleadmin
if [ "$choice_simpleadmin" -eq 1 ]; then
echo "Uninstalling the rest of Simpleadmin..."
systemctl stop simpleadmin_httpd
systemctl stop simpleadmin_generate_status
rm -f /lib/systemd/system/simpleadmin_httpd.service
rm -f /lib/systemd/system/simpleadmin_generate_status.service
systemctl daemon-reload
rm -rf "$SIMPLE_ADMIN_DIR"
echo "The rest of Simpleadmin uninstalled."
echo -e "\e[1;34mUninstalling ttyd...\e[0m"
systemctl stop ttyd
rm -rf /usrdata/ttyd
rm /lib/systemd/system/ttyd.service
rm /lib/systemd/system/multi-user.target.wants/ttyd.service
rm /bin/ttyd
echo -e "\e[1;32mttyd has been uninstalled.\e[0m"
fi
echo "Uninstalling the rest of Simpleadmin..."
# Check if Lighttpd service is installed and remove it if present
if [ -f "/lib/systemd/system/lighttpd.service" ]; then
echo "Lighttpd detected, uninstalling Lighttpd and its modules..."
systemctl stop lighttpd
opkg --force-remove --force-removal-of-dependent-packages remove lighttpd-mod-authn_file lighttpd-mod-auth lighttpd-mod-cgi lighttpd-mod-openssl lighttpd-mod-proxy lighttpd
rm -rf $LIGHTTPD_DIR
fi
systemctl stop simpleadmin_generate_status
systemctl stop simpleadmin_httpd
rm -f /lib/systemd/system/simpleadmin_httpd.service
rm -f /lib/systemd/system/simpleadmin_generate_status.service
systemctl daemon-reload
rm -rf "$SIMPLE_ADMIN_DIR"
echo "The rest of Simpleadmin and Lighttpd (if present) uninstalled."
remount_ro
fi
echo "Uninstallation process completed."
}
@@ -494,13 +450,13 @@ uninstall_simpleadmin_components() {
tailscale_menu() {
while true; do
echo -e "\e[1;32mTailscale Menu\e[0m"
echo -e "\e[1;32m1) Install/Update/Remove Tailscale\e[0m"
echo -e "\e[1;32m1) Install/Update Tailscale\e[0m"
echo -e "\e[1;36m2) Configure Tailscale\e[0m"
echo -e "\e[1;31m3) Return to Main Menu\e[0m"
read -p "Enter your choice: " tailscale_choice
case $tailscale_choice in
1) install_update_remove_tailscale;;
1) install_update_tailscale;;
2) configure_tailscale;;
3) break;;
*) echo "Invalid option";;
@@ -509,62 +465,17 @@ tailscale_menu() {
}
# Function to install, update, or remove Tailscale
install_update_remove_tailscale() {
if [ -d "$TAILSCALE_DIR" ]; then
echo "Tailscale is already installed."
echo "1) Update Tailscale"
echo "2) Remove Tailscale"
read -p "Enter your choice: " tailscale_update_remove_choice
case $tailscale_update_remove_choice in
1)
echo "Updating Tailscale..."
/usrdata/tailscale/tailscale update
;;
2)
echo "Removing Tailscale..."
remount_rw
$TAILSCALE_DIR/tailscale down
$TAILSCALE_DIR/tailscale logout
systemctl stop tailscaled
rm -f /lib/systemd/system/tailscaled.service
systemctl daemon-reload
rm -rf $TAILSCALE_DIR
remount_ro
echo "Tailscale removed successfully."
;;
*)
echo "Invalid option";;
esac
else
echo "Installing Tailscale..."
remount_rw
echo "Creating /usrdata/tailscale/"
mkdir $TAILSCALE_DIR
mkdir $TAILSCALE_SYSD_DIR
cd $TAILSCALE_DIR
echo "Downloading binary: /usrdata/tailscale/tailscaled"
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/tailscale/tailscaled
echo "Downloading binary: /usrdata/tailscale/tailscale"
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/tailscale/tailscale
echo "Downloading systemd files..."
cd $TAILSCALE_SYSD_DIR
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/tailscale/systemd/tailscaled.service
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/tailscale/systemd/tailscaled.defaults
sleep 2s
echo "Setting Permissions..."
chmod +x /usrdata/tailscale/tailscaled
chmod +x /usrdata/tailscale/tailscale
echo "Copy systemd units..."
cp -rf /usrdata/tailscale/systemd/* /lib/systemd/system
ln -sf /lib/systemd/system/tailscaled.service /lib/systemd/system/multi-user.target.wants/
systemctl daemon-reload
echo "Starting Tailscaled..."
systemctl start tailscaled
cd /
remount_ro
echo "Tailscale installed successfully."
fi
install_update_tailscale() {
echo -e "\e[1;31m2) Installing tailscale from the $GITTREE branch\e[0m"
ensure_entware_installed
mkdir /usrdata/simpleupdates > /dev/null 2>&1
mkdir /usrdata/simpleupdates/scripts > /dev/null 2>&1
wget -O /usrdata/simpleupdates/scripts/update_tailscale.sh $GITROOT/simpleupdates/scripts/update_tailscale.sh && chmod +x /usrdata/simpleupdates/scripts/update_tailscale.sh
echo -e "\e[1;32mInstalling/updating: Tailscale\e[0m"
echo -e "\e[1;32mPlease Wait....\e[0m"
remount_rw
/usrdata/simpleupdates/scripts/update_tailscale.sh
echo -e "\e[1;32m Tailscale has been updated/installed.\e[0m"
}
# Function to Configure Tailscale
@@ -585,8 +496,8 @@ configure_tailscale() {
1)
remount_rw
cd /lib/systemd/system/
wget -O tailscale-webui.service https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/tailscale/systemd/tailscale-webui.service
wget -O tailscale-webui-trigger.service https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/main/tailscale/systemd/tailscale-webui-trigger.service
wget -O tailscale-webui.service $GITROOT/tailscale/systemd/tailscale-webui.service
wget -O tailscale-webui-trigger.service $GITROOT/tailscale/systemd/tailscale-webui-trigger.service
ln -sf /lib/systemd/system/tailscale-webui-trigger.service /lib/systemd/system/multi-user.target.wants/
systemctl daemon-reload
echo "Tailscale Web UI Enabled"
@@ -608,7 +519,7 @@ configure_tailscale() {
remount_ro
;;
3) $TAILSCALE_DIR/tailscale up --accept-dns=false --reset;;
4) $TAILSCALE_DIR/tailscale up --ssh --accept-dns=false --reset;;
4) $TAILSCALE_DIR/tailscale up --ssh --accept-dns=false --reset;;
5) $TAILSCALE_DIR/tailscale up --accept-dns=false --reset;;
6) $TAILSCALE_DIR/tailscale down;;
7) $TAILSCALE_DIR/tailscale logout;;
@@ -795,61 +706,61 @@ WantedBy=multi-user.target" > "$cfun_service_path"
fi
}
# Function for TTYd install
install_ttyd() {
echo -e "\e[1;34mStarting ttyd installation process...\e[0m"
if [ ! -f "/opt/bin/opkg" ]; then
echo -e "\e[1;32mInstalling Entware/OPKG\e[0m"
cd /tmp && wget -O installentware.sh "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/installentware.sh" && chmod +x installentware.sh && ./installentware.sh
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mEntware/OPKG installation failed. Please check your internet connection or the repository URL.\e[0m"
exit 1
fi
cd /
else
echo -e "\e[1;32mEntware/OPKG is already installed.\e[0m"
install_sshd() {
if [ -d "/usrdata/sshd" ]; then
echo -e "\e[1;31mSSHD is currently installed.\e[0m"
echo -e "Do you want to update or uninstall?"
echo -e "1.) Update"
echo -e "2.) Uninstall"
read -p "Select an option (1 or 2): " sshd_choice
case $sshd_choice in
1)
echo -e "\e[1;31m2) Installing sshd from the $GITTREE branch\e[0m"
;;
2)
echo -e "\e[1;31mUninstalling SSHD...\e[0m"
systemctl stop sshd
rm /lib/systemd/system/sshd.service
opkg remove openssh-server-pam
echo -e "\e[1;32mSSHD has been uninstalled successfully.\e[0m"
return 0
;;
*)
echo -e "\e[1;31mInvalid option. Please select 1 or 2.\e[0m"
return 1
;;
esac
fi
mount -o remount,rw /
opkg update && opkg install shadow-login shadow-passwd
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mPackage installation failed. Please check your internet connection and try again.\e[0m"
exit 1
fi
# Replacing the login and passwd binaries
rm /opt/etc/shadow
cp /etc/shadow /opt/etc/
rm /bin/login /usr/bin/passwd
ln -sf /opt/bin/login /bin
ln -sf /opt/bin/passwd /usr/bin/
echo -e "\e[1;31mPlease set your system login password.\e[0m"
/usr/bin/passwd
# Setting up ttyd
mkdir -p /usrdata/ttyd/scripts /usrdata/ttyd/systemd
cd /usrdata/ttyd/
wget -O ttyd "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/ttyd/ttyd" && chmod +x ttyd
wget -O scripts/ttyd.bash "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/ttyd/scripts/ttyd.bash" && chmod +x scripts/ttyd.bash
wget -O systemd/ttyd.service "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/ttyd/systemd/ttyd.service"
cp systemd/ttyd.service /lib/systemd/system/
ln -sf /lib/systemd/system/ttyd.service /etc/systemd/system/multi-user.target.wants/
# Enabling and starting ttyd service
systemctl daemon-reload
systemctl enable ttyd
systemctl start ttyd
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mFailed to start ttyd service. Please check the systemd service file and ttyd binary.\e[0m"
exit 1
fi
echo -e "\e[1;32mInstall Complete! ttyd server is up on port 443. Note: No TLS/SSL enabled yet.\e[0m"
# Proceed with installation or updating if not uninstalling
ensure_entware_installed
mkdir /usrdata/simpleupdates > /dev/null 2>&1
mkdir /usrdata/simpleupdates/scripts > /dev/null 2>&1
wget -O /usrdata/simpleupdates/scripts/update_sshd.sh $GITROOT/simpleupdates/scripts/update_sshd.sh && chmod +x /usrdata/simpleupdates/scripts/update_sshd.sh
echo -e "\e[1;32mInstalling/updating: SSHd\e[0m"
echo -e "\e[1;32mPlease Wait....\e[0m"
/usrdata/simpleupdates/scripts/update_sshd.sh
echo -e "\e[1;32m SSHd has been updated/installed.\e[0m"
}
# Main menu
ARCH=$(uname -a)
if echo "$ARCH" | grep -q "aarch64"; then
cd /tmp && wget -O RM55x_rcPCIe_toolkit.sh https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/SDXPINN/RM55x_rcPCIe_toolkit.sh && chmod +x RM55x_rcPCIe_toolkit.sh && ./RM55x_rcPCIe_toolkit.sh && cd /
exit 0
elif echo "$ARCH" | grep -q "armv7l"; then
# Continue if architecture is armv7l
echo "Architecture is armv7l, continuing..."
else
uname -a
echo "Unsupported architecture."
exit 1
fi
while true; do
echo " .%+: "
echo " .*@@@-. "
@@ -918,14 +829,19 @@ echo " :+##+. "
echo "Select an option:"
echo -e "\e[0m"
echo -e "\e[96m1) Send AT Commands\e[0m" # Cyan
echo -e "\e[93m2) Install/Update/Uninstall Simple Admin\e[0m" # Yellow
echo -e "\e[95m3) Simple Firewall Management\e[0m" # Light Purple
echo -e "\e[94m4) Tailscale Management\e[0m" # Light Blue
echo -e "\e[92m5) Install/Change or remove Daily Reboot Timer\e[0m" # Light Green
echo -e "\e[91m6) Install/Uninstall CFUN 0 Fix\e[0m" # Light Red
echo -e "\e[96m7) Install Entware/OPKG (BETA/Advanced)\e[0m" # Cyan (repeated color for additional options)
echo -e "\e[96m8) Install TTYd (BETA,443,No TLS/SSL)\e[0m" # Cyan
echo -e "\e[93m9) Exit\e[0m" # Yellow (repeated color for exit option)
echo -e "\e[93m2) Install Simple Admin\e[0m" # Yellow
echo -e "\e[95m3) Set Simpleadmin (admin) password\e[0m" # Light Purple
echo -e "\e[94m4) Set Console/ttyd (root) password\e[0m" # Light Blue
echo -e "\e[91m5) Uninstall Simple Admin\e[0m" # Light Red
echo -e "\e[95m6) Simple Firewall Management\e[0m" # Light Purple
echo -e "\e[94m7) Tailscale Management\e[0m" # Light Blue
echo -e "\e[92m8) Install/Change or remove Daily Reboot Timer\e[0m" # Light Green
echo -e "\e[96m9) Install/Uninstall CFUN 0 Fix\e[0m" # Cyan (repeated color for additional options)
echo -e "\e[91m10) Uninstall Entware/OPKG\e[0m" # Light Red
echo -e "\e[92m11) Install Speedtest.net CLI app (speedtest command)\e[0m" # Light Green
echo -e "\e[92m12) Install Fast.com CLI app (fast command)(tops out at 40Mbps)\e[0m" # Light Green
echo -e "\e[92m13) Install OpenSSH Server\e[0m" # Light Green
echo -e "\e[93m14) Exit\e[0m" # Yellow (repeated color for exit option)
read -p "Enter your choice: " choice
case $choice in
@@ -933,48 +849,97 @@ echo " :+##+. "
send_at_commands
;;
2)
if is_simple_admin_installed; then
echo -e "\e[1;31mSimple Admin is already installed. It must be removed first\e[0m"
echo -e "\e[1;32m1) Remove\e[0m" # Green
echo -e "\e[0;33m2) Return to main menu\e[0m"
read -p "Enter your choice: " simple_admin_choice
case $simple_admin_choice in
1) uninstall_simpleadmin_components;;
2) break;;
*) echo -e "\e[1;31mInvalid option\e[0m";;
esac
else
echo -e "\e[1;32mInstalling Simple Admin...\e[0m"
install_simple_admin
fi
install_simple_admin
;;
3)
configure_simple_firewall
3) set_simpleadmin_passwd
;;
4)
set_root_passwd
;;
5)
uninstall_simpleadmin_components
;;
6)
configure_simple_firewall
;;
4)
tailscale_menu
;;
5)
manage_reboot_timer
7)
tailscale_menu
;;
8)
manage_reboot_timer
;;
6)
manage_cfun_fix
9)
manage_cfun_fix
;;
7)
echo -e "\e[1;32mInstalling Entware/OPKG\e[0m"
cd /tmp && wget -O installentware.sh https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/installentware.sh && chmod +x installentware.sh && ./installentware.sh
10)
echo -e "\033[31mAre you sure you want to uninstall entware?\033[0m"
echo -e "\033[31m1) Yes\033[0m"
echo -e "\033[31m2) No\033[0m"
read -p "Select an option (1 or 2): " user_choice
case $user_choice in
1)
# If yes, uninstall existing entware
echo -e "\033[31mUninstalling existing entware...\033[0m"
uninstall_entware # Assuming uninstall_entware is a defined function or command
echo -e "\033[31mEntware has been uninstalled.\033[0m"
;;
2)
# If no, exit the script
echo -e "\033[31mUninstallation cancelled.\033[0m"
exit # Use 'exit' to terminate the script outside a loop
;;
*)
# Handle invalid input
echo -e "\033[31mInvalid option. Please select 1 or 2.\033[0m"
;;
esac
;;
11)
ensure_entware_installed
echo -e "\e[1;32mInstalling Speedtest.net CLI (speedtest command)\e[0m"
remount_rw
mkdir /usrdata/root
mkdir /usrdata/root/bin
cd /usrdata/root/bin
wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-armhf.tgz
tar -xzf ookla-speedtest-1.2.0-linux-armhf.tgz
rm ookla-speedtest-1.2.0-linux-armhf.tgz
rm speedtest.md
cd /
ln -sf /usrdata/root/bin/speedtest /bin
remount_ro
echo -e "\e[1;32mSpeedtest CLI (speedtest command) installed!!\e[0m"
echo -e "\e[1;32mTry running the command 'speedtest'\e[0m"
echo -e "\e[1;32mNote that it will not work unless you login to the root account first\e[0m"
echo -e "\e[1;32mNormaly only an issue in adb, ttyd and ssh you are forced to login\e[0m"
echo -e "\e[1;32mIf in adb just type login and then try to run the speedtest command\e[0m"
;;
8)
install_ttyd
;;
9)
echo -e "\e[1;32mGoodbye!\e[0m"
12)
echo -e "\e[1;32mInstalling fast.com CLI (fast command)\e[0m"
remount_rw
mkdir /usrdata/root
mkdir /usrdata/root/bin
cd /usrdata/root/bin
wget -O fast https://github.com/ddo/fast/releases/download/v0.0.4/fast_linux_arm && chmod +x fast
cd /
ln -sf /usrdata/root/bin/fast /bin
remount_ro
echo -e "\e[1;32mFast.com CLI (speedtest command) installed!!\e[0m"
echo -e "\e[1;32mTry running the command 'fast'\e[0m"
echo -e "\e[1;32mThe fast.com test tops out at 40Mbps on the modem\e[0m"
;;
13)
install_sshd
;;
14)
echo -e "\e[1;32mGoodbye!\e[0m"
break
;;
*)
echo -e "\e[1;31mInvalid option\e[0m"
*)
echo -e "\e[1;31mInvalid option\e[0m"
;;
esac
done

114
old/download Normal file
View File

@@ -0,0 +1,114 @@
#!/bin/sh
# Determine the absolute path of the script
SCRIPT_PATH=$(realpath "$0")
download() {
if [ "$1" = "github" ]; then
download_github_directory "$2" "$3"
else
download_file "$1" "$2"
fi
}
download_file() {
url="$1"
output="${2:-$(basename "$url")}"
echo "Attempting to download file from URL: $url"
echo "Saving to output: $output"
# Ensure the output directory exists
mkdir -p "$(dirname "$output")"
if command -v curl > /dev/null 2>&1; then
curl -L -o "$output" "$url"
elif command -v wget > /dev/null 2>&1; then
wget -O "$output" "$url"
else
echo "Error: Neither curl nor wget is available."
exit 1
fi
}
download_github_directory() {
github_url="$1"
output_dir="${2:-.}" # Set output directory to the provided parameter or current directory
repo_info=$(echo "$github_url" | sed -n 's|https://github.com/\([^/]*\)/\([^/]*\)/tree/\([^/]*\)/\(.*\)|\1 \2 \3 \4|p')
owner=$(echo "$repo_info" | cut -d' ' -f1)
repo=$(echo "$repo_info" | cut -d' ' -f2)
branch=$(echo "$repo_info" | cut -d' ' -f3)
directory=$(echo "$repo_info" | cut -d' ' -f4)
echo "Owner: $owner, Repo: $repo, Branch: $branch, Directory: $directory"
if [ -z "$owner" ] || [ -z "$repo" ] || [ -z "$branch" ] || [ -z "$directory" ]; then
echo "Error: Invalid GitHub URL."
exit 1
fi
echo "Output directory set to: $output_dir"
api_url="https://api.github.com/repos/$owner/$repo/contents/$directory?ref=$branch"
echo "Fetching directory contents from API URL: $api_url"
if command -v curl > /dev/null 2>&1; then
contents=$(curl -s -H "Accept: application/vnd.github.v3+json" "$api_url")
elif command -v wget > /dev/null 2>&1; then
contents=$(wget -qO- --header="Accept: application/vnd.github.v3+json" "$api_url")
else
echo "Error: Neither curl nor wget is available."
exit 1
fi
echo "API Response Contents:"
echo "$contents"
# Use awk to parse JSON content and prepare commands
echo "$contents" | awk -v output_dir="$output_dir" -v owner="$owner" -v repo="$repo" -v branch="$branch" -v script_path="$SCRIPT_PATH" '
BEGIN {
RS="},"; FS=","; # Set Record Separator to "}," and Field Separator to ","
}
/"type": "file"/ {
file_path = ""; download_url = "";
for (i = 1; i <= NF; i++) {
if ($i ~ /"path": "/) {
gsub(/.*"path": "/, "", $i);
gsub(/".*/, "", $i);
file_path = $i;
}
if ($i ~ /"download_url": "/) {
gsub(/.*"download_url": "/, "", $i);
gsub(/".*/, "", $i);
download_url = $i;
}
}
if (file_path && download_url) {
output_file_path = output_dir "/" file_path;
print "Calling download_file for:", download_url, "to", output_file_path;
system("'"$SCRIPT_PATH"'" " \"" download_url "\" \"" output_file_path "\"");
}
}
/"type": "dir"/ {
sub_dir = "";
for (i = 1; i <= NF; i++) {
if ($i ~ /"path": "/) {
gsub(/.*"path": "/, "", $i);
gsub(/".*/, "", $i);
sub_dir = $i;
}
}
if (sub_dir) {
print "Calling download_github_directory for sub-directory:", sub_dir;
system("'"$SCRIPT_PATH"'" " github \"https://github.com/" owner "/" repo "/tree/" branch "/" sub_dir "\" \"" output_dir "\"");
}
}'
}
if [ "$#" -eq 0 ]; then
echo "Usage: download <type> <url> [output_directory]"
exit 1
else
download "$@"
fi

View File

@@ -1,7 +1,8 @@
#!/bin/sh
# Modified by iamromulan to set up a proper entware environment for Quectel RM5xx series m.2 modems
TYPE='generic'
#|---------|-----------------|
#| TARGET | Quectel Modem |
#| ARCH | armv7sf-k3.2 |
#| LOADER | ld-linux.so.3 |
#| GLIBC | 2.27 |
@@ -16,64 +17,6 @@ PRE_OPKG_PATH=$(which opkg)
# Remount filesystem as read-write
mount -o remount,rw /
uninstall_entware() {
echo -e '\033[31mInfo: Starting Entware/OPKG uninstallation...\033[0m'
# Stop services
systemctl stop rc.unslung.service
/opt/etc/init.d/rc.unslung stop
rm /lib/systemd/system/multi-user.target.wants/rc.unslung.service
rm /lib/systemd/system/rc.unslung.service
systemctl stop opt.mount
rm /lib/systemd/system/multi-user.target.wants/start-opt-mount.service
rm /lib/systemd/system/opt.mount
rm /lib/systemd/system/start-opt-mount.service
# Unmount /opt if mounted
mountpoint -q /opt && umount /opt
# Remove Entware installation directory
rm -rf /usrdata/opt
rm -rf /opt
# Reload systemctl daemon
systemctl daemon-reload
# Optionally, clean up any modifications to /etc/profile or other system files
# This step depends on the specific changes made by the user or the installation script
echo -e '\033[32mInfo: Entware/OPKG has been uninstalled successfully.\033[0m'
}
# Check if /opt exists
if [ -d /opt ]; then
echo -e "\033[32mDo you want to uninstall Entware/OPKG first? It is already installed.\033[0m"
echo -e "\033[32m1) Yes\033[0m"
echo -e "\033[32m2) No\033[0m"
echo -e "\033[32m3) Cancel\033[0m"
read -p "Select an option: " choice
case $choice in
1)
# Call the uninstall function
uninstall_entware
exit 0
;;
2)
# Continue with the script
echo "Continuing with the script..."
;;
3)
echo "Canceling. Exiting script."
exit 0
;;
*)
echo "Invalid option. Please select 1, 2, or 3."
;;
esac
fi
create_opt_mount() {
# Bind /usrdata/opt to /opt
echo -e '\033[32mInfo: Setting up /opt mount to /usrdata/opt...\033[0m'
@@ -114,32 +57,13 @@ EOF
}
if [ -n "$PRE_OPKG_PATH" ]; then
while true; do
echo -e "\033[32mopkg already exists at: $PRE_OPKG_PATH\033[0m"
echo -e "\033[32mDo you want to rename it to opkg_old?\033[0m"
echo -e "\033[32m1) Yes (Highly Recommended)\033[0m"
echo -e "\033[32m2) No (The opkg command may not work)\033[0m"
read -p "Select an option (1 or 2): " user_choice
case $user_choice in
1)
mv "$PRE_OPKG_PATH" "${PRE_OPKG_PATH}_old"
echo "Factory/Already existing opkg has been renamed to opkg_old."
break
;;
2)
echo "Proceeding without renaming opkg."
break
;;
*)
echo "Invalid option. Please select 1 or 2."
;;
esac
done
# Automatically rename the existing opkg binary
mv "$PRE_OPKG_PATH" "${PRE_OPKG_PATH}_old"
echo -e "\033[32mFactory/Already existing opkg has been renamed to opkg_old.\033[0m"
else
echo "Info: no existing opkg binary detected, proceeding with installation"
fi
echo -e '\033[32mInfo: Creating /opt mount pointed to /usrdata/opt ...\033[0m'
create_opt_mount
echo -e '\033[32mInfo: Proceeding with main installation ...\033[0m'
@@ -206,9 +130,38 @@ systemctl start rc.unslung.service
echo -e '\033[32mInfo: Congratulations!\033[0m'
echo -e '\033[32mInfo: If there are no errors above then Entware was successfully initialized.\033[0m'
echo -e '\033[32mInfo: Add /opt/bin & /opt/sbin to $PATH variable\033[0m'
echo -e '\033[32mInfo: Run export PATH=/opt/bin:/opt/sbin:$PATH to do it for this session only\033[0m'
echo -e '\033[32mInfo: opkg at /opt/bin will be linked to /bin but any package you install with opkg will not be automatically.\033[0m'
ln -sf /opt/bin/opkg /bin
opkg update
echo -e '\033[32mInfo: Patching Quectel Login Binary\033[0m'
opkg update && opkg install shadow-login shadow-passwd shadow-useradd
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mPackage installation failed. Please check your internet connection and try again.\e[0m"
exit 1
fi
# Replace the login and passwd binaries and set home for root to a writable directory
rm /opt/etc/shadow
rm /opt/etc/passwd
cp /etc/shadow /opt/etc/
cp /etc/passwd /opt/etc
mkdir /usrdata/root
mkdir /usrdata/root/bin
touch /usrdata/root/.profile
echo "# Set PATH for all shells" > /usrdata/root/.profile
echo "export PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin" >> /usrdata/root/.profile
chmod +x /usrdata/root/.profile
sed -i '1s|/home/root:/bin/sh|/usrdata/root:/bin/bash|' /opt/etc/passwd
rm /bin/login /usr/bin/passwd
ln -sf /opt/bin/login /bin
ln -sf /opt/bin/passwd /usr/bin/
ln -sf /opt/bin/useradd /usr/bin/
echo -e "\e[1;31mPlease set the root password.\e[0m"
/usr/bin/passwd
# Install basic and useful utilites
opkg install mc htop dfc lsof
ln -sf /opt/bin/mc /bin
ln -sf /opt/bin/htop /bin
ln -sf /opt/bin/dfc /bin
ln -sf /opt/bin/lsof /bin
# Remount filesystem as read-only
mount -o remount,ro /

105
old/installopkg.sh Normal file
View File

@@ -0,0 +1,105 @@
#!/bin/sh
#|---------|-------------------------|
#| TARGET | SDXLEMUR |
#| ARCH | arm_cortex-a7_neon-vfpv4|
#|---------|-------------------------|
# Based on entware, heavily modified by iamromulan
# This script sets up a custom opkg installation system for the SDXLEMUR platform
# The primary feed for this will be my feed and will be a combo of modified IPK files from multiple sources
# opkg is from entware and expects /opt to exist
# /opt will be setup as an overlay of lower / and upper /usrdata/rootfs-upper
# Most likely several mount binds will be setup at / to point back to /opt the overlay
# The real /lib/systemd will need to be able to be written to so we may bind that within /opt
# In active development; will decide if the entware feed gets re added later
ARCH=arm_cortex-a7_neon-vfpv4
#ARCH=armv7sf-k3.2
PRE_OPKG_PATH=$(which opkg)
URL=https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/development-SDXLEMUR/opkg-feed/installer
# Remount filesystem as read-write
mount -o remount,rw /
# Will need to edit this. Will be an overlay instead of bind mount
# The package sdxlemur-mount-fix will make this run at boot
create_opt_overlay() {
[ ! -d "/opt" ] && mkdir /opt
[ ! -d "/usrdata/rootfs-upper" ] && mkdir /usrdata/rootfs-upper
[ ! -d "/usrdata/rootfs-work" ] && mkdir /usrdata/rootfs-work
mount -t overlay overlay_root -o lowerdir=/,upperdir=/usrdata/rootfs-upper,workdir=/usrdata/rootfs-work /opt
# add additional mount binds and dir
}
# Account for existing opkg binary on the RM502Q-AE
if [ -n "$PRE_OPKG_PATH" ]; then
# Automatically rename the existing opkg binary
mv "$PRE_OPKG_PATH" "${PRE_OPKG_PATH}_old"
echo -e "\033[32mFactory/Already existing opkg has been renamed to opkg_old.\033[0m"
else
echo "Info: no existing opkg binary detected, proceeding with installation"
fi
echo -e '\033[32mInfo: Creating /opt overlayfs with lower / and upper /usrdata/rootfs-upper \033[0m'
create_opt_overlay
echo -e '\033[32mInfo: Proceeding with main installation ...\033[0m'
echo -e '\033[32mInfo: Opkg package manager deployment...\033[0m'
wget $URL/opkg -O /opt/bin/opkg
chmod 755 /opt/bin/opkg
wget $URL/opkg.conf -O /opt/etc/opkg.conf
echo -e '\033[32mInfo: Basic packages installation...\033[0m'
/opt/bin/opkg update
#/opt/bin/opkg install entware-opt #Will revist this and its need
/opt/bin/opkg install sdxlemur-factory-packages
# Fix for multiuser environment
chmod 777 /opt/tmp
echo -e '\033[32mInfo: Add /opt/bin & /opt/sbin to $PATH variable\033[0m'
ln -sf /opt/bin/opkg /bin
echo -e '\033[32mInfo: Patching Quectel Login Binary\033[0m'
opkg update && opkg install shadow-login shadow-passwd shadow-useradd
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mPackage installation failed. Please check your internet connection and try again.\e[0m"
exit 1
fi
# Replace the login and passwd binaries and set home for root to a writable directory
rm /opt/etc/shadow
rm /opt/etc/passwd
cp /etc/shadow /opt/etc/
cp /etc/passwd /opt/etc
mkdir /usrdata/root
mkdir /usrdata/root/bin
touch /usrdata/root/.profile
echo "# Set PATH for all shells" > /usrdata/root/.profile
echo "export PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin" >> /usrdata/root/.profile
chmod +x /usrdata/root/.profile
sed -i '1s|/home/root:/bin/sh|/usrdata/root:/bin/bash|' /opt/etc/passwd
rm /bin/login /usr/bin/passwd
ln -sf /opt/bin/login /bin
ln -sf /opt/bin/passwd /usr/bin/
ln -sf /opt/bin/useradd /usr/bin/
echo -e "\e[1;31mPlease set the root password.\e[0m"
/usr/bin/passwd
# Install basic and useful utilites
opkg install mc htop dfc lsof
ln -sf /opt/bin/mc /bin
ln -sf /opt/bin/htop /bin
ln -sf /opt/bin/dfc /bin
ln -sf /opt/bin/lsof /bin
# Remount filesystem as read-only
mount -o remount,ro /
echo -e '\033[32mInfo: Congratulations!\033[0m'
echo -e '\033[32mInfo: If there are no errors above then Entware was successfully initialized.\033[0m'

1
old/simpleadmin/.rev Normal file
View File

@@ -0,0 +1 @@
2

View File

@@ -0,0 +1,7 @@
#!/bin/bash
#Path
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/usrdata/root/bin
#Post-login execution
/usrdata/simpleadmin/console/menu/start_menu.sh

View File

@@ -0,0 +1,150 @@
#!/bin/bash
CONFIG_FILE="/etc/data/mobileap_cfg.xml"
# Display Messages in Colors
display_random_color() {
local msg="$1"
local colors=(33 34 35 36 37) # ANSI color codes for yellow, blue, magenta, cyan, white
local num_colors=${#colors[@]}
local random_color_index=$(($RANDOM % num_colors)) # Pick a random index from the colors array
echo -e "\033[${colors[$random_color_index]}m$msg\033[0m"
}
display_green() {
echo -e "\033[0;32m$1\033[0m"
}
display_red() {
echo -e "\033[0;31m$1\033[0m"
}
# Check and Install xml binary if not present
check_and_install_xml() {
if [ ! -f "/opt/bin/xml" ]; then
echo "xml binary not found. Attempting to install xmlstarlet..."
opkg update
opkg install xmlstarlet
# Verify installation
if [ ! -f "/opt/bin/xml" ]; then
echo "Failed to install xmlstarlet. Exiting..."
exit 1
fi
fi
echo "xml binary is available."
}
# Edit XML Value
edit_xml_value() {
local node="$1"
local new_value="$2"
/opt/bin/xml ed -L -u "$node" -v "$new_value" "$CONFIG_FILE"
}
# Get Current XML Value
get_current_value() {
/opt/bin/xml sel -t -v "$1" "$CONFIG_FILE"
}
# Enable/Disable Menu
enable_disable_menu() {
local node="$1"
local current_value=$(get_current_value "$node")
echo "Current status: $([ "$current_value" == "1" ] && echo "Enabled" || echo "Disabled")"
echo "1. Enable"
echo "2. Disable"
read -p "Choose an option to toggle (1-2): " choice
local new_value="$([ "$choice" == "1" ] && echo "1" || echo "0")"
edit_xml_value "$node" "$new_value"
display_green "After making changes, please reboot to have them take effect."
}
# Edit Simple Value
edit_simple_value() {
local node="$1"
local description="$2"
local current=$(get_current_value "$node")
echo "Current $description: $current"
read -p "Enter new $description: " new_value
edit_xml_value "$node" "$new_value"
display_green "After making changes, please reboot to have them take effect."
}
# Edit DHCP IP Range
edit_dhcp_range() {
local start_ip=$(get_current_value "//MobileAPLanCfg/DHCPCfg/StartIP")
local end_ip=$(get_current_value "//MobileAPLanCfg/DHCPCfg/EndIP")
echo "Current Start IP: $start_ip"
echo "Current End IP: $end_ip"
read -p "Enter new Start IP: " new_start_ip
read -p "Enter new End IP: " new_end_ip
edit_xml_value "//MobileAPLanCfg/DHCPCfg/StartIP" "$new_start_ip"
edit_xml_value "//MobileAPLanCfg/DHCPCfg/EndIP" "$new_end_ip"
display_green "After making changes, please reboot to have them take effect."
}
# Reboot the system
reboot_system() {
echo "Rebooting system..."
atcmd 'AT+CFUN=1,1' # Ensure this command is correct for your system
echo "System reboot initiated. Good luck."
}
# Main Menu
main_menu() {
while true; do
clear
display_red "Warning, these changes can break access over the network. Know what you are doing, and be prepared to use ADB to fix this just in case."
echo "Configuration Menu"
echo "------------------"
display_green "1. Edit Gateway IPV4 Address"
display_green "2. Edit Gateway URL"
display_green "3. Edit LAN DHCP Start/End Range"
display_green "4. Edit LAN Subnet Mask"
display_green "5. Edit DHCPv6 Base address"
display_green "6. Toggle IPv4 NAT"
display_green "7. Toggle IPv6 NAT"
display_green "8. Toggle DHCP Server"
display_green "9. Toggle DHCPv4"
display_green "10. Toggle DHCPv6"
display_green "11. Toggle WAN Autoconnect"
display_green "12. Toggle WAN AutoReconnect"
display_green "13. Toggle Roaming"
display_green "14. Toggle WAN DNSv4 Passthrough"
display_green "15. Toggle WAN DNSv6 Passthrough"
display_green "16. Toggle IPPT NAT/Ability to access gateway while in IPPT mode"
display_green "17. Toggle UPnP"
display_green "18. Reboot System"
display_green "19. Exit"
echo
read -p "Select an option (1-19): " option
case "$option" in
1) edit_simple_value "//MobileAPLanCfg/APIPAddr" "Gateway IPV4 Address";;
2) edit_simple_value "//MobileAPLanCfg/GatewayURL" "Gateway URL";;
3) edit_dhcp_range;;
4) edit_simple_value "//MobileAPLanCfg/SubNetMask" "LAN Subnet Mask";;
5) edit_simple_value "//MobileAPLanCfg/ULAIPv6BaseAddr" "DHCPv6 Base Address";;
6) enable_disable_menu "//MobileAPNatCfg/IPv4NATDisable";;
7) enable_disable_menu "//MobileAPNatv6Cfg/EnableIPv6NAT";;
8) enable_disable_menu "//MobileAPLanCfg/EnableDHCPServer";;
9) enable_disable_menu "//MobileAPLanCfg/EnableIPV4";;
10) enable_disable_menu "//MobileAPLanCfg/EnableIPV6";;
11) enable_disable_menu "//MobileAPWanCfg/AutoConnect";;
12) enable_disable_menu "//MobileAPWanCfg/ReConnect";;
13) enable_disable_menu "//MobileAPWanCfg/Roaming";;
14) enable_disable_menu "//Dhcpv4Cfg/EnableDhcpv4Dns";;
15) enable_disable_menu "//Dhcpv6Cfg/EnableDhcpv6Dns";;
16) enable_disable_menu "//IPPassthroughFeatureWithNAT";;
17) enable_disable_menu "//MobileAPSrvcCfg/UPnP";;
18) reboot_system;;
19) break;;
*) echo "Invalid option. Please try again.";;
esac
done
}
# Start by checking and installing xml if necessary, then mount filesystem as rw and run the menu
mount -o remount,rw /
check_and_install_xml
main_menu

View File

@@ -0,0 +1,129 @@
#!/bin/bash
SIMPLE_FIREWALL_DIR="/usrdata/simplefirewall"
SIMPLE_FIREWALL_SCRIPT="$SIMPLE_FIREWALL_DIR/simplefirewall.sh"
SIMPLE_FIREWALL_SYSTEMD_DIR="$SIMPLE_FIREWALL_DIR/systemd"
# Display Messages in Colors
display_random_color() {
local msg="$1"
local colors=(33 34 35 36 37) # ANSI color codes for yellow, blue, magenta, cyan, white
local num_colors=${#colors[@]}
local random_color_index=$(($RANDOM % num_colors)) # Pick a random index from the colors array
echo -e "\033[${colors[$random_color_index]}m$msg\033[0m"
}
display_green() {
echo -e "\033[0;32m$1\033[0m"
}
display_red() {
echo -e "\033[0;31m$1\033[0m"
}
set_portblocks() {
current_ports_line=$(grep '^PORTS=' "$SIMPLE_FIREWALL_SCRIPT")
ports=$(echo "$current_ports_line" | cut -d'=' -f2 | tr -d '()' | tr ' ' '\n' | grep -o '[0-9]\+')
echo -e "\e[1;32mCurrent configured ports:\e[0m"
echo "$ports" | awk '{print NR") "$0}'
while true; do
echo -e "\e[1;32mEnter a port number to add/remove, or type 'done' or 'exit' to finish:\e[0m"
read port
if [ "$port" = "done" ] || [ "$port" = "exit" ]; then
if [ "$port" = "exit" ]; then
echo -e "\e[1;31mExiting without making changes...\e[0m"
return
fi
break
elif ! echo "$port" | grep -qE '^[0-9]+$'; then
echo -e "\e[1;31mInvalid input: Please enter a numeric value.\e[0m"
elif echo "$ports" | grep -q "^$port\$"; then
ports=$(echo "$ports" | grep -v "^$port\$")
echo -e "\e[1;32mPort $port removed.\e[0m"
else
ports=$(echo "$ports"; echo "$port" | grep -o '[0-9]\+')
echo -e "\e[1;32mPort $port added.\e[0m"
fi
done
if [ "$port" != "exit" ]; then
new_ports_line="PORTS=($(echo "$ports" | tr '\n' ' '))"
sed -i "s/$current_ports_line/$new_ports_line/" "$SIMPLE_FIREWALL_SCRIPT"
fi
}
set_ttl(){
# TTL configuration code
ttl_value=$(cat /usrdata/simplefirewall/ttlvalue)
if [ "$ttl_value" -eq 0 ]; then
echo -e "\e[1;31mTTL is not set.\e[0m"
else
echo -e "\e[1;32mTTL value is set to $ttl_value.\e[0m"
fi
echo -e "\e[1;31mType 'exit' to cancel.\e[0m"
read -p "What do you want the TTL value to be: " new_ttl_value
if [ "$new_ttl_value" = "exit" ]; then
echo -e "\e[1;31mExiting TTL configuration...\e[0m"
return
elif ! echo "$new_ttl_value" | grep -qE '^[0-9]+$'; then
echo -e "\e[1;31mInvalid input: Please enter a numeric value.\e[0m"
return
else
/usrdata/simplefirewall/ttl-override stop
echo "$new_ttl_value" > /usrdata/simplefirewall/ttlvalue
/usrdata/simplefirewall/ttl-override start
echo -e "\033[0;32mTTL value updated to $new_ttl_value.\033[0m"
fi
}
# function to configure the fetures of simplefirewall
simple_firewall_menu() {
if [ ! -f "$SIMPLE_FIREWALL_SCRIPT" ]; then
display_random_color "Simplefirewall is not installed, would you like to install it?"
display_green "1) Yes"
display_red "2) No"
read -p "Enter your choice (1-2): " install_choice
case $install_choice in
1)
install_simple_firewall
;;
2)
return
;;
*)
display_red "Invalid choice. Please select either 1 or 2."
;;
esac
fi
display_random_color "Configure Simple Firewall:"
display_green "1) Configure incoming port block"
display_green "2) Configure TTL"
display_green "3) Exit to Main Menu"
read -p "Enter your choice (1-2): " menu_choice
case $menu_choice in
1)
set_portblocks
;;
2)
set_ttl
;;
3)
return
;;
*)
echo -e "\e[1;31mInvalid choice. Please select either 1 or 2.\e[0m"
;;
esac
systemctl restart simplefirewall
echo -e "\e[1;32mFirewall configuration updated.\e[0m"
}
# Main execution
mount -o remount,rw /
simple_firewall_menu

View File

@@ -0,0 +1,118 @@
#!/bin/bash
# Define executable files path
MENU_SH=/usrdata/simpleadmin/console/menu
# Display Messages in Colors
display_random_color() {
local msg="$1"
local colors=(33 34 35 36 37) # ANSI color codes for yellow, blue, magenta, cyan, white
local num_colors=${#colors[@]}
local random_color_index=$(($RANDOM % num_colors)) # Pick a random index from the colors array
echo -e "\033[${colors[$random_color_index]}m$msg\033[0m"
}
display_green() {
echo -e "\033[0;32m$1\033[0m"
}
display_red() {
echo -e "\033[0;31m$1\033[0m"
}
# Menus
toolkit_menu() {
while true; do
display_random_color "Run a Toolkit version"
display_green "Select an option:"
echo "------------------"
display_green "1. Get and run the Toolkit"
display_random_color "2. Get and run the Development/unstable Toolkit"
display_random_color "3. Exit (Enter Root Shell)"
echo
read -p "Select an option (1-3): " option
case "$option" in
1) cd /tmp && wget -O RMxxx_rgmii_toolkit.sh https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/SDXLEMUR/RMxxx_rgmii_toolkit.sh && chmod +x RMxxx_rgmii_toolkit.sh && ./RMxxx_rgmii_toolkit.sh && cd / ;;
2) cd /tmp && wget -O RMxxx_rgmii_toolkit.sh https://raw.githubusercontent.com/iamromulan/quectel-rgmii-toolkit/development-SDXLEMUR/RMxxx_rgmii_toolkit.sh && chmod +x RMxxx_rgmii_toolkit.sh && ./RMxxx_rgmii_toolkit.sh && cd / ;;
3) break ;;
*) echo "Invalid option. Please try again." ;;
esac
done
}
apps_menu() {
while true; do
display_random_color "Run a modem App"
display_green "Select an option:"
echo "------------------"
display_random_color "1. Open File Browser/Editor (mc)"
display_random_color "2. View Used/Available space"
display_random_color "3. Open Task Manager/View CPU Load"
display_random_color "4. Run speedtest.net test"
display_random_color "5. Run fast.com test (30Mbps max)"
display_green "6. Go Back"
echo
read -p "Select an option (1-6): " option
case "$option" in
1) mc ;;
2) dfc ;;
3) htop ;;
4) speedtest ;;
5) fast ;;
6) break ;;
*) echo "Invalid option. Please try again." ;;
esac
done
}
settings_menu() {
while true; do
display_random_color "Welcome to" && display_green "iamromulan's" && display_random_color "Simple Console Menu"
display_green "Select an option:"
echo "------------------"
display_green "1. LAN Settings"
display_green "2. simplefirewall settings (TTL and Port Block)"
display_green "3. Change simpleadmin (admin) password"
display_green "4. Change root password (shell/ssh/console)"
display_green "5. Go back"
echo
read -p "Select an option (1-5): " option
case "$option" in
1) $MENU_SH/LAN_settings.sh ;;
2) $MENU_SH/sfirewall_settings.sh ;;
3) simplepasswd ;;
4) passwd ;;
5) break ;;
*) echo "Invalid option. Please try again." ;;
esac
done
}
main_menu() {
while true; do
display_green "Welcome to iamromulan's Simple Console Menu"
display_green "To get back to this from the root shell, just type 'menu'"
display_green "Select an option:"
echo "------------------"
display_random_color "1. Apps"
display_random_color "2. Settings"
display_random_color "3. Toolkit"
display_random_color "4. Exit (Enter Root Shell)"
echo
read -p "Select an option (1-4): " option
case "$option" in
1) apps_menu ;;
2) settings_menu ;;
3) toolkit_menu ;;
4) break ;;
*) echo "Invalid option. Please try again." ;;
esac
done
}
main_menu

View File

@@ -0,0 +1,27 @@
#!/bin/bash
# Define the command to execute when the ethernet port breaks
command_to_execute="/usrdata/socat-at-bridge/atcmd 'AT+CFUN=1,1'"
# Define the monitoring function
watch() {
while true; do
# Extract the last 60 lines of dmesg and count the specific pattern occurrences
count=$(dmesg | tail -60 | grep -e "eth0: cmd = 0xff, should be 0x47" -e "eth0: pci link is down" | grep -c "eth0")
# Check if the count of patterns is 4 or more
if [ "$count" -ge 4 ]; then
echo "Condition met, executing command..."
eval "$command_to_execute"
# Optionally, add a break here if you want the script to stop after executing the command
# break
fi
# Sleep for 3 seconds before checking again
sleep 3
done
}
# Initial delay before starting monitoring
sleep 30
watch

View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Define the hostname or IP address to ping
HOSTNAME="google.com"
# Number of pings to attempt
PING_COUNT=6
# Initialize a counter for successful pings
success_count=0
# Attempt to ping the specified number of times
for i in $(seq 1 $PING_COUNT); do
# Ping the hostname with a timeout of 1 second per ping
if ping -c 1 -W 1 $HOSTNAME &> /dev/null; then
((success_count++))
else
echo "Ping attempt $i failed."
fi
done
# Check if all pings failed
if [ $success_count -eq 0 ]; then
echo "All $PING_COUNT ping attempts failed, executing AT command."
/bin/atcmd 'AT+CFUN=1,1'
else
echo "$success_count out of $PING_COUNT ping attempts were successful."
fi

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Ping Watchdog Service
Wants=network.target
After=network.target
[Service]
Type=simple
ExecStartPre=/bin/sleep 60 # Sleep for 60 seconds to ensure the network is ready
ExecStart=/usrdata/simpleadmin/console/services/ping_watchdog.sh
Restart=on-failure
RestartSec=30s
[Install]
WantedBy=multi-user.target

View File

@@ -1,7 +1,15 @@
#!/bin/bash
# Read the serial number and remove the last two digits
serial_number=$(cat /sys/devices/soc0/serial_number | sed 's/..$//')
# Check if /usrdata/socat-at-bridge/atcmd exists
if [ -f "/usrdata/socat-at-bridge/atcmd" ]; then
# Read the serial number
serial_number=$(/usrdata/socat-at-bridge/atcmd 'AT+EGMR=0,5' | grep '+EGMR:' | cut -d '"' -f2)
# Read the firmware revision
firmware_revision=$(/usrdata/socat-at-bridge/atcmd 'AT+QGMR' | grep -o 'RM[0-9A-Z].*')
else
serial_number="UNKNOWN"
firmware_revision="UNKNOWN"
fi
echo "=============================================================="
echo "=============================================================="
@@ -82,9 +90,10 @@ echo " :@@@@@*. "
echo " .=@@@@@- "
echo " :+##+. "
echo "=============================================================="
echo "Test ttyd startup file by iamromulan V0.1"
echo "quectel-ID: $serial_number"
echo "TTYd session file by iamromulan v1.1"
echo "Firmware Revision: $firmware_revision"
echo "Serial Number: $serial_number"
echo "=============================================================="
# Start a login session
exec /bin/login
exec /bin/login

BIN
old/simpleadmin/htpasswd Normal file

Binary file not shown.

View File

@@ -0,0 +1,47 @@
server.modules = (
"mod_redirect",
"mod_cgi",
"mod_proxy",
"mod_openssl",
"mod_authn_file",
)
server.username = "www-data"
server.groupname = "dialout"
server.port = 80
server.document-root = "/usrdata/simpleadmin/www"
index-file.names = ( "index.html" )
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/opt/etc/.htpasswd"
$SERVER["socket"] == "0.0.0.0:443" {
ssl.engine = "enable"
ssl.privkey= "/usrdata/simpleadmin/server.key"
ssl.pemfile= "/usrdata/simpleadmin/server.crt"
ssl.acme-tls-1 = "/etc/simpleadmin/dehydrated/tls-alpn-01"
ssl.openssl.ssl-conf-cmd = ("MinProtocol" => "TLSv1.2") # (lighttpd 1.4.56 default; recommended to accept only TLSv1.2 and TLSv1.3)
auth.require = ( "/" => (
"method" => "basic",
"realm" => "Authorized users only",
"require" => "valid-user"
)
)
}
# Redirect everything to https
$HTTP["scheme"] == "http" {
url.redirect = ("" => "https://${url.authority}${url.path}${qsa}")
}
# Anything in /cgi-bin will be run as a script
$HTTP["url"] =~ "/cgi-bin/" {
cgi.assign = ( "" => "" )
}
# Handle proxy to ttyd if it's running
$HTTP["url"] =~ "(^/console)" {
proxy.header = ("map-urlpath" => ( "/console" => "/" ), "upgrade" => "enable" )
proxy.server = ( "" => ("" => ( "host" => "127.0.0.1", "port" => 8080 )))
}

View File

@@ -0,0 +1,60 @@
#!/bin/sh
# Function to create and run the Watchcat script
create_and_run_watchcat_script() {
local ip=$1
local timeout=$2
local failure_count=$3
local script_path="/usrdata/simpleadmin/script/watchcat.sh"
# Create the script with the watchcat logic
sudo cat << EOF > $script_path
#!/bin/sh
failures=0
while :; do
if ping -c 1 $ip > /dev/null 2>&1; then
failures=0
else
failures=\$((failures + 1))
if [ "\$failures" -ge "$failure_count" ]; then
echo "Rebooting system due to \$failures consecutive ping failures."
/sbin/reboot
exit 0
fi
fi
sleep $timeout
done
EOF
# Make the watchcat script executable
chmod +x $script_path
# Create a JSON to be fetched later
echo "{\"enabled\": true, \"track_ip\": \"$ip\", \"ping_timeout\": $timeout, \"ping_failure_count\": $failure_count}" > /usrdata/simpleadmin/script/watchcat.json
# Check if the script was created successfully
if [ -f "$script_path" ]; then
# Make the script executable
chmod +x "$script_path"
# Run the script in the background
# nohup /bin/sh "$script_path" &
/bin/sh "$script_path" &
echo "Watchcat script created and running."
else
echo "Failed to create the Watchcat script."
echo "Please check the script path: $script_path"
fi
}
# Check if the script is called with the required parameters
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <IP> <timeout> <failure_count>"
exit 1
fi
# Call the function with the provided arguments
create_and_run_watchcat_script "$1" "$2" "$3"

View File

@@ -0,0 +1,32 @@
#!/bin/sh
# Function to remove the Watchcat script and JSON file
remove_watchcat_script() {
local script_path="/usrdata/simpleadmin/script/watchcat.sh"
local json_path="/usrdata/simpleadmin/script/watchcat.json"
# Mount as read-write
mount -o remount,rw /
# Remove the watchcat script if it exists
if [ -f "$script_path" ]; then
rm "$script_path"
echo "Removed $script_path"
else
echo "$script_path does not exist"
fi
# Remove the JSON file if it exists
if [ -f "$json_path" ]; then
rm "$json_path"
echo "Removed $json_path"
else
echo "$json_path does not exist"
fi
# Mount as read-only
mount -o remount,ro /
}
# Call the function to remove the scripts
remove_watchcat_script

View File

@@ -0,0 +1,43 @@
#!/bin/sh
# Check if the required parameters are provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <enable|disable> <ttl_value>"
exit 1
fi
# Assign the provided parameters to variables
mode="$1"
ttl_value="$2"
# Check if iptables is still set
ttlcheck=$(/opt/bin/sudo /usr/sbin/iptables -w 5 -t mangle -vnL | grep TTL | awk '{print $13}')
# If TTL is still set, manually remove values
if [ ! -z "${ttlcheck}" ]; then
/opt/bin/sudo /usr/sbin/iptables -w 5 -t mangle -D POSTROUTING -o rmnet+ -j TTL --ttl-set "${ttlcheck}" &>/dev/null || true
/opt/bin/sudo /usr/sbin/ip6tables -w 5 -t mangle -D POSTROUTING -o rmnet+ -j HL --hl-set "${ttlcheck}" &>/dev/null || true
fi
# Handle the enable/disable mode
case "${mode}" in
enable)
# Echo TTL to file
echo "${ttl_value}" > /usrdata/simplefirewall/ttlvalue
# Set Start Service
/opt/bin/sudo /usrdata/simplefirewall/ttl-override start
;;
disable)
# Remove TTL value file
rm -f /usrdata/simplefirewall/ttlvalue
# Stop the service
/opt/bin/sudo /usrdata/simplefirewall/ttl-override stop
;;
*)
echo "Invalid mode: ${mode}"
echo "Usage: $0 <enable|disable> <ttl_value>"
exit 1
;;
esac

View File

@@ -0,0 +1,5 @@
#/bin/bash
echo -e "\e[1;31mPlease set your simpleadmin (User: admin) web login password.\e[0m"
/usrdata/root/bin/htpasswd -c /opt/etc/.htpasswd admin
echo -e "\e[1;32mPassword set.\e[0m"

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Lighttpd Daemon
After=network.target opt.mount
[Service]
Type=simple
PIDFile=/opt/var/run/lighttpd.pid
ExecStartPre=/opt/sbin/lighttpd -tt -f /usrdata/simpleadmin/lighttpd.conf
ExecStart=/opt/sbin/lighttpd -D -f /usrdata/simpleadmin/lighttpd.conf
ExecReload=/bin/kill -USR1 $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=TTYD Service
After=network.target
[Service]
Type=simple
ExecStartPre=/bin/sleep 5
ExecStart=/usrdata/simpleadmin/console/ttyd -i 127.0.0.1 -p 8080 -t 'theme={"foreground":"white","background":"black"}' -t fontSize=25 --writable /usrdata/simpleadmin/console/ttyd.bash
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,35 @@
#!/bin/bash
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
if [ "${QUERY_STRING}" ]; then
export IFS="&"
for cmd in ${QUERY_STRING}; do
if [ "$(echo $cmd | grep '=')" ]; then
key=$(echo $cmd | awk -F '=' '{print $1}')
value=$(echo $cmd | awk -F '=' '{print $2}')
eval $key=$value
fi
done
fi
x=$(urldecode "$atcmd")
MYATCMD=$(printf '%b\n' "${atcmd//%/\\x}")
if [ -n "${MYATCMD}" ]; then
# Initialize wait time to 200 ms
wait_time=200
while true; do
runcmd=$(echo -en "$x\r\n" | microcom -t $wait_time /dev/ttyOUT2)
# Check if "OK" or "ERROR" is present in the response
if [[ $runcmd =~ "OK" ]] || [[ $runcmd =~ "ERROR" ]]; then
break # Exit the loop if "OK" or "ERROR" is found
fi
# If neither "OK" nor "ERROR" is found, increment wait time by 1 second
((wait_time++))
done
fi
echo "Content-type: text/plain"
echo $x
echo ""
echo $runcmd

View File

@@ -0,0 +1,19 @@
#!/bin/bash
# This script will ping 8.8.8.8 and return the result
# If the ping is successful, it will return "OK"
# If the ping fails, it will return "ERROR"
# Send the ping command and store the output
ping_output=$(ping -c 1 8.8.8.8)
# Check if the output contains "0% packet loss"
if echo "$ping_output" | grep -q "0% packet loss"; then
echo "Content-type: text/plain"
echo ""
echo "OK"
else
echo "Content-type: text/plain"
echo ""
echo "ERROR"
fi

View File

@@ -1,7 +1,7 @@
#!/bin/bash
# Check iptables for ttlvalue
ttlvalue=$(iptables -t mangle -vnL | grep TTL | awk '{print $13}')
ttlvalue=$(/opt/bin/sudo /usr/sbin/iptables -w 5 -t mangle -vnL | grep TTL | awk '{print $13}' | head -n1)
ttlenabled=true;
# Set Variables
@@ -16,4 +16,5 @@ cat <<EOT
{
"isEnabled": $ttlenabled,
"ttl": $ttlvalue
}
}
EOT

View File

@@ -0,0 +1,11 @@
#!/bin/bash
# Execute the uptime command and store the result
uptime_output=$(uptime)
# Set header for plain text content
echo "Content-Type: text/plain"
echo ""
# Output the uptime result
echo "$uptime_output"

View File

@@ -0,0 +1,17 @@
#!/bin/bash
# Content type header
echo "Content-type: application/json"
echo ""
# This script fetches the watchCat parameters from the /tmp/watchcat.json and returns it as JSON
# Example content of /tmp/watchcat:
# {"watchcat": {"enabled": true, "track_ip": "1.1.1.1", "ping_timeout": 30, "ping_failure_count": 10}}
# Check if the file exists
if [ -f /tmp/watchcat.json ]; then
cat /tmp/watchcat.json
else
# return an empty JSON object
echo "{}"
fi

View File

@@ -0,0 +1,31 @@
#!/bin/bash
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
urldecode() {
local data
data="${*//+/ }"
echo -e "${data//%/\\x}"
}
if [ "${QUERY_STRING}" ]; then
export IFS="&"
for cmd in ${QUERY_STRING}; do
if [[ "$cmd" == *=* ]]; then
key=$(echo "$cmd" | awk -F '=' '{print $1}')
value=$(echo "$cmd" | awk -F '=' '{print $2}')
eval "$key"="$(urldecode "$value")"
fi
done
fi
phone_number="$number"
message_encoded="$msg"
send_at_command() {
local cmd=$1
echo -en "$cmd\r" | microcom -t 100 /dev/ttyOUT2
}
send_at_command "AT+CMGS=\"$phone_number\","$Command""
runcmd=$((echo -en "$message_encoded"; echo -en "\x1A") | microcom -t 500 /dev/ttyOUT2)
echo "$runcmd"

View File

@@ -0,0 +1,64 @@
#!/bin/bash
# Debug log function
log_debug() {
local message="$1"
debug_logs+=("$message")
}
# Initialize debug logs array
declare -a debug_logs=()
# Get query
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
if [ "${QUERY_STRING}" ]; then
export IFS="&"
for cmd in ${QUERY_STRING}; do
if [ "$(echo $cmd | grep '=')" ]; then
key=$(echo $cmd | awk -F '=' '{print $1}')
value=$(echo $cmd | awk -F '=' '{print $2}')
eval $key=$value
log_debug "Received parameter: $key=$value"
fi
done
fi
setTTL=$(printf '%b\n' "${ttlvalue//%/\\x}")
if [ -n "${setTTL}" ]; then
log_debug "Stopping service to remove rules"
/usrdata/simplefirewall/ttl-override stop
# Convert ttlvalue to integer
if [ "${ttlvalue}" ]; then
ttlvalue_int=$(echo "${ttlvalue}" | sed 's/[^0-9]//g')
log_debug "Converted ttlvalue to integer: $ttlvalue_int"
fi
# Call the sh script with the appropriate parameters
if [ "${ttlvalue_int}" != 0 ]; then
log_debug "Enabling TTL with value: ${setTTL}"
/usrdata/simpleadmin/script/ttl_script.sh enable "${setTTL}"
commandRan="/usrdata/simpleadmin/script/ttl_script.sh enable ${setTTL}"
ttlenabled=true
ttlvalue=$ttlvalue_int
elif [ "${ttlvalue_int}" = 0 ]; then
log_debug "Disabling TTL"
/usrdata/simpleadmin/script/ttl_script.sh disable 0
commandRan="/usrdata/simpleadmin/script/ttl_script.sh disable 0"
ttlenabled=false
ttlvalue=0
fi
log_debug "Starting service to apply rules"
/usrdata/simplefirewall/ttl-override start
fi
echo "Content-type: text/text"
echo ""
cat <<EOT
{
"debug_logs": [
$(printf '"%s",' "${debug_logs[@]}")
]
}
EOT

View File

@@ -0,0 +1,125 @@
#!/bin/bash
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
if [ "${QUERY_STRING}" ]; then
export IFS="&"
for cmd in ${QUERY_STRING}; do
if [[ "$cmd" == *"="* ]]; then
key=$(echo $cmd | awk -F '=' '{print $1}')
value=$(echo $cmd | awk -F '=' '{print $2}')
eval $key=$(urldecode $value)
fi
done
fi
if [ -z "$status" ] || [ -z "$IpDNS" ] || [ -z "$cooldown" ] || [ -z "$failures" ] || [ -z "$action" ]; then
response="Missing parameters. Please provide the following parameters: IpDNS, cooldown, failures, action."
echo "Content-type: text/plain"
echo ""
echo "$response"
exit 1
fi
if [ "$status" == "enabled" ]; then
watch_script="/usrdata/simpleadmin/script/watchat.sh"
mount -o remount,rw /
cat <<EOF > $watch_script
#!/bin/bash
ip_or_dns="$IpDNS"
cooldown=$cooldown
action="$action"
fail_count=0
max_failures=$failures
# Process the action variable.
# Create a JSON file containing the parameters of the script
echo -n '{"ip_or_dns":"$ip_or_dns","cooldown":$cooldown,"action":"$action","fail_count":$fail_count,"max_failures":$max_failures}' > /tmp/watchatParams.json
while true; do
if ping -c 1 -W 1 \$ip_or_dns > /dev/null; then
fail_count=0
echo "Success at \$(date)" >> /tmp/watchat.log
# Convert /tmp/watchat.log to json format
echo -n '{"log":[' > /tmp/watchat.json
cat /tmp/watchat.log | sed 's/$/,/' | tr -d '\n' | sed 's/,$//' >> /tmp/watchat.json
echo -n ']}' >> /tmp/watchat.json
else
((fail_count++))
if [ \$fail_count -ge \$max_failures ]; then
case "\$action" in
reboot)
echo "Rebooting system..."
/sbin/reboot
;;
switch_sim)
echo "Switching SIM..."
echo -ne "AT+CNMI=2,1\r" > /dev/ttyOUT2
sleep 1
echo "Switching SIM at \$(date)" >> /tmp/watchat.log
;;
none)
echo "No action taken."
echo "No action taken at \$(date)" >> /tmp/watchat.log
;;
*)
echo "Unknown action: \$action"
;;
esac
# Reset fail count
fail_count=0
fi
fi
echo "Fail count: \$fail_count at \$(date)" >> /tmp/watchat.log
# Convert /tmp/watchat.log to json format
echo -n '{"log":[' > /tmp/watchat.json
cat /tmp/watchat.log | sed 's/$/,/' | tr -d '\n' | sed 's/,$//' >> /tmp/watchat.json
echo -n ']}' >> /tmp/watchat.json
sleep \$cooldown
done
EOF
chmod +x $watch_script
cat <<EOF > /lib/systemd/system/watchcat.service
[Unit]
Description=Ping Watcher Service
[Service]
ExecStart=$watch_script
Restart=always
[Install]
WantedBy=multi-user.target
EOF
ln -s /lib/systemd/system/watchcat.service /etc/systemd/system/multi-user.target.wants/watchcat.service
systemctl daemon-reload
systemctl start watchcat.service
response="Script created at $watch_script and made executable. Service created and started."
elif [ "$status" == "disabled" ]; then
watch_script="/usrdata/simpleadmin/script/watchat.sh"
rm -f $watch_script
systemctl stop watchcat.service
rm -f /lib/systemd/system/watchcat.service
rm -f /etc/systemd/system/multi-user.target.wants/watchcat.service
systemctl daemon-reload
response="Script removed at $watch_script. Service stopped and removed."
else
response="Invalid status. Please provide either enabled or disabled."
fi
echo "Content-type: text/plain"
echo ""
echo "$response"

View File

@@ -0,0 +1,26 @@
#!/bin/bash
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
if [ "${QUERY_STRING}" ]; then
export IFS="&"
for cmd in ${QUERY_STRING}; do
if [ "$(echo $cmd | grep '=')" ]; then
key=$(echo $cmd | awk -F '=' '{print $1}')
value=$(echo $cmd | awk -F '=' '{print $2}')
eval $key=$value
fi
done
fi
x=$(urldecode "$atcmd")
MYATCMD=$(printf '%b\n' "${atcmd//%/\\x}")
if [ -n "${MYATCMD}" ]; then
# Capture the response and remove ANSI color codes using awk
runcmd=$(atcmd '$x' | awk '{ gsub(/\x1B\[[0-9;]*[mG]/, "") }1')
fi
echo "Content-type: text/plain"
echo $x
echo ""
echo "$runcmd"

View File

@@ -0,0 +1,72 @@
#!/bin/bash
# Decode URL-encoded strings
function urldecode() {
local data=${1//+/ }
printf '%b' "${data//%/\\x}"
}
# Parse QUERY_STRING
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
if [ "${QUERY_STRING}" ]; then
export IFS="&"
for cmd in ${QUERY_STRING}; do
if [[ "$cmd" == *"="* ]]; then
key=$(echo $cmd | awk -F '=' '{print $1}')
value=$(echo $cmd | awk -F '=' '{print $2}')
eval $key=$(urldecode $value)
fi
done
fi
# Set default values
WATCHCAT_ENABLED=${WATCHCAT_ENABLED:-"disable"}
TRACK_IP=${TRACK_IP:-"1.1.1.1"}
PING_TIMEOUT=${PING_TIMEOUT:-30}
PING_FAILURE_COUNT=${PING_FAILURE_COUNT:-3}
# Validate input
if ! [[ "$WATCHCAT_ENABLED" =~ ^(enable|disable)$ ]]; then
echo "Content-type: text/plain"
echo ""
echo "Invalid value for WATCHCAT_ENABLED. Use 'enable' or 'disable'."
exit 1
fi
if ! [[ "$TRACK_IP" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
echo "Content-type: text/plain"
echo ""
echo "Invalid IP address format for TRACK_IP."
exit 1
fi
if ! [[ "$PING_TIMEOUT" =~ ^[0-9]+$ ]] || [ "$PING_TIMEOUT" -le 0 ]; then
echo "Content-type: text/plain"
echo ""
echo "PING_TIMEOUT must be a positive integer."
exit 1
fi
if ! [[ "$PING_FAILURE_COUNT" =~ ^[0-9]+$ ]] || [ "$PING_FAILURE_COUNT" -le 0 ]; then
echo "Content-type: text/plain"
echo ""
echo "PING_FAILURE_COUNT must be a positive integer."
exit 1
fi
# Implement the Watchcat logic
if [ "$WATCHCAT_ENABLED" == "enable" ]; then
echo "Content-type: text/plain"
echo ""
echo "Watchcat is enabled. Tracking IP: $TRACK_IP, Ping timeout: $PING_TIMEOUT seconds, Ping failure count: $PING_FAILURE_COUNT"
# Call the create script here and use the needed parameters
sudo /usrdata/simpleadmin/script/create_watchcat.sh "$TRACK_IP" "$PING_TIMEOUT" "$PING_FAILURE_COUNT"
else
echo "Content-type: text/plain"
echo ""
echo "Watchcat is disabled."
# Call the remove script here
sudo /usrdata/simpleadmin/script/remove_watchcat.sh
fi
exit 0

6143
old/simpleadmin/www/css/all.min.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,173 @@
/* import poppins */
/* poppins-300 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Poppins';
font-style: normal;
font-weight: 300;
src: url('../fonts/poppins-v23-latin-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* poppins-300italic - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Poppins';
font-style: italic;
font-weight: 300;
src: url('../fonts/poppins-v23-latin-300italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* poppins-regular - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Poppins';
font-style: normal;
font-weight: 400;
src: url('../fonts/poppins-v23-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* poppins-italic - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Poppins';
font-style: italic;
font-weight: 400;
src: url('../fonts/poppins-v23-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* poppins-500 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Poppins';
font-style: normal;
font-weight: 500;
src: url('../fonts/poppins-v23-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* poppins-500italic - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Poppins';
font-style: italic;
font-weight: 500;
src: url('../fonts/poppins-v23-latin-500italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* poppins-600 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Poppins';
font-style: normal;
font-weight: 600;
src: url('../fonts/poppins-v23-latin-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* poppins-600italic - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Poppins';
font-style: italic;
font-weight: 600;
src: url('../fonts/poppins-v23-latin-600italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* poppins-700 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Poppins';
font-style: normal;
font-weight: 700;
src: url('../fonts/poppins-v23-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* poppins-700italic - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Poppins';
font-style: italic;
font-weight: 700;
src: url('../fonts/poppins-v23-latin-700italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* import fontawesome icons */
@import url("./all.min.css");
* {
font-family: "Poppins", sans-serif;
}
.custom-checkbox .form-check-input {
margin-right: 1px;
}
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1000;
display: flex;
justify-content: center;
align-items: center;
}
.loading-modal {
background-color: #fff;
padding: 3rem;
border-radius: 10px;
text-align: center;
}
.loading-text {
font-size: 18px;
color: #333;
}
.loader {
width: 64px;
height: 64px;
border: 3px dotted #000;
border-style: solid solid dotted dotted;
border-radius: 50%;
display: inline-block;
position: relative;
box-sizing: border-box;
animation: rotation 2s linear infinite;
margin-bottom: 2rem;
}
.loader::after {
content: "";
box-sizing: border-box;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
border: 3px dotted #0b5ed7;
border-style: solid solid dotted;
width: 24px;
height: 24px;
border-radius: 50%;
animation: rotationBack 1s linear infinite;
transform-origin: center center;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes rotationBack {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(-360deg);
}
}
.is-warning {
background-color: #ffb70f !important;
color: #000 !important;
}
.is-medium {
font-weight: 600;
}

View File

@@ -0,0 +1,522 @@
<!DOCTYPE html>
<html lang="en" data-bs-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Simple Admin</title>
<!-- <link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous"
/> -->
<!-- Import all the bootstrap css files from css folder -->
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- Import BootStrap Javascript -->
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/alpinejs.min.js" defer></script>
</head>
<body>
<main>
<div class="container my-4" x-data="fetchDeviceInfo()">
<nav class="navbar navbar-expand-lg mt-2">
<div class="container-fluid">
<a class="navbar-brand" href="/"
><span class="mb-0 h4">Simple Admin</span></a
>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarText"
aria-controls="navbarText"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/network.html">Simple Network</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/scanner.html">Simple Scan</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/settings.html">Simple Settings</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/sms.html">SMS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/console">Console</a>
</li>
<li class="nav-item">
<a
class="nav-link active"
href="/deviceinfo.html"
aria-current="page"
>Device Information</a
>
</li>
</ul>
<span class="navbar-text">
<button class="btn btn-link text-reset" id="darkModeToggle">
Dark Mode
</button>
</span>
</div>
</div>
</nav>
<div class="row mt-5 gap-3">
<div class="col">
<div class="card">
<div class="card-header">Device Information</div>
<div class="card-body">
<div class="card-text">
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<th scope="row">Manufacturer</th>
<td x-text="manufacturer"></td>
</tr>
<tr>
<th scope="row">Model Name</th>
<td x-text="modelName"></td>
</tr>
<tr>
<th scope="row">Firmware version</th>
<td class="col-md-2" x-text="firmwareVersion"></td>
</tr>
<tr>
<th scope="row">Phone Number</th>
<td class="col-md-2" x-text="phoneNumber"></td>
</tr>
<tr>
<th scope="row">IMSI</th>
<td class="col-md-2" x-text="imsi"></td>
</tr>
<tr>
<th scope="row">ICCID</th>
<td class="col-md-2" x-text="iccid"></td>
</tr>
<tr>
<th scope="row">IMEI</th>
<td class="col-md-2">
<input
class="form-control"
type="text"
x-model="newImei"
x-bind:placeholder="imei === '-' ? 'Fetching IMEI...' : imei"
/>
</td>
<td>
<button
type="button"
class="btn btn-primary"
@click="openModal()"
>
Update
</button>
</td>
</tr>
<tr>
<th scope="row">LAN IP</th>
<td class="col-md-2" x-text="lanIp"></td>
</tr>
<tr>
<th scope="row">WWAN IPv<sup>4</sup></th>
<td class="col-md-2" x-text="wwanIpv4"></td>
</tr>
<tr>
<th scope="row">WWAN IPv<sup>6</sup></th>
<td class="col-md-2" x-text="wwanIpv6"></td>
</tr>
<tr>
<th scope="row">Simple Admin Version</th>
<td class="col-md-2">SimpleAdminRev-Alpha-0.9</td>
</tr>
<tr>
<th>Project Contributors</th>
<td>
<!-- Button trigger modal -->
<p
type="button"
class="link-info link-opacity-50-hover link-offset-2"
data-bs-toggle="modal"
data-bs-target="#staticBackdrop"
>
Show Contributors
</p>
<!-- Modal -->
<div
class="modal fade"
id="staticBackdrop"
data-bs-backdrop="static"
data-bs-keyboard="false"
tabindex="-1"
aria-labelledby="staticBackdropLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h1
class="modal-title fs-5"
id="staticBackdropLabel"
>
Contributors
</h1>
<button
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
<table>
<tbody>
<tr>
<th>
RGMII Toolkit and Documentation
</th>
<td class="col-md-2">
<a
href="https://github.com/iamromulan"
target="_blank"
>iamromulan</a
>
</td>
</tr>
<tr>
<th>Simple Admin 2.0</th>
<td class="col-md-2">
<a
href="https://github.com/dr-dolomite"
target="_blank"
>dr-dolomite</a
>
</td>
</tr>
<tr>
<th>SMS Feature</th>
<td class="col-md-2">
<a
href="https://github.com/snjzb"
target="_blank"
>snjzb</a
>
</td>
</tr>
<tr>
<th>Original Simple Admin</th>
<td class="col-md-2">
<a
href="https://github.com/aesthernr"
target="_blank"
>aesthernr</a
>
</td>
</tr>
<tr>
<th>Original Socat Bridge</th>
<td class="col-md-2">
<a
href="https://github.com/natecarlson"
target="_blank"
>natecarlson</a
>
</td>
</tr>
<tr>
<th>Original Simple Admin Fixes</th>
<td class="col-md-2">
<a
href="https://github.com/rbflurry/"
target="_blank"
>rbflurry</a
>
</td>
</tr>
<tr>
<th>SA Parsing Patch</th>
<td class="col-md-2">
<a
href="https://github.com/tarunVreddy"
target="_blank"
>tarunVreddy</a
>
</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="card-footer">
Visit our
<a
href="https://github.com/iamromulan/quectel-rgmii-toolkit/tree/development"
target="_blank"
class="text-reset"
>repository</a
>
or
<a
href="https://github.com/iamromulan/quectel-rgmii-configuration-notes.git"
target="_blank"
class="text-reset"
>documentation</a
>
for more information. All rights reserved. 2025
</div>
</div>
</div>
</div>
<!-- Loading Modal for Reboot -->
<div class="modal-overlay" x-show="showModal">
<div class="loading-modal">
<div
class="loading-text"
style="display: flex; flex-direction: column"
>
<h3>This will reboot the modem.</h3>
<p style="margin-top: 0.5rem">Continue?</p>
</div>
<div class="d-grid gap-2 d-md-block">
<button
class="btn btn-primary"
type="button"
@click="updateIMEI()"
>
Reboot
</button>
<button
class="btn btn-danger"
type="button"
@click="closeModal()"
>
Cancel
</button>
</div>
</div>
</div>
<!-- Reboot Modal Countdown -->
<div class="modal-overlay" x-show="isRebooting">
<div class="loading-modal">
<div class="loader"></div>
<div
class="loading-text"
style="display: flex; flex-direction: column"
>
<h3>Rebooting...</h3>
<p style="margin-top: 0.5rem">
Please wait for
<span x-text="countdown" style="font-weight: 500"></span>
seconds.
</p>
</div>
</div>
</div>
</div>
</main>
<script src="js/dark-mode.js"></script>
<script>
function fetchDeviceInfo() {
return {
manufacturer: "-",
modelName: "-",
firmwareVersion: "-",
imsi: "-",
iccid: "-",
imei: "-",
newImei: null,
lanIp: "-",
wwanIpv4: "-",
wwanIpv6: "-",
phoneNumber: "Unknown",
simpleAdminVersion: "-",
atcmd: null,
atCommandResponse: "",
showModal: false,
isLoading: false,
isRebooting: false,
countdown: 3,
sendATCommand() {
if (!this.atcmd) {
// Use ATI as default command
console.log(
"AT Command is empty, using ATI as default command: "
);
}
this.isLoading = true;
fetch(
"/cgi-bin/get_atcommand?" +
new URLSearchParams({
atcmd: this.atcmd,
})
)
.then((res) => {
return res.text();
})
.then((data) => {
this.atCommandResponse = data;
})
.catch((error) => {
console.error("Error: ", error);
this.showError = true;
});
},
fetchATCommand() {
this.atcmd =
'AT+CGMI;+CGMM;+QGMR;+CIMI;+ICCID;+CGSN;+QMAP="LANIP";+QMAP="WWAN";+CNUM';
this.isLoading = true;
fetch(
"/cgi-bin/get_atcommand?" +
new URLSearchParams({
atcmd: this.atcmd,
})
)
.then((res) => {
return res.text();
})
.then((data) => {
this.atCommandResponse = data;
this.parseFetchedData();
})
.catch((error) => {
console.error("Error: ", error);
this.showError = true;
});
},
parseFetchedData() {
const lines = this.atCommandResponse.split("\n");
console.log("AT Command Response: ", lines);
this.manufacturer = lines[1].trim();
this.modelName = lines[3].trim();
this.firmwareVersion = lines[5].trim();
this.imei = lines[11].trim();
this.lanIp = lines[13].trim().split(",")[3];
this.wwanIpv4 = lines[15].trim().split(",")[4].replace(/"/g, "");
this.wwanIpv6 = lines[16].trim().split(",")[4].replace(/"/g, "");
try {
this.imsi = lines[7].trim();
this.iccid = lines[9].trim().replace("+ICCID: ", "");
this.phoneNumber = lines[18]
.trim()
.split(",")[1]
.replace(/"/g, "");
if (this.phoneNumber === "") {
this.phoneNumber = "Unknown";
}
} catch (error) {
this.phoneNumber = "No SIM Card Inserted or Detected";
this.imsi = " ";
this.iccid = " ";
}
this.simpleAdminVersion = "SimpleAdminRev-Beta-1.0";
this.isLoading = false;
},
updateIMEI() {
this.atcmd = `AT+EGMR=1,7,"${this.newImei}"`;
this.sendATCommand();
this.rebootDevice();
},
rebootDevice() {
this.atcmd = "AT+CFUN=1,1";
this.sendATCommand();
this.isLoading = true;
this.showModal = false;
this.isRebooting = true;
this.countdown = 40;
const interval = setInterval(() => {
this.countdown--;
if (this.countdown === 0) {
clearInterval(interval);
this.isLoading = false;
this.showModal = false;
this.isRebooting = false;
this.init();
}
}, 1000);
},
openModal() {
if (!this.newImei) {
alert("No new IMEI provided.");
return;
}
if (this.newImei.length !== 15) {
alert("IMEI is invalid");
return;
}
if (this.newImei === this.imei) {
alert("IMEI is the same as the current IMEI");
return;
}
this.showModal = true;
},
closeModal() {
this.showModal = false;
},
init() {
this.fetchATCommand();
},
};
}
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,37 @@
// Function to toggle dark mode
const toggleDarkMode = () => {
const html = document.querySelector('html');
const currentTheme = html.getAttribute('data-bs-theme');
if (currentTheme === 'dark') {
html.removeAttribute('data-bs-theme');
darkModeToggle.textContent = 'Dark Mode';
localStorage.setItem('theme', 'light'); // Store the theme in localStorage
} else {
html.setAttribute('data-bs-theme', 'dark');
darkModeToggle.textContent = 'Light Mode';
localStorage.setItem('theme', 'dark'); // Store the theme in localStorage
}
};
const darkModeToggle = document.getElementById('darkModeToggle');
// Check if theme preference is stored in localStorage
const storedTheme = localStorage.getItem('theme');
const html = document.querySelector('html');
if (storedTheme) {
html.setAttribute('data-bs-theme', storedTheme);
if (storedTheme === 'dark') {
darkModeToggle.textContent = 'Light Mode';
} else {
darkModeToggle.textContent = 'Dark Mode';
}
} else {
// If no preference is stored, default to dark mode
html.setAttribute('data-bs-theme', 'dark');
darkModeToggle.textContent = 'Light Mode';
localStorage.setItem('theme', 'dark');
}
darkModeToggle.addEventListener('click', toggleDarkMode);

View File

@@ -0,0 +1,37 @@
const freqNumbersContainer = document.getElementById(
"freqNumbersContainer"
);
function generateFreqNumberInputs(num) {
let html = "";
const maxFields = Math.min(num, 10); // Limit to a maximum of 10 fields
for (let i = 1; i <= maxFields; i++) {
html += `
<div class="input-group mb-3" x-show="cellNum >= ${i} && networkModeCell == 'LTE'">
<input
type="text"
aria-label="EARFCN"
placeholder="EARFCN"
class="form-control"
x-model="earfcn${i}"
/>
<input
type="text"
aria-label="PCI"
placeholder="PCI"
class="form-control"
x-model="pci${i}"
/>
</div>
`;
}
return html;
}
document.addEventListener("DOMContentLoaded", function () {
const cellNumInput = document.querySelector("[aria-label='NumCells']");
cellNumInput.addEventListener("input", function () {
const cellNum = parseInt(this.value);
freqNumbersContainer.innerHTML = generateFreqNumberInputs(cellNum);
});
});

View File

@@ -0,0 +1,99 @@
function parseCurrentSettings(rawdata) {
const data = rawdata;
const lines = data.split("\n");
console.log(lines);
// Remove QUIMSLOT and only take 1 or 2
this.sim = lines
.find(
(line) => line.includes("QUIMSLOT: 1") || line.includes("QUIMSLOT: 2")
)
.split(":")[1]
// remove spaces
.replace(/\s/g, "");
// .replace(/\"/g, "");
try {
this.apn = lines
.find((line) => line.includes("+CGCONTRDP: 1"))
.split(",")[2]
.replace(/\"/g, "");
} catch (error) {
this.apn = "Failed fetching APN";
}
this.cellLock4GStatus = lines
.find((line) => line.includes('+QNWLOCK: "common/4g"'))
.split(",")[1]
.replace(/\"/g, "");
this.cellLock5GStatus = lines
.find((line) => line.includes('+QNWLOCK: "common/5g"'))
.split(",")[1]
.replace(/\"/g, "");
this.prefNetwork = lines
.find((line) => line.includes('+QNWPREFCFG: "mode_pref"'))
.split(",")[1]
.replace(/\"/g, "");
this.nrModeControlStatus = lines
.find((line) => line.includes('+QNWPREFCFG: "nr5g_disable_mode"'))
.split(",")[1]
.replace(/\"/g, "");
this.apnIP = lines
.find((line) => line.includes("+CGDCONT: 1"))
.split(",")[1]
.replace(/\"/g, "");
try {
const PCCbands = lines
.find((line) => line.includes('+QCAINFO: "PCC"'))
.split(",")[3]
.replace(/\"/g, "");
// Loop over all QCAINFO: "SCC" lines and get the bands
try {
const SCCbands = lines
.filter((line) => line.includes('+QCAINFO: "SCC"'))
.map((line) => line.split(",")[3].replace(/\"/g, ""))
.join(", ");
this.bands = `${PCCbands}, ${SCCbands}`;
} catch (error) {
this.bands = PCCbands;
}
} catch (error) {
this.bands = "Failed fetching bands";
}
if (this.cellLock4GStatus == 1 && this.cellLock5GStatus == 1) {
this.cellLockStatus = "Locked to 4G and 5G";
} else if (this.cellLock4GStatus == 1) {
this.cellLockStatus = "Locked to 4G";
} else if (this.cellLock5GStatus == 1) {
this.cellLockStatus = "Locked to 5G";
} else {
this.cellLockStatus = "Not Locked";
}
if (this.nrModeControlStatus == 0) {
this.nrModeControlStatus = "Not Disabled";
} else if (this.nrModeControlStatus == 1) {
this.nrModeControlStatus = "SA Disabled";
} else {
this.nrModeControlStatus = "NSA Disabled";
}
return {
sim: sim,
apn: apn,
apnIP: apnIP,
cellLockStatus: cellLockStatus,
prefNetwork: prefNetwork,
nrModeControl: nrModeControlStatus,
bands: bands,
};
}

View File

@@ -0,0 +1,81 @@
function populateCheckboxes(lte_band, nsa_nr5g_band, nr5g_band, locked_lte_bands, locked_nsa_bands, locked_sa_bands, cellLock) {
var checkboxesForm = document.getElementById("checkboxForm");
var selectedMode = document.getElementById("networkModeBand").value;
var bands;
var prefix;
// Determine bands and prefix based on selected network mode
if (selectedMode === "LTE") {
bands = lte_band;
prefix = "B";
} else if (selectedMode === "NSA") {
bands = nsa_nr5g_band;
prefix = "N";
} else if (selectedMode === "SA") {
bands = nr5g_band;
prefix = "N";
}
checkboxesForm.innerHTML = ""; // Clear existing checkboxes
// Store the locked bands in arrays
var locked_lte_bands_array = locked_lte_bands.split(":");
var locked_nsa_bands_array = locked_nsa_bands.split(":");
var locked_sa_bands_array = locked_sa_bands.split(":");
var isBandLocked = function(band) {
if (selectedMode === "LTE" && locked_lte_bands_array.includes(band)) {
return true;
}
if (selectedMode === "NSA" && locked_nsa_bands_array.includes(band)) {
return true;
}
if (selectedMode === "SA" && locked_sa_bands_array.includes(band)) {
return true;
}
return false;
};
var fragment = document.createDocumentFragment();
if (bands !== null && bands !== "0") {
var bandsArray = bands.split(":");
var currentRow;
bandsArray.forEach(function(band, index) {
if (index % 5 === 0) {
currentRow = document.createElement("div");
currentRow.className = "row mb-2 mx-auto"; // Add margin bottom for spacing
fragment.appendChild(currentRow);
}
var checkboxDiv = document.createElement("div");
checkboxDiv.className = "form-check form-check-reverse col-2"; // Each checkbox takes a column
var checkboxInput = document.createElement("input");
checkboxInput.className = "form-check-input";
checkboxInput.type = "checkbox";
checkboxInput.id = "inlineCheckbox" + band;
checkboxInput.value = band;
checkboxInput.autocomplete = "off";
checkboxInput.checked = isBandLocked(band);
var checkboxLabel = document.createElement("label");
checkboxLabel.className = "form-check-label";
checkboxLabel.htmlFor = "inlineCheckbox" + band;
checkboxLabel.innerText = prefix + band;
checkboxDiv.appendChild(checkboxInput);
checkboxDiv.appendChild(checkboxLabel);
currentRow.appendChild(checkboxDiv);
});
} else {
// Create a text saying that no bands are available
var noBandsText = document.createElement("p");
noBandsText.className = "text-center";
noBandsText.innerText = "No supported bands available";
fragment.appendChild(noBandsText);
}
checkboxesForm.appendChild(fragment);
addCheckboxListeners(cellLock);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,667 @@
<!DOCTYPE html>
<html lang="en" data-bs-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Simple Admin</title>
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- Logo -->
<link rel="simpleadmin-logo" href="favicon.ico" />
<!-- Import BootStrap Javascript -->
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/alpinejs.min.js" defer></script>
</head>
<body>
<main>
<div class="container my-4" x-data="simpleSettings()">
<nav class="navbar navbar-expand-lg mt-2">
<div class="container-fluid">
<a class="navbar-brand" href="/"
><span class="mb-0 h4">Simple Admin</span></a
>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarText"
aria-controls="navbarText"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/network.html">Simple Network</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/scanner.html">Simple Scan</a>
</li>
<li class="nav-item">
<a
class="nav-link active"
href="/settings.html"
aria-current="page"
>Simple Settings</a
>
</li>
<li class="nav-item">
<a class="nav-link" href="/sms.html">SMS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/console">Console</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/deviceinfo.html"
>Device Information</a
>
</li>
</ul>
<span class="navbar-text">
<button class="btn btn-link text-reset" id="darkModeToggle">
Dark Mode
</button>
</span>
</div>
</div>
</nav>
<div class="row mt-5 mb-4">
<div class="col">
<div class="card">
<div class="card-header">AT Terminal</div>
<div class="card-body">
<div class="card-text">
<div class="form-floating mb-4">
<!-- At commands output here -->
<textarea
class="form-control"
placeholder="ATI"
id="atOutputBox"
style="height: 210px"
x-text="atCommandResponse"
readonly
>
<label for="floatingTextarea">ATI</label>
</textarea>
</div>
<div>
<div class="col-md-4 mb-3">
<label for="exampleInputEmail1" class="form-label"
>AT Command</label
>
<input
type="text"
class="form-control"
id="atCommandInput"
placeholder="ATI"
aria-describedby="atCommandInput"
x-model="atcmd"
@keydown.enter="sendATCommand()"
/>
<div id="atCommandInputHelper" class="form-text">
Seperate multiple commands with comma (,).
</div>
</div>
<div
class="d-grid gap-2 d-md-flex justify-content-md-start"
>
<button
class="btn btn-primary me-md-2"
type="button"
@click="sendATCommand()"
:disabled="isLoading"
>
Submit
</button>
<button
class="btn btn-danger"
type="button"
@click="clearResponses()"
:disabled="isClean"
>
Clear
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">One Click Utilities</div>
<div class="card-body">
<div class="card-text">
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<th scope="row">Reboot</th>
<td>
<button
type="submit"
class="btn btn-danger"
@click="showRebootModal()"
:disabled="isLoading"
>
Reboot
</button>
</td>
</tr>
<tr>
<th scope="row">Reset AT Commands Settings</th>
<td>
<button
type="submit"
class="btn btn-danger"
@click="resetATCommands()"
:disabled="isLoading"
>
Reset
</button>
</td>
</tr>
<tr>
<th scope="row">IP Passthrough</th>
<td>
<select
class="form-select"
id="ipPassModeSelect"
x-model="ipPassMode"
>
<option selected>Passthrough Mode</option>
<option value="ETH">ETH</option>
<option value="USB">USB (ECM/RNDIS)</option>
</select>
</td>
<td>
<button
type="submit"
class="btn btn-primary"
@click="ipPassThroughEnable()"
x-show="ipPassStatus === false"
:disabled="isLoading"
>
Enable
</button>
<button
type="submit"
class="btn btn-danger"
@click="ipPassThroughDisable()"
x-show="ipPassStatus === true"
:disabled="isLoading"
>
Disable
</button>
</td>
</tr>
<tr>
<th scope="row">USB Modem Protocol</th>
<td>
<select
class="form-select"
id="usbNetModeSelect"
x-model="usbNetMode"
>
<option
selected
x-text="currentUsbNetMode"
></option>
<option value="RMNET">RMNET</option>
<option value="ECM">ECM (Recommended)</option>
<option value="MBIM">MBIM</option>
<option value="RNDIS">RNDIS</option>
</select>
</td>
<td>
<button
type="submit"
class="btn btn-primary"
@click="usbNetModeChanger()"
:disabled="isLoading"
>
Change
</button>
</td>
</tr>
<tr>
<th scope="row">Onboard DNS Proxy</th>
<td>
<button
type="submit"
class="btn btn-primary"
@click="onBoardDNSProxyEnable()"
x-show="DNSProxyStatus === false"
:disabled="isLoading"
>
Enable
</button>
<button
type="submit"
class="btn btn-danger"
@click="onBoardDNSProxyDisable()"
x-show="DNSProxyStatus === true"
:disabled="isLoading"
>
Disable
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card mb-3">
<div class="card-header">TTL and Network Scan Settings</div>
<div class="card-body">
<label for="TTLState" class="form-label"
>TTL State and Value</label
>
<div class="row">
<div class="col">
<div
class="p-3 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3"
x-show="ttlStatus === true"
>
TTL is Active
</div>
<div
class="p-3 text-danger-emphasis bg-danger-subtle border border-danger-subtle rounded-3"
x-show="ttlStatus === false"
>
TTL is Inactive
</div>
</div>
<div class="col">
<div
class="p-3 text-info-emphasis bg-info-subtle border border-info-subtle rounded-3 mb-4"
x-text="ttlvalue"
></div>
</div>
</div>
<div class="card-text mb-3">
<div class="mb-4">
<input
type="text"
class="form-control"
id="ttlInput"
placeholder="TTL Value"
x-model="newTTL"
/>
<div id="ttlValueHelper" class="form-text">
Set TTL Value to 0 to disable.
</div>
</div>
<div class="d-grid gap-1">
<button
class="btn btn-primary"
type="button"
@click="setTTL()"
>
Update
</button>
</div>
</div>
<!-- <div class="card-text">
<div class="d-flex flex-row gap-4 w-full">
<p><a class="link-info link-opacity-50-hover link-offset-2" href="/scanner.html">Go to Cell Scanner</a></p>
<p><a class="link-info link-opacity-50-hover link-offset-2" href="/watchcat.html">Go to WatchCat</a></p>
</div>
</div> -->
</div>
</div>
</div>
</div>
<!-- Loading Modal for Reboot -->
<div class="modal-overlay" x-show="showModal">
<div class="loading-modal">
<div
class="loading-text"
style="display: flex; flex-direction: column"
>
<h3>This will reboot the modem.</h3>
<p style="margin-top: 0.5rem">Continue?</p>
</div>
<div class="d-grid gap-2 d-md-block">
<button
class="btn btn-primary"
type="button"
@click="rebootDevice()"
>
Reboot
</button>
<button
class="btn btn-danger"
type="button"
@click="closeModal()"
>
Cancel
</button>
</div>
</div>
</div>
<!-- Reboot Modal Countdown -->
<div class="modal-overlay" x-show="isRebooting">
<div class="loading-modal">
<div class="loader"></div>
<div
class="loading-text"
style="display: flex; flex-direction: column"
>
<h3>Rebooting...</h3>
<p style="margin-top: 0.5rem">
Please wait for
<span x-text="countdown" style="font-weight: 500"></span>
seconds.
</p>
</div>
</div>
</div>
</div>
</main>
<script src="js/dark-mode.js"></script>
<script>
function simpleSettings() {
return {
isLoading: false,
showSuccess: false,
showError: false,
isClean: true,
showModal: false,
isRebooting: false,
atcmd: "",
fetchATCommand: "",
countdown: 0,
atCommandResponse: "",
currentSettingsResponse: "",
ttldata: null,
ttlvalue: 0,
ttlStatus: false,
newTTL: null,
ipPassMode: "Unspecified",
ipPassStatus: false,
usbNetMode: "Unspecified",
currentUsbNetMode: "Unknown",
DNSProxyStatus: true,
closeModal() {
this.confirmModal = false;
this.showModal = false;
},
showRebootModal() {
this.showModal = true;
},
sendATCommand() {
if (!this.atcmd) {
// Use ATI as default command
this.atcmd = "ATI";
console.log(
"AT Command is empty, using ATI as default command: ",
this.atcmd
);
}
this.isLoading = true;
const encodedATCmd = encodeURIComponent(this.atcmd);
const url = `/cgi-bin/get_atcommand?atcmd=${encodedATCmd}`;
fetch(url)
.then((res) => {
if (!res.ok) {
throw new Error(`HTTP error! status: ${res.status}`);
}
return res.text();
})
.then((data) => {
this.atCommandResponse = data;
this.isLoading = false;
this.isClean = false;
this.fetchCurrentSettings();
})
.catch((error) => {
console.error("Error: ", error);
this.showError = true;
this.isLoading = false;
});
},
sendUserATCommand() {
this.isLoading = true;
const encodedATCmd = encodeURIComponent(this.atcmd);
const url = `/cgi-bin/user_atcommand?atcmd=${encodedATCmd}`;
fetch(url)
.then((res) => {
if (!res.ok) {
throw new Error(`HTTP error! status: ${res.status}`);
}
return res.text();
})
.then((data) => {
this.atCommandResponse = data;
this.isLoading = false;
this.isClean = false;
})
.catch((error) => {
console.error("Error: ", error);
this.showError = true;
this.isLoading = false;
});
},
clearResponses() {
this.atCommandResponse = "";
this.isClean = true;
},
rebootDevice() {
this.atcmd = "AT+CFUN=1,1";
this.sendATCommand();
this.atCommandResponse = "";
this.showModal = false;
this.isRebooting = true;
this.countdown = 40;
// Do the countdown
const interval = setInterval(() => {
this.countdown--;
if (this.countdown === 0) {
clearInterval(interval);
this.isRebooting = false;
this.init();
}
}, 1000);
},
resetATCommands() {
this.atcmd = "AT&F";
this.sendATCommand();
console.log("Resetting AT Commands");
this.atcmd = "";
this.atCommandResponse = "";
this.showRebootModal();
},
ipPassThroughEnable() {
if (this.ipPassMode != "Unspecified") {
if (this.ipPassMode == "ETH") {
this.atcmd =
// at+qmap="mpdn_rule",0,1,1,1,1,"FF:FF:FF:FF:FF:FF"
'AT+QMAP="MPDN_RULE",0,1,0,1,1,"FF:FF:FF:FF:FF:FF"';
this.sendATCommand();
} else if (this.ipPassMode == "USB") {
this.atcmd =
'AT+QMAP="MPDN_RULE",0,1,0,3,1,"FF:FF:FF:FF:FF:FF"';
this.sendATCommand();
} else {
console.error("Invalid IP Passthrough Mode");
}
} else {
console.error("IP Passthrough Mode not specified");
}
},
ipPassThroughDisable() {
this.atcmd = 'AT+QMAP="MPDN_RULE",0;+QMAPWAC=1';
this.sendATCommand();
},
onBoardDNSProxyEnable() {
this.atcmd = 'AT+QMAP="DHCPV4DNS","enable"';
this.sendATCommand().then(() => {
this.fetchCurrentSettings();
});
},
onBoardDNSProxyDisable() {
this.atcmd = 'AT+QMAP="DHCPV4DNS","disable"';
this.sendATCommand().then(() => {
this.fetchCurrentSettings();
});
},
usbNetModeChanger() {
if (this.usbNetMode != "Unspecified") {
if (this.usbNetMode == "RMNET") {
this.atcmd = 'AT+QCFG="usbnet",0;';
this.sendATCommand();
} else if (this.usbNetMode == "ECM") {
this.atcmd = 'AT+QCFG="usbnet",1;';
this.sendATCommand();
} else if (this.usbNetMode == "MBIM") {
this.atcmd = 'AT+QCFG="usbnet",2;';
this.sendATCommand();
} else if (this.usbNetMode == "RNDIS") {
this.atcmd = 'AT+QCFG="usbnet",3;';
this.sendATCommand();
} else {
console.log("USB Net Mode Invalid");
}
} else {
console.error("USB Net Mode not specified");
}
this.rebootDevice();
},
fetchCurrentSettings() {
this.fetchATCommand =
'AT+QMAP="MPDN_RULE";+QMAP="DHCPV4DNS";+QCFG="usbnet"';
fetch(
"/cgi-bin/get_atcommand?" +
new URLSearchParams({
atcmd: this.fetchATCommand,
})
)
.then((res) => {
return res.text();
})
.then((data) => {
// Set the value of currentSettingsResponse
this.currentSettingsResponse = data;
const currentData = data.split("\n");
console.log("Lines: ", currentData);
const testEthpass = currentData[1].match(
/\+QMAP: "MPDN_rule",0,0,0,0,0/
);
if (testEthpass) {
this.ipPassStatus = false;
} else {
this.ipPassStatus = true;
}
const testDNSProxy = currentData[6].match(
/\+QMAP: "DHCPV4DNS","enable"/
);
if (testDNSProxy) {
this.DNSProxyStatus = true;
} else {
this.DNSProxyStatus = false;
}
const testUSBNet = currentData[8].match(
/\+QCFG: "usbnet",(\d)/
);
if (testUSBNet[1] == "0") {
this.currentUsbNetMode = "RMNET";
} else if (testUSBNet[1] == "1") {
this.currentUsbNetMode = "ECM";
} else if (testUSBNet[1] == "2") {
this.currentUsbNetMode = "MBIM";
} else if (testUSBNet[1] == "3") {
this.currentUsbNetMode = "RNDIS";
} else {
this.currentUsbNetMode = "Unknown";
}
// clear atcmd
this.atcmd = "";
})
.catch((error) => {
console.error("Error: ", error);
this.showError = true;
});
},
fetchTTL() {
fetch("/cgi-bin/get_ttl_status")
.then((res) => res.json())
.then((data) => {
this.ttldata = data;
this.ttlStatus = this.ttldata.isEnabled;
this.ttlvalue = this.ttldata.ttl;
});
},
setTTL() {
this.isLoading = true; // Set loading state while updating TTL
const ttlval = this.newTTL;
fetch(
"/cgi-bin/set_ttl?" + new URLSearchParams({ ttlvalue: ttlval })
)
.then((res) => res.text()) // Use res.text() instead of res.json()
.then((data) => {
// Manually handle the response data
console.log("Response from server:", data);
// You can try to parse the JSON manually or handle the response as needed
// Once TTL is updated, fetch the updated TTL data
this.fetchTTL();
this.isLoading = false; // Set loading state back to false
})
.catch((error) => {
console.error("Error updating TTL: ", error);
this.isLoading = false; // Ensure loading state is properly handled in case of error
});
},
init() {
this.fetchCurrentSettings();
this.fetchTTL();
},
};
}
</script>
</body>
</html>

View File

@@ -0,0 +1,421 @@
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Simple Admin</title>
<!-- 导入自定义和Bootstrap样式 -->
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- 网站图标 -->
<link rel="icon" href="favicon.ico" />
<!-- 导入Bootstrap和Alpine.js脚本 -->
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/alpinejs.min.js" defer></script>
<!-- Contributed By: snjzb -->
</head>
<body>
<main>
<div class="container my-4" x-data="fetchSMS()">
<nav class="navbar navbar-expand-lg mt-2">
<div class="container-fluid">
<a class="navbar-brand" href="/"><span class="mb-0 h4">Simple Admin</span></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText"
aria-controls="navbarText" aria-expanded="false" aria-label="切换导航">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav me-auto mb-2 ml-4 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/network.html">Simple Network</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/scanner.html">Simple Scan</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/settings.html">Simple Settings</a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/sms.html">SMS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/console">Console</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/deviceinfo.html">Device Information</a>
</li>
</ul>
<span class="navbar-text">
<button class="btn btn-link text-reset" id="darkModeToggle">
Dark Mode
</button>
</span>
</div>
</div>
</nav>
<div class="row mt-5 mb-4">
<div class="col">
<div class="card">
<div class="card-header">SMS Inbox</div>
<div class="card-body">
<div class="card-text">
<div class="col">
<div style="
max-height: 400px;
overflow-y: scroll;
overflow-x: hidden;
">
<div x-show="isLoading">
<h4>Fetching SMS...</h4>
</div>
<table class="table table-hover border-success" x-show="!isLoading">
<tbody>
<!-- 没有消息时显示 -->
<!-- Display when there are no messages -->
<template x-if="messages.length === 0 && !isLoading">
<div>
<p>Inbox is Empty</p>
</div>
</template>
<!-- 循环显示短信消息 -->
<!-- "Loop display SMS messages" -->
<template x-for="(message, index) in messages" :key="index">
<tr>
<td>
<div class="form-check">
<input class="form-check-input" type="checkbox" :value="index"
x-model="selectedMessages" />
<div class="row column-gap-1 mb-2">
<div class="col-md-3">
<p x-text="'Sender: ' + senders[index]"></p>
</div>
<div class="col">
<p x-text="'Date and Time: ' + dates[index]"></p>
</div>
</div>
<div class="col-md-9">
<p x-text="message.text"></p>
</div>
</div>
</td>
</tr>
</template>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- 添加判断只有当messages数组有内容时才显示全选复选框及其区域 -->
<!-- Add a judgment, only when the messages array has content will the select all checkbox and its area be displayed" -->
<div class="card-body border-top" x-show="messages.length > 0">
<div class="form-check">
<input id="selectAllCheckbox" class="form-check-input" type="checkbox" @change="toggleAll($event)" />
<label class="form-check-label">Select All</label>
</div>
</div>
<div class="card-footer">
<div class="d-grid gap-2 d-md-flex justify-content-md-start">
<!-- 刷新按钮 -->
<!-- Refresh button -->
<button class="btn btn-success" type="button" @click="init()">
Refresh
</button>
<!-- 删除选中短信按钮 -->
<!-- Delete selected SMS button -->
<button class="btn btn-danger" type="button" @click="deleteSelectedSMS()">
Delete Selected SMS
</button>
</div>
</div>
</div>
</div>
</div>
<div class="row mt-5 mb-4">
<div class="col">
<div class="card">
<div class="card-header">Send Message</div>
<div class="card-body">
<div class="mb-3">
<label for="phoneNumber" class="form-label">Recipient's Number</label>
<input type="text" class="form-control" id="phoneNumber" x-model="phoneNumber"
placeholder="Enter the recipient's number." />
</div>
<div class="mb-3">
<label for="messageToSend" class="form-label">SMS Content</label>
<textarea class="form-control" id="messageToSend" rows="3" x-model="messageToSend"
placeholder="Enter SMS content."></textarea>
</div>
<div id="notification" class="alert" style="display: none;"></div>
<button class="btn btn-primary" @click="sendSMS()">
Send SMS
</button>
</div>
</div>
</div>
</div>
</div>
</main>
<script src="js/dark-mode.js"></script>
<script>
function fetchSMS() {
return {
isLoading: false,
atCommandResponse: "",
messages: [],
senders: [],
dates: [],
selectedMessages: [],
phoneNumber: '',
messageToSend: '',
messageIndices: [], // 确保初始化messageIndices数组
// 清除现有数据
clearData() {
this.messages = [];
this.senders = [];
this.dates = [];
this.selectedMessages = [];
this.messageIndices = [];
const selectAllCheckbox = document.getElementById('selectAllCheckbox');
if (selectAllCheckbox) {
selectAllCheckbox.checked = false;
}
},
// 请求获取短信
requestSMS() {
this.isLoading = true;
fetch(`/cgi-bin/get_atcommand?${new URLSearchParams({ atcmd: "AT+CSMS=1;+CSDH=0;+CNMI=2,1,0,0,0;+CMGF=1;+CSCA?;+CSMP=17,167,0,8;+CPMS=\"ME\",\"ME\",\"ME\";+CSCS=\"UCS2\";+CMGL=\"ALL\"" })}`)
.then(response => response.text())
.then(data => {
this.atCommandResponse = data.split('\n')
.filter(line => line.trim() !== "OK" && line.trim() !== "")
.join('\n');
})
.finally(() => {
this.isLoading = false;
this.clearData();
this.parseSMSData(this.atCommandResponse);
});
},
// 解析短信数据的方法
parseSMSData(data) {
const cmglRegex = /^\s*\+CMGL:\s*(\d+),"[^"]*","([^"]*)"[^"]*,"([^"]*)"/gm;
const cscaRegex = /^\s*\+CSCA:\s*"([^"]*)"/gm;
this.messageIndices = [];
this.serviceCenters = [];
this.dates = [];
this.senders = [];
this.messages = [];
let match;
let lastIndex = null;
while ((match = cmglRegex.exec(data)) !== null) {
const index = parseInt(match[1]);
const senderHex = match[2];
// Maximum world wide phone number length is 17 (North Korea), UTF-16BE Hex string comes back at 48+ for US Number, min length is 3.
// When 3 digit SMS short code is used the result is a 12 length string (which we then need to check if the sender hex starts with 003 or 002B(+))
// This check is probably completley unecessary but I have no data on how the modems behave with different firmware(whether support for CSCS="UCS2" is available).
const sender = senderHex.length > 11 && (senderHex.startsWith('002B') || senderHex.startsWith('003')) ? this.convertHexToText(senderHex) : senderHex;
const dateStr = match[3].replace(/\+\d{2}$/, "");
const date = this.parseCustomDate(dateStr);
if (isNaN(date)) {
console.error(`Invalid Date: ${dateStr}`);
continue;
}
const startIndex = cmglRegex.lastIndex;
const endIndex = data.indexOf("+CMGL:", startIndex) !== -1 ? data.indexOf("+CMGL:", startIndex) : data.length;
const messageHex = data.substring(startIndex, endIndex).trim();
const message = /^[0-9a-fA-F]+$/.test(messageHex) ? this.convertHexToText(messageHex) : messageHex;
if (lastIndex !== null && this.messages[lastIndex].sender === sender && (date - this.messages[lastIndex].date) / 1000 <= 1) {
this.messages[lastIndex].text += " " + message;
this.messages[lastIndex].indices.push(index);
this.dates[lastIndex] = this.formatDate(date);
} else {
this.messageIndices.push([index]);
this.senders.push(sender);
this.dates.push(this.formatDate(date));
this.messages.push({ text: message, sender: sender, date: date, indices: [index] });
lastIndex = this.messages.length - 1;
}
}
while ((match = cscaRegex.exec(data)) !== null) {
const serviceCenterHex = match[1];
const serviceCenter = this.convertHexToText(serviceCenterHex);
this.serviceCenters.push(serviceCenter);
}
},
// 将十六进制转换为文本(假设使用 UTF-16BE 编码)
convertHexToText(hex) {
const bytes = new Uint8Array(hex.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
return new TextDecoder('utf-16be').decode(bytes);
},
// 自定义解析日期函数
parseCustomDate(dateStr) {
const [datePart, timePart] = dateStr.split(',');
const [day, month, year] = datePart.split('/').map(part => parseInt(part, 10));
const [hour, minute, second] = timePart.split(':').map(part => parseInt(part, 10));
// 将日期转换为标准格式的日期对象
return new Date(Date.UTC(2000 + year, month - 1, day, hour, minute, second));
},
// 自定义格式化日期函数
formatDate(date) {
const year = date.getUTCFullYear() - 2000;
const month = (date.getUTCMonth() + 1).toString().padStart(2, '0');
const day = date.getUTCDate().toString().padStart(2, '0');
const hour = date.getUTCHours().toString().padStart(2, '0');
const minute = date.getUTCMinutes().toString().padStart(2, '0');
const second = date.getUTCSeconds().toString().padStart(2, '0');
return `${day}/${month}/${year},${hour}:${minute}:${second}`;
},
// 删除选中的短信
deleteSelectedSMS() {
if (this.selectedMessages.length === 0) {
console.warn("没有选中的短信");
return;
}
if (!this.messageIndices || this.messageIndices.length === 0) {
console.error("短信索引未正确初始化或为空");
return;
}
// 检查是否全选
const isAllSelected = this.selectedMessages.length === this.messages.length;
if (isAllSelected) {
// 如果全选,则调用删除所有短信的方法
this.deleteAllSMS();
} else {
// 否则,删除选中的短信
const indicesToDelete = [];
this.selectedMessages.forEach(index => {
indicesToDelete.push(...this.messages[index].indices);
});
if (indicesToDelete.length === 0) {
console.warn("没有有效的短信索引");
return;
}
// 拼接 AT 命令
const atCommands = indicesToDelete.map((index, i) => i === 0 ? `AT+CMGD=${index}` : `+CMGD=${index}`).join(';');
fetch(`/cgi-bin/get_atcommand?${new URLSearchParams({ atcmd: atCommands })}`)
.finally(() => {
this.selectedMessages = [];
this.requestSMS();
});
}
},
// 删除所有短信
deleteAllSMS() {
fetch(`/cgi-bin/get_atcommand?${new URLSearchParams({ atcmd: "AT+CMGD=,4" })}`)
.finally(() => {
this.init();
});
},
// 发送短信
encodeUCS2(input) {
let output = '';
for (let i = 0; i < input.length; i++) {
const hex = input.charCodeAt(i).toString(16).toUpperCase().padStart(4, '0');
output += hex;
}
return output;
},
async sendSMS() {
let phoneNumberWithCountryCode;
if (this.phoneNumber.length < 11) {
phoneNumberWithCountryCode = this.phoneNumber;
} else {
const serviceCenterPrefix = this.serviceCenters[0].substring(0, 3);
phoneNumberWithCountryCode = `${serviceCenterPrefix}${this.phoneNumber}`;
}
const encodedPhoneNumber = this.encodeUCS2(phoneNumberWithCountryCode);
const messageSegments = this.splitMessage(this.messageToSend, 70); // 将消息分段
const uid = Math.floor(Math.random() * 256); // 生成随机的UID
const totalSegments = messageSegments.length;
let allSegmentsSent = true;
let errorCode = null;
for (let i = 0; i < totalSegments; i++) {
const segment = messageSegments[i];
const encodedMessage = this.encodeUCS2(segment);
const currentSegment = i + 1;
const Command = `${uid},${currentSegment},${totalSegments}`;
const params = new URLSearchParams({
number: encodedPhoneNumber,
msg: encodedMessage,
Command: Command
});
try {
const response = await fetch(`/cgi-bin/send_sms?${params.toString()}`);
const data = await response.text();
console.log("Response from server:", data);
// 检查返回的数据中是否包含 '+CMS ERROR'
if (data.includes('+CMS ERROR')) {
errorCode = data.match(/\+CMS ERROR: (\d+)/)?.[1];
console.error("SMS send error:", data);
allSegmentsSent = false;
break; // 停止发送剩余的段
}
} catch (error) {
console.error("Fetch error:", error);
allSegmentsSent = false;
break; // 停止发送剩余的段
}
}
if (allSegmentsSent) {
this.showNotification("SMS sent successfully!");
} else {
this.showNotification(`SMS sending failed!: ${errorCode}`);
}
},
splitMessage(message, length) {
const segments = [];
for (let i = 0; i < message.length; i += length) {
segments.push(message.substring(i, i + length));
}
return segments;
},
showNotification(message, type) {
const notification = document.getElementById('notification');
notification.innerText = message;
notification.className = `alert alert-${type}`;
notification.style.display = 'block';
setTimeout(() => {
notification.style.display = 'none';
}, 3000); // 3秒后自动关闭
},
// 初始化
// Initialize
init() {
this.clearData();
this.requestSMS();
},
// 全选/取消全选
// Select all/deselect all
toggleAll(event) {
this.selectedMessages = event.target.checked ? this.messages.map((_, index) => index) : [];
}
};
}
</script>
</body>
</html>

View File

@@ -0,0 +1,275 @@
<!DOCTYPE html>
<html lang="en" data-bs-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Simple Admin</title>
<!-- Import all the bootstrap css files from css folder -->
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- Logo -->
<link rel="simpleadmin-logo" href="favicon.ico" />
<!-- Import BootStrap Javascript -->
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/alpinejs.min.js" defer></script>
<style>
.form-switch .form-check-input {
width: 2.4em;
height: 1.2em;
}
</style>
</head>
<body>
<main>
<div class="container my-4" x-data="simpleWatchCat()">
<nav class="navbar navbar-expand-lg mt-2">
<div class="container-fluid">
<a class="navbar-brand" href="/"
><span class="mb-0 h4">Simple Admin</span></a
>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarText"
aria-controls="navbarText"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav me-auto mb-2 ml-4 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/network.html">Simple Network</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/scanner.html">Simple Scan</a>
</li>
<li class="nav-item">
<a
class="nav-link active"
href="/settings.html"
aria-current="page"
>Simple Settings</a
>
</li>
<li class="nav-item">
<a class="nav-link" href="/sms.html">SMS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/console">Console</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/deviceinfo.html"
>Device Information</a
>
</li>
</ul>
<span class="navbar-text">
<button class="btn btn-link text-reset" id="darkModeToggle">
Dark Mode
</button>
</span>
</div>
</div>
</nav>
<div class="row mt-3 mb-4">
<div class="col">
<div class="card">
<div class="card-header">Simple Watchcat</div>
<div class="card-body">
<div class="card-text">
<div class="row mt-3 mb-5 align-content-center mx-4">
<div class="col">
<div class="mt-3">
<label> Enable Watchcat </label>
</div>
</div>
<div class="col-5">
<div class="mt-2">
<div class="form-check form-switch form-switch-lg">
<input
class="form-check-input"
type="checkbox"
role="switch"
id="watchCatSwitch"
x-model="watchCatStatus"
:disabled="!isFormComplete"
x-on:change="setWatchCatSettings"
/>
</div>
</div>
</div>
</div>
<div class="row mt-3 mb-3 align-items-center mx-4">
<div class="col">
<div class="mt-3 mb-4">
<label> Track IP </label>
</div>
<div class="mt-3 mb-4">
<label> Ping Request Timeout </label>
</div>
<div class="mt-3 mb-4">
<label> Ping Failure Amount </label>
</div>
</div>
<div class="col-5">
<div class="mt-3 mb-4">
<select
class="form-select"
aria-label="Select Site to Ping"
x-model="trackIP"
>
<option selected>Select IP</option>
<option value="1.1.1.1">1.1.1.1</option>
<option value="8.8.8.8">8.8.8.8</option>
<option value="9.9.9.9">9.9.9.9</option>
</select>
</div>
<div class="mt-3 mb-4">
<input
type="number"
class="form-control"
aria-label="Ping Timeout"
aria-describedby="inputGroup-sizing-default"
placeholder="Enter Ping Timeout in Seconds."
x-model="pingTimeout"
/>
</div>
<div class="mt-3 mb-4">
<input
type="number"
class="form-control"
aria-label="Sizing example input"
aria-describedby="inputGroup-sizing-default"
placeholder="Enter Ping Failure Amount."
x-model="pingFailureCount"
/>
</div>
</div>
</div>
</div>
</div>
<div class="card-footer">
Still under development. Coming soon...
</div>
</div>
</div>
</div>
<div class="row mt-3 mb-3">
<div class="col">
<div class="card">
<div class="card-header">Simple Watchcat Logs</div>
<div class="card-body">
<div class="card-text">
<div class="form-floating">
<textarea
class="form-control"
placeholder="Leave a comment here"
id="floatingTextarea2"
style="height: 100px"
x-text="response"
readonly
></textarea>
<label for="floatingTextarea2">Logs</label>
</div>
</div>
</div>
<div class="card-footer">
No log is provided when successfully enabling the watchcat.
</div>
</div>
</div>
</div>
</div>
</main>
<script src="js/dark-mode.js"></script>
<script>
function simpleWatchCat() {
return {
watchCatStatus: false, // Initialize as false (not enabled)
trackIP: "",
pingTimeout: "",
pingFailureCount: "",
response: "",
setWatchCatSettings() {
fetch(
"/cgi-bin/watchcat_maker?" +
new URLSearchParams({
WATCHCAT_ENABLED: this.watchCatStatus ? "enable" : "disable",
TRACK_IP: this.trackIP,
PING_TIMEOUT: this.pingTimeout,
PING_FAILURE_COUNT: this.pingFailureCount,
})
)
.then((response) => response.text()) // Convert response to text
.then((data) => {
this.response = data; // Store the response data
console.log(data); // Log the response for debugging
})
.then(() => {
this.fetchWatchCatSettings();
})
.catch((error) => {
console.error("Error:", error); // Handle any errors
this.response = "An error occurred.";
});
},
// Computed property to check if the form is complete
get isFormComplete() {
return (
this.trackIP !== "" &&
this.pingTimeout !== "" &&
this.pingFailureCount !== ""
);
},
// Fetch the current watchcat settings
fetchWatchCatSettings() {
fetch("/cgi-bin/get_watchcat_status")
.then((response) => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json(); // Parse response as JSON
})
.then((data) => {
console.log(data); // Log the parsed data for debugging
// Check if the JSON is not empty
if (data) {
this.watchCatStatus = data.enabled === true;
this.trackIP = data.track_ip;
this.pingTimeout = data.ping_timeout;
this.pingFailureCount = data.ping_failure_count;
}
})
.catch((error) => {
console.error("Error:", error); // Handle any errors
this.response = "An error occurred.";
});
},
init() {
this.fetchWatchCatSettings();
},
};
}
</script>
</body>
</html>

View File

@@ -0,0 +1,351 @@
<!DOCTYPE html>
<html lang="en" data-bs-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Simple Admin</title>
<!-- <link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous"
/> -->
<!-- Import all the bootstrap css files from css folder -->
<link rel="stylesheet" href="css/styles.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- Logo -->
<link rel="simpleadmin-logo" href="favicon.ico" />
<!-- Import BootStrap Javascript -->
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/alpinejs.min.js" defer></script>
<style>
.form-switch .form-check-input {
width: 2.4em;
height: 1.2em;
}
</style>
</head>
<body>
<main>
<div class="container my-4" x-data="simpleWatchCat()">
<nav class="navbar navbar-expand-lg mt-2">
<div class="container-fluid">
<a class="navbar-brand" href="/"
><span class="mb-0 h4">Simple Admin</span></a
>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarText"
aria-controls="navbarText"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav me-auto mb-2 ml-4 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/network.html">Simple Network</a>
</li>
<li class="nav-item">
<a
class="nav-link active"
href="/settings.html"
aria-current="page"
>Simple Settings</a
>
</li>
<li class="nav-item">
<a class="nav-link" href="/sms.html">SMS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/console">Console</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/deviceinfo.html"
>Device Information</a
>
</li>
</ul>
<span class="navbar-text">
<button class="btn btn-link text-reset" id="darkModeToggle">
Dark Mode
</button>
</span>
</div>
</div>
</nav>
<div class="row mt-3 mb-4">
<div class="col">
<div class="card">
<div class="card-header">Simple Watchcat</div>
<div class="card-body">
<div class="card-text">
<div class="row mt-3 mb-5 align-content-center mx-4">
<div class="col">
<div class="mt-3">
<label> Enable Watchcat </label>
</div>
</div>
<div class="col-5">
<div class="mt-2">
<div class="form-check form-switch form-switch-lg">
<input
class="form-check-input"
type="checkbox"
role="switch"
id="watchCatSwitch"
x-model="watchCatStatus"
:disabled="!isFormComplete"
x:onchange="setWatchCatSettings"
/>
</div>
</div>
</div>
</div>
<div class="row mt-3 mb-3 align-items-center mx-4">
<div class="col">
<div class="mt-3 mb-4">
<label> Track IP </label>
</div>
<div class="mt-3 mb-4">
<label> Ping Request Timeout </label>
</div>
<div class="mt-3 mb-4">
<label> Ping Failure Amount </label>
</div>
</div>
<div class="col-5">
<div class="mt-3 mb-4">
<select
class="form-select"
aria-label="Select Site to Ping"
x-model="trackIP"
>
<option selected>Select IP</option>
<option value="1.1.1.1">1.1.1.1</option>
<option value="8.8.8.8">8.8.8.8</option>
<option value="9.9.9.9">9.9.9.9</option>
</select>
</div>
<div class="mt-3 mb-4">
<input
type="number"
class="form-control"
aria-label="Ping Timeout"
aria-describedby="inputGroup-sizing-default"
placeholder="Enter Ping Timeout in Seconds."
x-model="pingTimeout"
/>
</div>
<div class="mt-3 mb-4">
<input
type="number"
class="form-control"
aria-label="Sizing example input"
aria-describedby="inputGroup-sizing-default"
placeholder="Enter Ping Failure Amount."
x-model="pingFailureCount"
/>
</div>
</div>
</div>
<!-- <div class="row mt-3 mb-5 align-content-center mx-4">
<div class="col">
<div class="mt-3">
<label>Sim Auto Switch</label>
</div>
</div>
<div class="col-5">
<div class="mt-2">
<div class="form-check form-switch form-switch-lg">
<input
class="form-check-input"
type="checkbox"
role="switch"
id="simAutoSwitch"
x-model="simAutoSwitchStatus"
disabled
/>
</div>
</div>
</div>
</div> -->
<!-- <div class="row mt-3 mb-3 align-items-center mx-4">
<div class="col">
<div class="mt-3 mb-4">
<label> Select Preferred SIM </label>
</div>
<div class="mt-3 mb-4">
<label> SIM 1 APN </label>
</div>
<div class="mt-3 mb-4">
<label> SIM 2 APN </label>
</div>
<div class="mt-3 mb-4">
<label> Failover Interval </label>
</div>
<div class="mt-3 mb-4">
<label> Scheduled SIM Hot Swap</label>
</div>
</div>
<div class="col-5">
<div class="mt-3 mb-3">
<select
class="form-select"
aria-label="Select Sim"
x-model="preferredSim"
>
<option selected>Select SIM</option>
<option value="1">SIM 1</option>
<option value="2">SIM 2</option>
</select>
</div>
<div class="mt-3 mb-3">
<input
type="number"
class="form-control"
aria-label="SIM 1 APN"
aria-describedby="inputGroup-sizing-default"
placeholder="Input APN for SIM 1. (Optional)"
x-model="sim1APN"
/>
</div>
<div class="mt-3 mb-3">
<input
type="number"
class="form-control"
aria-label="SIM 2 APN"
aria-describedby="inputGroup-sizing-default"
placeholder="Input APN for SIM 2. (Optional)"
x-model="sim2APN"
/>
</div>
<div class="mt-3 mb-3 d-flex align-items-center">
<select
class="form-select"
aria-label="Failover Interval"
>
<option selected>Failover Interval</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
<option value="20">20</option>
</select>
<label class="mx-3">Minutes</label>
</div>
<div class="mt-3 mb-3">
<input
type="time"
class="form-control"
aria-label="Scheduled SIM Hot Swap"
aria-describedby="inputGroup-sizing-default"
x-model="scheduledSIMHotSwap"
/>
</div>
</div>
</div> -->
</div>
</div>
<div class="card-footer">
<!-- Setting a low ping timeout and ping failure count may cause
intermittent disconnections due to high sensitivity. <br />
Select appropriate values for both based on your needs.<br /> -->
Still under development. Coming soon...
</div>
</div>
</div>
</div>
<div class="row mt-3 mb-3">
<div class="col">
<div class="card">
<div class="card-header">Simple Watchcat Logs</div>
<div class="card-body">
<div class="card-text">
<div class="form-floating">
<textarea
class="form-control"
placeholder="Leave a comment here"
id="floatingTextarea2"
style="height: 100px"
x-text="response"
readonly
></textarea>
<label for="floatingTextarea2">Logs Here</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<script src="js/dark-mode.js"></script>
<script>
function simpleWatchCat() {
return {
watchCatStatus: false,
trackIP: "",
pingTimeout: "",
pingFailureCount: "",
response: "",
setWatchCatSettings() {
fetch(
"/cgi-bin/watchcat_maker?" +
new URLSearchParams({
WATCHCAT_ENABLED: this.watchCatStatus,
TRACK_IP: this.trackIP,
PING_TIMEOUT: this.pingTimeout,
PING_FAILURE_COUNT: this.pingFailureCount,
})
)
.then((response) => response.text()) // Convert response to text
.then((data) => {
this.response = data; // Store the response data
console.log(data); // Log the response for debugging
})
.catch((error) => {
console.error("Error:", error); // Handle any errors
this.response = "An error occurred.";
});
},
// Computed property to check if the form is complete
get isFormComplete() {
return (
this.trackIP !== "" &&
this.pingTimeout !== "" &&
this.pingFailureCount !== ""
);
},
};
}
</script>
</body>
</html>

1
old/simplefirewall/.rev Normal file
View File

@@ -0,0 +1 @@
2

View File

@@ -1,7 +1,7 @@
#!/bin/bash
# Define the ports you want to block
PORTS=("80" "8080" "8088" "443") # Default ports, will be modified by the install script
PORTS=("80" "443") # Default ports, will be modified by the install script
# First, allow specified ports on bridge0, eth0, and tailscale0
for port in "${PORTS[@]}"; do

1
old/simpleupdates/.rev Normal file
View File

@@ -0,0 +1 @@
2

View File

@@ -0,0 +1,271 @@
#!/bin/bash
# Define constants
# Define GitHub repo info
GITUSER="iamromulan"
REPONAME="quectel-rgmii-toolkit"
GITTREE="development-SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
# Define filesystem path
DIR_NAME="simpleadmin"
SERVICE_FILE="/lib/systemd/system/install_simpleadmin.service"
SERVICE_NAME="install_simpleadmin"
TMP_SCRIPT="/tmp/install_simpleadmin.sh"
LOG_FILE="/tmp/install_simpleadmin.log"
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/usrdata/root/bin
# Tmp Script dependent constants
SIMPLE_ADMIN_DIR="/usrdata/simpleadmin"
# Function to remount file system as read-write
remount_rw() {
mount -o remount,rw /
}
# Function to remount file system as read-only
remount_ro() {
mount -o remount,ro /
}
# Installation Prep
remount_rw
systemctl daemon-reload
rm $SERVICE_FILE > /dev/null 2>&1
rm $SERVICE_NAME > /dev/null 2>&1
# Create the systemd service file
cat <<EOF > "$SERVICE_FILE"
[Unit]
Description=Update $DIR_NAME temporary service
[Service]
Type=oneshot
ExecStart=/bin/bash $TMP_SCRIPT > $LOG_FILE 2>&1
[Install]
WantedBy=multi-user.target
EOF
# Create and populate the temporary shell script for installation
cat <<EOF > "$TMP_SCRIPT"
#!/bin/bash
# Define GitHub repo info
GITUSER="iamromulan"
REPONAME="quectel-rgmii-toolkit"
GITTREE="development-SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
# Define filesystem path
SIMPLE_ADMIN_DIR="/usrdata/simpleadmin"
export HOME=/usrdata/root
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/usrdata/root/bin
# Function to remount file system as read-write
remount_rw() {
mount -o remount,rw /
}
# Function to remount file system as read-only
remount_ro() {
mount -o remount,ro /
}
remount_rw
uninstall_simpleadmin() {
echo "Uninstalling Simpleadmin..."
# Check if Lighttpd service is installed and remove it if present
if [ -f "/lib/systemd/system/lighttpd.service" ]; then
echo "Lighttpd detected, uninstalling Lighttpd webserver and its modules..."
systemctl stop lighttpd
rm -f /lib/systemd/system/lighttpd.service
opkg --force-remove --force-removal-of-dependent-packages remove lighttpd-mod-authn_file lighttpd-mod-auth lighttpd-mod-cgi lighttpd-mod-openssl lighttpd-mod-proxy lighttpd
fi
echo -e "\e[1;34mUninstalling simpleadmin content...\e[0m"
systemctl stop simpleadmin_generate_status
systemctl stop simpleadmin_httpd
rm -f /lib/systemd/system/simpleadmin_httpd.service
rm -f /lib/systemd/system/simpleadmin_generate_status.service
systemctl daemon-reload
echo -e "\e[1;34mUninstalling ttyd...\e[0m"
systemctl stop ttyd
rm -rf /usrdata/ttyd
rm -rf "$SIMPLE_ADMIN_DIR"
rm -f /lib/systemd/system/ttyd.service
rm -f /lib/systemd/system/multi-user.target.wants/ttyd.service
rm -f /bin/ttyd
echo -e "\e[1;32mttyd has been uninstalled.\e[0m"
echo "Uninstallation process completed."
}
install_lighttpd() {
# Check for simpleadmin_httpd service and remove if exists
if [ -f "/lib/systemd/system/simpleadmin_httpd.service" ]; then
systemctl stop simpleadmin_httpd
rm /lib/systemd/system/simpleadmin_httpd.service
rm /lib/systemd/system/multi-user.target.wants/simpleadmin_httpd.service
fi
/opt/bin/opkg install sudo lighttpd lighttpd-mod-auth lighttpd-mod-authn_file lighttpd-mod-cgi lighttpd-mod-openssl lighttpd-mod-proxy
# Ensure rc.unslung doesn't try to start it
# Dynamically find and remove any Lighttpd-related init script
for script in /opt/etc/init.d/*lighttpd*; do
if [ -f "$script" ]; then
echo "Removing existing Lighttpd init script: $script"
rm "$script" # Remove the script if it contains 'lighttpd' in its name
fi
done
systemctl stop lighttpd
echo -e "\033[0;32mInstalling/Updating Lighttpd...\033[0m"
mkdir -p "$SIMPLE_ADMIN_DIR"
wget -O "$SIMPLE_ADMIN_DIR/lighttpd.conf" $GITROOT/simpleadmin/lighttpd.conf
wget -O "/lib/systemd/system/lighttpd.service" $GITROOT/simpleadmin/systemd/lighttpd.service
ln -sf "/lib/systemd/system/lighttpd.service" "/lib/systemd/system/multi-user.target.wants/"
echo "www-data ALL = (root) NOPASSWD: /usr/sbin/iptables, /usr/sbin/ip6tables, /usrdata/simplefirewall/ttl-override, /bin/echo, /bin/cat" > /opt/etc/sudoers.d/www-data
openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 \
-subj "/C=US/ST=MI/L=Romulus/O=RMIITools/CN=localhost" \
-keyout $SIMPLE_ADMIN_DIR/server.key -out $SIMPLE_ADMIN_DIR/server.crt
systemctl daemon-reload
systemctl start lighttpd
echo -e "\033[0;32mLighttpd installation/update complete.\033[0m"
}
install_simpleadmin() {
remount_rw
echo -e "\e[1;31m2) Installing simpleadmin from the $GITTREE branch\e[0m"
mkdir $SIMPLE_ADMIN_DIR
mkdir $SIMPLE_ADMIN_DIR/systemd
mkdir $SIMPLE_ADMIN_DIR/script
mkdir $SIMPLE_ADMIN_DIR/console
mkdir $SIMPLE_ADMIN_DIR/console/menu
mkdir $SIMPLE_ADMIN_DIR/console/services
mkdir $SIMPLE_ADMIN_DIR/console/services/systemd
mkdir $SIMPLE_ADMIN_DIR/www
mkdir $SIMPLE_ADMIN_DIR/www/cgi-bin
mkdir $SIMPLE_ADMIN_DIR/www/css
mkdir $SIMPLE_ADMIN_DIR/www/js
mkdir $SIMPLE_ADMIN_DIR/www/fonts
cd $SIMPLE_ADMIN_DIR/systemd
wget $GITROOT/simpleadmin/systemd/lighttpd.service
sleep 1
cd $SIMPLE_ADMIN_DIR/script
wget $GITROOT/simpleadmin/script/ttl_script.sh
wget $GITROOT/simpleadmin/script/remove_watchcat.sh
wget $GITROOT/simpleadmin/script/create_watchcat.sh
sleep 1
cd $SIMPLE_ADMIN_DIR/console
wget $GITROOT/simpleadmin/console/.profile
sleep 1
cd $SIMPLE_ADMIN_DIR/console/menu
wget $GITROOT/simpleadmin/console/menu/start_menu.sh
ln -f $SIMPLE_ADMIN_DIR/console/menu/start_menu.sh /usrdata/root/bin/menu
wget $GITROOT/simpleadmin/console/menu/sfirewall_settings.sh
wget $GITROOT/simpleadmin/console/menu/start_menu.sh
sleep 1
cd $SIMPLE_ADMIN_DIR/www
wget $GITROOT/simpleadmin/www/deviceinfo.html
wget $GITROOT/simpleadmin/www/favicon.ico
wget $GITROOT/simpleadmin/www/index.html
wget $GITROOT/simpleadmin/www/network.html
wget $GITROOT/simpleadmin/www/settings.html
wget $GITROOT/simpleadmin/www/sms.html
wget $GITROOT/simpleadmin/www/scanner.html
wget $GITROOT/simpleadmin/www/watchcat.html
sleep 1
cd $SIMPLE_ADMIN_DIR/www/js
wget $GITROOT/simpleadmin/www/js/alpinejs.min.js
wget $GITROOT/simpleadmin/www/js/bootstrap.bundle.min.js
wget $GITROOT/simpleadmin/www/js/dark-mode.js
wget $GITROOT/simpleadmin/www/js/generate-freq-box.js
wget $GITROOT/simpleadmin/www/js/parse-settings.js
wget $GITROOT/simpleadmin/www/js/populate-checkbox.js
sleep 1
cd $SIMPLE_ADMIN_DIR/www/css
wget $GITROOT/simpleadmin/www/css/bootstrap.min.css
wget $GITROOT/simpleadmin/www/css/styles.css
wget $GITROOT/simpleadmin/www/css/all.min.css
sleep 1
cd $SIMPLE_ADMIN_DIR/www/fonts
wget $GITROOT/simpleadmin/www/fonts/poppins-v23-latin-300italic.woff2
wget $GITROOT/simpleadmin/www/fonts/poppins-v23-latin-300.woff2
wget $GITROOT/simpleadmin/www/fonts/poppins-v23-latin-500italic.woff2
wget $GITROOT/simpleadmin/www/fonts/poppins-v23-latin-500.woff2
wget $GITROOT/simpleadmin/www/fonts/poppins-v23-latin-600italic.woff2
wget $GITROOT/simpleadmin/www/fonts/poppins-v23-latin-600.woff2
wget $GITROOT/simpleadmin/www/fonts/poppins-v23-latin-700italic.woff2
wget $GITROOT/simpleadmin/www/fonts/poppins-v23-latin-700.woff2
wget $GITROOT/simpleadmin/www/fonts/poppins-v23-latin-italic.woff2
wget $GITROOT/simpleadmin/www/fonts/poppins-v23-latin-regular.woff2
sleep 1
cd $SIMPLE_ADMIN_DIR/www/cgi-bin
wget $GITROOT/simpleadmin/www/cgi-bin/get_atcommand
wget $GITROOT/simpleadmin/www/cgi-bin/user_atcommand
wget $GITROOT/simpleadmin/www/cgi-bin/get_ping
wget $GITROOT/simpleadmin/www/cgi-bin/get_sms
wget $GITROOT/simpleadmin/www/cgi-bin/get_ttl_status
wget $GITROOT/simpleadmin/www/cgi-bin/set_ttl
wget $GITROOT/simpleadmin/www/cgi-bin/send_sms
wget $GITROOT/simpleadmin/www/cgi-bin/get_uptime
wget $GITROOT/simpleadmin/www/cgi-bin/get_watchcat_status
wget $GITROOT/simpleadmin/www/cgi-bin/set_watchcat
wget $GITROOT/simpleadmin/www/cgi-bin/watchcat_maker
sleep 1
cd /
chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/*
chmod +x $SIMPLE_ADMIN_DIR/script/*
chmod +x $SIMPLE_ADMIN_DIR/console/menu/*
chmod +x $SIMPLE_ADMIN_DIR/console/.profile
cp -f $SIMPLE_ADMIN_DIR/console/.profile /usrdata/root/.profile
chmod +x /usrdata/root/.profile
cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system
sleep 1
systemctl daemon-reload
sleep 1
}
install_ttyd() {
echo -e "\e[1;34mStarting ttyd installation process...\e[0m"
cd $SIMPLE_ADMIN_DIR/console
curl -L -o ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.armhf && chmod +x ttyd
wget "$GITROOT/simpleadmin/console/ttyd.bash" && chmod +x ttyd.bash
cd $SIMPLE_ADMIN_DIR/systemd/
wget "$GITROOT/simpleadmin/systemd/ttyd.service"
cp -f $SIMPLE_ADMIN_DIR/systemd/ttyd.service /lib/systemd/system/
ln -sf /usrdata/simpleadmin/ttyd /bin
# Enabling and starting ttyd service
systemctl daemon-reload
ln -sf /lib/systemd/system/ttyd.service /lib/systemd/system/multi-user.target.wants/
systemctl start ttyd
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mFailed to start ttyd service. Please check the systemd service file and ttyd binary.\e[0m"
exit 1
fi
echo -e "\e[1;32mInstallation Complete! ttyd server is up.\e[0m"
}
uninstall_simpleadmin
install_lighttpd
install_simpleadmin
install_ttyd
remount_ro
exit 0
EOF
# Make the temporary script executable
chmod +x "$TMP_SCRIPT"
# Reload systemd to recognize the new service and start the update
systemctl daemon-reload
systemctl start $SERVICE_NAME

View File

@@ -0,0 +1,124 @@
#!/bin/bash
# Define constants
# Define GitHub repo info
GITUSER="iamromulan"
REPONAME="quectel-rgmii-toolkit"
GITTREE="development-SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
# Define filesystem path
DIR_NAME="simplefirewall"
SERVICE_FILE="/lib/systemd/system/install_simplefirewall.service"
SERVICE_NAME="install_simplefirewall"
TMP_SCRIPT="/tmp/install_simple_firewall.sh"
LOG_FILE="/tmp/install_simplefirewall.log"
# Tmp Script dependent constants
SIMPLE_FIREWALL_DIR="/usrdata/simplefirewall"
SIMPLE_FIREWALL_SCRIPT="$SIMPLE_FIREWALL_DIR/simplefirewall.sh"
SIMPLE_FIREWALL_SYSTEMD_DIR="$SIMPLE_FIREWALL_DIR/systemd"
# Function to remount file system as read-write
remount_rw() {
mount -o remount,rw /
}
# Function to remount file system as read-only
remount_ro() {
mount -o remount,ro /
}
remount_rw
# Create the systemd service file
cat <<EOF > "$SERVICE_FILE"
[Unit]
Description=Update $DIR_NAME temporary service
[Service]
Type=oneshot
ExecStart=/bin/bash $TMP_SCRIPT > $LOG_FILE 2>&1
[Install]
WantedBy=multi-user.target
EOF
# Create and populate the temporary shell script for installation
cat <<EOF > "$TMP_SCRIPT"
#!/bin/bash
# Define GitHub repo info
GITUSER="iamromulan"
REPONAME="quectel-rgmii-toolkit"
GITTREE="SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
# Define filesystem path
SIMPLE_FIREWALL_DIR="/usrdata/simplefirewall"
SIMPLE_FIREWALL_SCRIPT="$SIMPLE_FIREWALL_DIR/simplefirewall.sh"
SIMPLE_FIREWALL_SYSTEMD_DIR="$SIMPLE_FIREWALL_DIR/systemd"
# Function to remount file system as read-write
remount_rw() {
mount -o remount,rw /
}
# Function to remount file system as read-only
remount_ro() {
mount -o remount,ro /
}
remount_rw
# Function to remove Simple Firewall
uninstall_simple_firewall() {
echo "Uninstalling Simplefirewall..."
systemctl stop simplefirewall
systemctl stop ttl-override
rm -f /lib/systemd/system/simplefirewall.service
rm -f /lib/systemd/system/ttl-override.service
systemctl daemon-reload
rm -rf "$SIMPLE_FIREWALL_DIR"
echo "Simplefirewall uninstalled."
}
# Function to install Simple Firewall
install_simple_firewall() {
systemctl stop simplefirewall
systemctl stop ttl-override
echo -e "\033[0;32mInstalling/Updating Simple Firewall...\033[0m"
mount -o remount,rw /
mkdir -p "$SIMPLE_FIREWALL_DIR"
mkdir -p "$SIMPLE_FIREWALL_SYSTEMD_DIR"
wget -O "$SIMPLE_FIREWALL_DIR/simplefirewall.sh" $GITROOT/simplefirewall/simplefirewall.sh
wget -O "$SIMPLE_FIREWALL_DIR/ttl-override" $GITROOT/simplefirewall/ttl-override
wget -O "$SIMPLE_FIREWALL_DIR/ttlvalue" $GITROOT/simplefirewall/ttlvalue
chmod 666 $SIMPLE_FIREWALL_DIR/ttlvalue
chmod +x "$SIMPLE_FIREWALL_DIR/simplefirewall.sh"
chmod +x "$SIMPLE_FIREWALL_DIR/ttl-override"
wget -O "$SIMPLE_FIREWALL_SYSTEMD_DIR/simplefirewall.service" $GITROOT/simplefirewall/systemd/simplefirewall.service
wget -O "$SIMPLE_FIREWALL_SYSTEMD_DIR/ttl-override.service" $GITROOT/simplefirewall/systemd/ttl-override.service
cp -rf $SIMPLE_FIREWALL_SYSTEMD_DIR/* /lib/systemd/system
ln -sf "/lib/systemd/system/simplefirewall.service" "/lib/systemd/system/multi-user.target.wants/"
ln -sf "/lib/systemd/system/ttl-override.service" "/lib/systemd/system/multi-user.target.wants/"
systemctl daemon-reload
systemctl start simplefirewall
systemctl start ttl-override
echo -e "\033[0;32mSimple Firewall installation/update complete.\033[0m"
}
uninstall_simple_firewall
install_simple_firewall
remount_ro
exit 0
EOF
# Make the temporary script executable
chmod +x "$TMP_SCRIPT"
# Reload systemd to recognize the new service and start the update
systemctl daemon-reload
systemctl start $SERVICE_NAME

View File

@@ -0,0 +1,167 @@
#!/bin/bash
# Define constants
# Define GitHub repo info
GITUSER="iamromulan"
REPONAME="quectel-rgmii-toolkit"
GITTREE="development-SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
# Define filesystem path
DIR_NAME="socat-at-bridge"
SERVICE_FILE="/lib/systemd/system/install_socat-at-bridge.service"
SERVICE_NAME="install_socat-at-bridge"
TMP_SCRIPT="/tmp/install_socat-at-bridge.sh"
LOG_FILE="/tmp/install_socat-at-bridge.log"
# Tmp Script dependent constants
SOCAT_AT_DIR="/usrdata/socat-at-bridge"
SOCAT_AT_SYSD_DIR="/usrdata/socat-at-bridge/systemd_units"
# Function to remount file system as read-write
remount_rw() {
mount -o remount,rw /
}
# Function to remount file system as read-only
remount_ro() {
mount -o remount,ro /
}
remount_rw
# Create the systemd service file
cat <<EOF > "$SERVICE_FILE"
[Unit]
Description=Update $DIR_NAME temporary service
[Service]
Type=oneshot
ExecStart=/bin/bash $TMP_SCRIPT > $LOG_FILE 2>&1
[Install]
WantedBy=multi-user.target
EOF
# Create and populate the temporary shell script for installation
cat <<EOF > "$TMP_SCRIPT"
#!/bin/bash
# Define GitHub repo info
GITUSER="iamromulan"
REPONAME="quectel-rgmii-toolkit"
GITTREE="SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
# Define filesystem path
SOCAT_AT_DIR="/usrdata/socat-at-bridge"
SOCAT_AT_SYSD_DIR="/usrdata/socat-at-bridge/systemd_units"
# Function to remount file system as read-write
remount_rw() {
mount -o remount,rw /
}
# Function to remount file system as read-only
remount_ro() {
mount -o remount,ro /
}
remount_rw
uninstall_at_socat() {
echo -e "\033[0;32mRemoving installed AT Socat Bridge services...\033[0m"
systemctl stop at-telnet-daemon > /dev/null 2>&1
systemctl disable at-telnet-daemon > /dev/null 2>&1
systemctl stop socat-smd11 > /dev/null 2>&1
systemctl stop socat-smd11-to-ttyIN > /dev/null 2>&1
systemctl stop socat-smd11-from-ttyIN > /dev/null 2>&1
systemctl stop socat-smd7 > /dev/null 2>&1
systemctl stop socat-smd7-to-ttyIN2 > /dev/null 2>&1
systemctl stop socat-smd7-to-ttyIN > /dev/null 2>&1
systemctl stop socat-smd7-from-ttyIN2 > /dev/null 2>&1
systemctl stop socat-smd7-from-ttyIN > /dev/null 2>&1
rm /lib/systemd/system/at-telnet-daemon.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11-to-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd11-from-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-to-ttyIN2.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-to-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-from-ttyIN.service > /dev/null 2>&1
rm /lib/systemd/system/socat-smd7-from-ttyIN2.service > /dev/null 2>&1
systemctl daemon-reload > /dev/null 2>&1
rm -rf "$SOCAT_AT_DIR" > /dev/null 2>&1
}
install_at_socat() {
# Install service units
echo -e "\033[0;32mInstalling AT Socat Bridge services...\033[0m"
mkdir $SOCAT_AT_DIR
cd $SOCAT_AT_DIR
mkdir $SOCAT_AT_SYSD_DIR
wget $GITROOT/socat-at-bridge/socat-armel-static
wget $GITROOT/socat-at-bridge/killsmd7bridge
wget $GITROOT/socat-at-bridge/atcmd
wget $GITROOT/socat-at-bridge/atcmd11
cd $SOCAT_AT_SYSD_DIR
wget $GITROOT/socat-at-bridge/systemd_units/socat-smd11.service
wget $GITROOT/socat-at-bridge/systemd_units/socat-smd11-from-ttyIN.service
wget $GITROOT/socat-at-bridge/systemd_units/socat-smd11-to-ttyIN.service
wget $GITROOT/socat-at-bridge/systemd_units/socat-killsmd7bridge.service
wget $GITROOT/socat-at-bridge/systemd_units/socat-smd7-from-ttyIN2.service
wget $GITROOT/socat-at-bridge/systemd_units/socat-smd7-to-ttyIN2.service
wget $GITROOT/socat-at-bridge/systemd_units/socat-smd7.service
# Set execute permissions
cd $SOCAT_AT_DIR
chmod +x socat-armel-static
chmod +x killsmd7bridge
chmod +x atcmd
chmod +x atcmd11
# Link new command for AT Commands from the shell
ln -sf $SOCAT_AT_DIR/atcmd /bin
ln -sf $SOCAT_AT_DIR/atcmd11 /bin
# Install service units
echo -e "\033[0;32mAdding AT Socat Bridge systemd service units...\033[0m"
cp -rf $SOCAT_AT_SYSD_DIR/*.service /lib/systemd/system
ln -sf /lib/systemd/system/socat-killsmd7bridge.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd11.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd11-to-ttyIN.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd11-from-ttyIN.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd7.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd7-to-ttyIN2.service /lib/systemd/system/multi-user.target.wants/
ln -sf /lib/systemd/system/socat-smd7-from-ttyIN2.service /lib/systemd/system/multi-user.target.wants/
systemctl daemon-reload
systemctl start socat-smd11
sleep 2s
systemctl start socat-smd11-to-ttyIN
systemctl start socat-smd11-from-ttyIN
echo -e "\033[0;32mAT Socat Bridge service online: smd11 to ttyOUT\033[0m"
systemctl start socat-killsmd7bridge
sleep 1s
systemctl start socat-smd7
sleep 2s
systemctl start socat-smd7-to-ttyIN2
systemctl start socat-smd7-from-ttyIN2
echo -e "\033[0;32mAT Socat Bridge service online: smd7 to ttyOUT2\033[0m"
remount_ro
cd /
echo -e "\033[0;32mAT Socat Bridge services Installed!\033[0m"
}
uninstall_at_socat
install_at_socat
remount_ro
exit 0
EOF
# Make the temporary script executable
chmod +x "$TMP_SCRIPT"
# Reload systemd to recognize the new service and start the update
systemctl daemon-reload
systemctl start $SERVICE_NAME

View File

@@ -0,0 +1,90 @@
#!/bin/bash
# Define constants
# Define GitHub repo info
GITUSER="iamromulan"
REPONAME="quectel-rgmii-toolkit"
GITTREE="development-SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
# Define filesystem path
DIR_NAME="simpleupdates"
SERVICE_FILE="/lib/systemd/system/install_sshd.service"
SERVICE_NAME="install_sshd"
TMP_SCRIPT="/tmp/install_sshd.sh"
LOG_FILE="/tmp/install_sshd.log"
# Tmp Script dependent constants
# Create the systemd service file
cat <<EOF > "$SERVICE_FILE"
[Unit]
Description=Update $DIR_NAME temporary service
[Service]
Type=oneshot
ExecStart=/bin/bash $TMP_SCRIPT > $LOG_FILE 2>&1
[Install]
WantedBy=multi-user.target
EOF
# Create and populate the temporary shell script for installation
cat <<EOF > "$TMP_SCRIPT"
#!/bin/bash
# Define GitHub repo info
GITUSER="iamromulan"
REPONAME="quectel-rgmii-toolkit"
GITTREE="SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
install_sshd() {
echo -e "\e[1;32mOpenSSH Server\e[0m"
remount_rw
mkdir /usrdata/sshd
wget -O /lib/systemd/system/sshd.service "$GITROOT/sshd/sshd.service"
ln -sf "/lib/systemd/system/sshd.service" "/lib/systemd/system/multi-user.target.wants/"
opkg install openssh-server-pam
for script in /opt/etc/init.d/*sshd*; do
if [ -f "$script" ]; then
echo "Removing existing sshd init script: $script"
rm "$script" # Remove the script if it contains 'sshd' in its name
fi
done
/opt/bin/ssh-keygen -A
systemctl daemon-reload
systemctl enable sshd
# Enable PAM and PermitRootLogin
sed -i "s/^.*UsePAM .*/UsePAM yes/" "/opt/etc/ssh/sshd_config"
sed -i "s/^.*PermitRootLogin .*/PermitRootLogin yes/" "/opt/etc/ssh/sshd_config"
# Ensure the sshd user exists in the /opt/etc/passwd file
grep "sshd:x:106" /opt/etc/passwd || echo "sshd:x:106:65534:Linux User,,,:/opt/run/sshd:/bin/nologin" >> /opt/etc/passwd
systemctl start sshd
echo -e "\e[1;32mOpenSSH installed!!\e[0m"
}
install_sshd
exit 0
EOF
# Make the temporary script executable
chmod +x "$TMP_SCRIPT"
# Reload systemd to recognize the new service and start the update
systemctl daemon-reload
systemctl start $SERVICE_NAME

View File

@@ -0,0 +1,133 @@
#!/bin/bash
# Define constants
# Define GitHub repo info
GITUSER="iamromulan"
REPONAME="quectel-rgmii-toolkit"
GITTREE="development-SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
# Define filesystem path
DIR_NAME="tailscale"
SERVICE_FILE="/lib/systemd/system/install_tailscale.service"
SERVICE_NAME="install_tailscale"
TMP_SCRIPT="/tmp/install_tailscale.sh"
LOG_FILE="/tmp/install_tailscale.log"
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/usrdata/root/bin
# Tmp Script dependent constants
TAILSCALE_DIR="/usrdata/tailscale/"
TAILSCALE_SYSD_DIR="/usrdata/tailscale/systemd"
# Function to remount file system as read-write
remount_rw() {
mount -o remount,rw /
}
# Function to remount file system as read-only
remount_ro() {
mount -o remount,ro /
}
# Installation Prep
remount_rw
systemctl daemon-reload
rm $SERVICE_FILE > /dev/null 2>&1
rm $SERVICE_NAME > /dev/null 2>&1
# Create the systemd service file
cat <<EOF > "$SERVICE_FILE"
[Unit]
Description=Update $DIR_NAME temporary service
[Service]
Type=oneshot
ExecStart=/bin/bash $TMP_SCRIPT > $LOG_FILE 2>&1
[Install]
WantedBy=multi-user.target
EOF
# Create and populate the temporary shell script for installation
cat <<EOF > "$TMP_SCRIPT"
#!/bin/bash
export HOME=/usrdata/root
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/usrdata/root/bin
# Define GitHub repo info
GITUSER="iamromulan"
REPONAME="quectel-rgmii-toolkit"
GITTREE="SDXLEMUR"
GITMAINTREE="SDXLEMUR"
GITDEVTREE="development-SDXLEMUR"
GITROOT="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITTREE"
GITROOTMAIN="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITMAINTREE"
GITROOTDEV="https://raw.githubusercontent.com/$GITUSER/$REPONAME/$GITDEVTREE"
# Define filesystem path
TAILSCALE_DIR="/usrdata/tailscale/"
TAILSCALE_SYSD_DIR="/usrdata/tailscale/systemd"
# Function to remount file system as read-write
remount_rw() {
mount -o remount,rw /
}
# Function to remount file system as read-only
remount_ro() {
mount -o remount,ro /
}
install_update_tailscale() {
echo "Checking if Tailscale is already installed..."
if [ -f "$TAILSCALE_DIR/tailscale" ]; then
echo "Tailscale binary found. Updating Tailscale..."
ln -sf "$TAILSCALE_DIR/tailscale" "/usrdata/root/bin/tailscale"
echo y | $TAILSCALE_DIR/tailscale update
echo -e "\e[32mTailscale updated!\e[0m"
remount_ro
exit 0
else
echo "Installing Tailscale..."
mkdir -p "$TAILSCALE_DIR" "$TAILSCALE_SYSD_DIR"
echo "Downloading binary files..."
cd /usrdata
curl -O https://pkgs.tailscale.com/stable/tailscale_1.76.1_arm.tgz
tar -xzf tailscale_1.76.1_arm.tgz
rm tailscale_1.76.1_arm.tgz
cd /usrdata/tailscale_1.76.1_arm
mv tailscale tailscaled "$TAILSCALE_DIR/"
rm -rf /usrdata/tailscale_1.76.1_arm
echo "Downloading systemd files..."
cd "$TAILSCALE_SYSD_DIR"
wget $GITROOT/tailscale/systemd/tailscaled.service
wget $GITROOT/tailscale/systemd/tailscaled.defaults
sleep 2s
echo "Setting Permissions..."
chmod +x "$TAILSCALE_DIR/tailscaled" "$TAILSCALE_DIR/tailscale"
echo "Copying systemd units..."
cp -rf "$TAILSCALE_SYSD_DIR"/* /lib/systemd/system/
ln -sf /lib/systemd/system/tailscaled.service /lib/systemd/system/multi-user.target.wants/
systemctl daemon-reload
echo "Starting Tailscaled..."
systemctl start tailscaled
cd /
ln -sf /usrdata/tailscale/tailscale /usrdata/root/bin
remount_ro
echo -e "\e[32mTailscale installed successfully.\e[0m"
exit 0
fi
}
# Execute the function
install_update_tailscale
exit 0
EOF
# Make the temporary script executable
chmod +x "$TMP_SCRIPT"
# Reload systemd to recognize the new service and start the update
systemctl daemon-reload
systemctl start $SERVICE_NAME

View File

@@ -0,0 +1,12 @@
# Enable or disable update checks
CONF_ENABLED=no
# Check for updates at boot
CHECK_AT_BOOT=no
# Update frequency: daily, weekly, monthly, or none
UPDATE_FREQUENCY=none
# Scheduled time for updates (24-hour UTC format)
SCHEDULED_TIME=00:00
# Day for weekly updates (e.g., Mon, Tues, Wed, Thurs, Fri)
WEEKLY_DAY=
# Date for monthly updates (e.g., 15 for the 15th of the month)
MONTHLY_DATE=

View File

@@ -0,0 +1,255 @@
#!/bin/bash
# Configuration and directories
CONFIG_FILE="/usrdata/simpleupdates/simpleupdate.conf"
GITUSER="iamromulan"
GITTREE="main"
DIRECTORIES=("simpleadmin" "socat-at-bridge" "simplefirewall" "tailscale" "ttyd")
BASE_URL="https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE"
LOG_FILE="/tmp/simpleupdate.log"
# Load configuration
load_config() {
if [[ -f "$CONFIG_FILE" ]]; then
source "$CONFIG_FILE"
else
echo "Configuration file ($CONFIG_FILE) not found."
exit 1
fi
}
# Function to trim the log file to the last 100 lines
trim_log_file() {
tail -n 100 "$LOG_FILE" > "$LOG_FILE.tmp" && mv "$LOG_FILE.tmp" "$LOG_FILE"
}
# Function to check for updates
check_for_updates() {
echo "$(date): Checking for updates..."
for dir in "${DIRECTORIES[@]}"; do
local remote_rev=$(wget -qO- "$BASE_URL/$dir/.rev")
local local_rev_file="/usrdata/$dir/.rev"
if [[ ! -f "$local_rev_file" ]]; then
echo "No local revision file found for $dir, skipping."
continue
fi
local local_rev=$(cat "$local_rev_file")
if [[ "$remote_rev" -gt "$local_rev" ]]; then
echo "Update available for $dir, updating..."
wget -qO "/tmp/update_${dir}.sh" "$BASE_URL/simpleupdates/scripts/update_${dir}.sh"
chmod +x "/tmp/update_${dir}.sh"
"/tmp/update_${dir}.sh"
else
echo "$dir is up to date."
fi
done
trim_log_file
wait_to_update
}
# Function to wait and trigger updates based on scheduling
wait_to_update() {
echo "Waiting for the next update check according to schedule..."
while true; do
local current_time=$(date "+%H:%M")
local current_day=$(date "+%a")
local current_date=$(date "+%d")
case $UPDATE_FREQUENCY in
daily)
if [[ "$current_time" == "$SCHEDULED_TIME" ]]; then
check_for_updates
fi
;;
weekly)
if [[ "$current_day" == "$WEEKLY_DAY" && "$current_time" == "$SCHEDULED_TIME" ]]; then
check_for_updates
fi
;;
monthly)
if [[ "$current_date" == "$MONTHLY_DATE" && "$current_time" == "$SCHEDULED_TIME" ]]; then
check_for_updates
fi
;;
none)
echo "Update checking is disabled by frequency setting."
exit 0
;;
esac
sleep 30 # Sleep for 30 seconds for more granular checks
trim_log_file
done
}
# Daemon mode to wait and trigger updates based on scheduling
daemon_mode() {
load_config
exec > >(tee -a "$LOG_FILE") 2>&1
echo "Daemon mode started."
# Validate only one update frequency is defined
frequency_count=0
[[ "$UPDATE_FREQUENCY" == "daily" ]] && ((frequency_count++))
[[ "$UPDATE_FREQUENCY" == "weekly" ]] && ((frequency_count++))
[[ "$UPDATE_FREQUENCY" == "monthly" ]] && ((frequency_count++))
if [[ $frequency_count -gt 1 ]]; then
echo "Error: More than one update frequency is defined. Exiting."
exit 1
elif [[ $frequency_count -eq 0 && "$UPDATE_FREQUENCY" != "none" ]]; then
echo "Error: No valid update frequency defined. Exiting."
exit 1
fi
if [[ "$CONF_ENABLED" == "no" ]]; then
echo "Updates are disabled in the configuration."
exit 0
fi
if [[ "$CHECK_AT_BOOT" == "yes" ]]; then
check_for_updates
else
wait_to_update
fi
}
# Function to check for updates
force_check_for_updates() {
echo "$(date): Checking for updates..."
for dir in "${DIRECTORIES[@]}"; do
local remote_rev=$(wget -qO- "$BASE_URL/$dir/.rev")
local local_rev_file="/usrdata/$dir/.rev"
if [[ ! -f "$local_rev_file" ]]; then
echo "No local revision file found for $dir, skipping."
continue
fi
local local_rev=$(cat "$local_rev_file")
if [[ "$remote_rev" -gt "$local_rev" ]]; then
echo "Update available for $dir, updating..."
wget -qO "/tmp/update_${dir}.sh" "$BASE_URL/simpleupdates/scripts/update_${dir}.sh"
chmod +x "/tmp/update_${dir}.sh"
"/tmp/update_${dir}.sh"
else
echo "$dir is up to date."
fi
done
exit 0
}
# Helper function to load and update the configuration
update_config() {
local key="$1"
local value="$2"
if grep -q "^$key=" "$CONFIG_FILE"; then
sed -i "s|^$key=.*|$key=$value|" "$CONFIG_FILE"
else
echo "$key=$value" >> "$CONFIG_FILE"
fi
}
# Display the current configuration status
status() {
echo "Current Configuration Status:"
if [[ -f "$CONFIG_FILE" ]]; then
while IFS= read -r line; do
echo "$line"
done < "$CONFIG_FILE"
else
echo "Configuration file not found."
fi
}
# Enable automatic updates
enable_updates() {
update_config "CONF_ENABLED" "yes"
echo "Automatic updates have been enabled."
}
# Disable automatic updates
disable_updates() {
update_config "CONF_ENABLED" "no"
echo "Automatic updates have been disabled."
}
# Interactive setup for the update configuration
setup() {
read -p "Enable automatic updates? [yes/no]: " enable_updates
if [[ "$enable_updates" == "yes" ]]; then
enable_updates
else
disable_updates
fi
read -p "Check for updates at boot? [yes/no]: " check_boot
update_config "CHECK_AT_BOOT" "$check_boot"
read -p "Update frequency (none, daily, weekly, monthly): " frequency
update_config "UPDATE_FREQUENCY" "$frequency"
case $frequency in
daily)
read -p "Scheduled time (HH:MM in 24-hour format): " time
update_config "SCHEDULED_TIME" "$time"
;;
weekly)
echo "Please enter the day of the week."
read -p "Day (full name or abbreviation, e.g., Monday or Mon): " day_input
# Normalize input to abbreviated form
day_abbr=$(date -d "$day_input" +%a 2>/dev/null)
if [[ $? -ne 0 ]]; then
echo "Invalid day of the week. Please try again."
return 1
fi
update_config "WEEKLY_DAY" "$day_abbr"
read -p "Scheduled time (HH:MM in 24-hour format): " time
update_config "SCHEDULED_TIME" "$time"
;;
monthly)
read -p "Date of the month (1-31): " date
update_config "MONTHLY_DATE" "$date"
read -p "Scheduled time (HH:MM in 24-hour format): " time
update_config "SCHEDULED_TIME" "$time"
;;
*)
echo "No scheduling will be set."
;;
esac
echo "Update configuration has been set."
}
# Command operations: status, enable, disable, update, setup
case "$1" in
d)
daemon_mode
;;
update)
load_config
force_check_for_updates
;;
status)
status
;;
enable)
enable_updates
;;
disable)
disable_updates
;;
setup)
setup
;;
*)
echo "Usage:"
echo "d: Run as a background check daemon"
echo "update: Force check for and install updates"
echo "status: Display current set update schedule"
echo "enable: Enable automatic updates"
echo "disable: Disable automatic updates"
echo "setup: Set up an automatic update schedule"
;;
esac

View File

@@ -0,0 +1,10 @@
[Unit]
Description=Simple Update Daemon
After=network.target
[Service]
Type=simple
ExecStart=/usrdata/simpleupdates/simpleupdate d
[Install]
WantedBy=multi-user.target

1
old/socat-at-bridge/.rev Normal file
View File

@@ -0,0 +1 @@
2

View File

@@ -10,24 +10,15 @@ setup_device() {
-echoctl -echoke noflsh -ixon -crtscts
}
# Prepare the device for communication
setup_device
echo -e "\033[0;36mType 'exit' to end the session.\033[0m"
while true; do
echo -en "\033[0;36mEnter AT Command: \033[0m"
read user_input
if [[ "$user_input" == "exit" ]]; then
echo -e "\033[0;32mExiting...\033[0m"
break
fi
# Function to send AT command and capture the output
send_at_command() {
local command="$1"
# Clear the device buffer before sending a new command
echo -n > $DEVICE
# Send the AT command
echo -e "$user_input\r" > $DEVICE
# Send the AT command, preserving the integrity of the input
echo -e "$command\r" > $DEVICE
# Use a temporary file to capture the command output
tmpfile=$(mktemp)
@@ -52,4 +43,27 @@ while true; do
# Clean up
rm "$tmpfile"
done
}
# Prepare the device for communication
setup_device
# Check if an AT command is provided as an argument
if [ $# -gt 0 ]; then
# Concatenate all arguments to handle commands with spaces and/or quotes correctly
FULL_CMD="$*"
send_at_command "$FULL_CMD"
else
echo -e "\033[0;36mType 'exit' to end the session.\033[0m"
while true; do
echo -en "\033[0;36mEnter AT Command: \033[0m"
read user_input
if [[ "$user_input" == "exit" ]]; then
echo -e "\033[0;32mExiting...\033[0m"
break
fi
send_at_command "$user_input"
done
fi

View File

@@ -0,0 +1,69 @@
#!/bin/bash
DEVICE=/dev/ttyOUT
BAUD=115200
# Function to setup device communication parameters
setup_device() {
stty -F $DEVICE cs8 $BAUD ignbrk -brkint -icrnl -imaxbel \
-opost -onlcr -isig -icanon -iexten -echo -echoe -echok \
-echoctl -echoke noflsh -ixon -crtscts
}
# Function to send AT command and capture the output
send_at_command() {
local command="$1"
# Clear the device buffer before sending a new command
echo -n > $DEVICE
# Send the AT command, preserving the integrity of the input
echo -e "$command\r" > $DEVICE
# Use a temporary file to capture the command output
tmpfile=$(mktemp)
# Start reading the device output to the temporary file
cat $DEVICE > "$tmpfile" &
CAT_PID=$!
# Monitor the output file for "OK" or "ERROR"
while ! grep -qe "OK" -e "ERROR" "$tmpfile"; do
sleep 1
done
# Kill the `cat` process after capturing the response
kill $CAT_PID
wait $CAT_PID 2>/dev/null
# Display the response
cat "$tmpfile" | while IFS= read -r line; do
echo -e "\033[0;32m$line\033[0m"
done
# Clean up
rm "$tmpfile"
}
# Prepare the device for communication
setup_device
# Check if an AT command is provided as an argument
if [ $# -gt 0 ]; then
# Concatenate all arguments to handle commands with spaces and/or quotes correctly
FULL_CMD="$*"
send_at_command "$FULL_CMD"
else
echo -e "\033[0;36mType 'exit' to end the session.\033[0m"
while true; do
echo -en "\033[0;36mEnter AT Command: \033[0m"
read user_input
if [[ "$user_input" == "exit" ]]; then
echo -e "\033[0;32mExiting...\033[0m"
break
fi
send_at_command "$user_input"
done
fi

Some files were not shown because too many files have changed in this diff Show More