Commit Graph

347 Commits

Author SHA1 Message Date
taamarin
f61566bb2a refactor(scripts): simplify inotify & utils with busybox awk and case logic
- Replaced awk with busybox awk for better compatibility on Android.
- Simplified logging function indentation in ctr.inotify.
- Added clean_old_logs using busybox awk for log retention (24h).
- Unified service control logic:
  - Use case for WiFi blacklist/whitelist matching.
  - Consistent calls to ${scripts_dir}/box.service and ${scripts_dir}/box.iptables.
- Improved SSID retrieval:
  - Use cmd wifi status as primary method.
  - Fallback to iwconfig when available.
- Updated is_allowed_wifi:
  - Convert array → comma-separated string internally.
  - Trim spaces on SSID and list entries before comparison.
- Removed unused service_script and iptables_script vars.
- More descriptive log outputs for network events.

This refactor reduces duplication, improves Android compatibility,
and makes WiFi service control logic more maintainable.
2025-08-23 09:03:36 +07:00
github-actions[bot]
2fbb36924d v1.10.0 2025-08-21 14:25:14 +07:00
taamarin
5378a141ee fix(network-switch): improve WiFi SSID list handling
- Changed log file path from Networkswitch_debug.log to netswitch.log
- Updated WiFi SSID check to properly handle array values from settings.ini
- Modified is_allowed_wifi to accept array arguments instead of comma-separated strings
- Adjusted calls to is_allowed_wifi in ctr.inotify to pass array correctly
2025-08-21 14:24:40 +07:00
taamarin
28056d9358 chore(scripts): remove tun_forward_ip_rules support
Hotspot issue in sing-tun might have already been fixed:
https://github.com/SagerNet/sing-tun
2025-08-19 09:32:38 +07:00
taamarin
bafca21025 fix: improve logging, startup handling, and binary checks 2025-08-18 09:05:31 +07:00
taamarin
d28ba2f645 scripts: add settings.ini validation to all entry scripts
- Added syntax validation for `/data/adb/box/settings.ini` at the start of:
  * box.inotify
  * box.iptables
  * box.service
  * box.tool
  * ctr.inotify
  * start.sh
- If validation fails, an error message is logged to
  `/data/adb/box/run/settings_err.log` and the script exits immediately.
- Ensures misconfigured settings.ini do not break runtime scripts.
2025-08-17 05:23:42 +07:00
taamarin
7cb8f49373 refactor(customize): improve binary update flow and mirror selection 2025-08-16 20:04:15 +07:00
taamarin
823f262363 box.service: refine log cleanup rules
- Change log retention from 3 days → 1 day
- Include both *.log and *.bak in cleanup target
2025-08-16 14:46:01 +07:00
taamarin
b8a51ee1c2 feat: introduce network-based service control with Wi-Fi/SSID options 2025-08-16 14:46:01 +07:00
taamarin
042d079b17 feat(clash): add support for multiple subscription URLs and configs
- subscription_url_clash now supports arrays for multiple URLs
- name_provide_clash_config updated to support arrays matching the URLs
- Added validation to ensure URL and config counts match
- When renew=true, only the first index is processed
- Loop through all subscriptions for clash_provide_config updates
- Improved logging for mismatches and update failures
- Refactored clash_provide_config to use base path clash_provide_path
- Updated settings.ini:
  - subscription_url_clash → array
  - name_provide_clash_config → array
  - default renew=false (fetch proxies only)
2025-08-16 14:45:54 +07:00
taamarin
515eae8447 feat: improve install & update flow, add progress bars, ghfast prompt, and logging polish
- box.service:
  • Add check for empty interva_update before scheduling GeoX & subscription updates
  • Improve logging for crontab setup

- box.tool:
  • Change ghproxy URL to https://ghfast.top
  • Add --progress-bar to curl commands for better download visibility
  • Suppress noisy extraction outputs, log only success/failure
  • Cleanup temp files after updates (SHA256SUMS, yq.bak)
  • Improve GeoX update logs with timestamp and bin_name
  • Return 1 instead of exiting for failed downloads in upkernel
  • Minor log output polish and error suppression

- customize.sh:
  • Add interactive prompt for enabling ghfast mirror before downloads
  • Improve Kernel & GeoX download prompt with auto-download fallback
  • Enhance restore process with per-component logging
  • Add detailed extraction and permission setup logs
  • Final polish on cleanup, symlink creation, and completion messages

- module.prop:
  • Update module name to “Box for Magisk/KernelSU/APatch”
2025-08-14 09:02:36 +07:00
taamarin
f13c8608bb feat(subscriptions): add sing-box subscription support
- Added subscription update support for sing-box:
  - Downloads config from subscription_url_singbox.
  - Restarts service if update is successful.
- Updated settings.ini:
  - Added subscription_url_singbox entry.
2025-08-13 15:40:26 +07:00
taamarin
e9eda0e417 fix(subscription): restart box.service on subscription update, if renew=true 2025-08-13 08:30:40 +07:00
taamarin
acfa76b2af fix: create clash_provide_config file and update subscription settings
- Improved comments in settings.ini for better clarity on renew behavior and subscription URL usage.
2025-08-13 07:29:37 +07:00
taamarin
768d5bbeb5 feat: improve logging, add help menus, and enhance update/reload routines
- box.inotify: redirect service actions to inotify.log instead of service.log
- box.iptables: add help|-h|--help commands with usage descriptions, remove color codes from errors
- box.service:
  - rewrite log cleanup to timestamped backup with clearer messages
  - add help menu for service control commands
  - remove unnecessary inline comments
- box.tool:
  - add detailed logging for config checks, reload, and update operations
  - improve error handling and skip steps on failure
  - add backup steps before updating curl, yq, and other binaries
  - enhance geo data update with explicit logging and cleanup
  - refine kernel updates for sing-box, clash, xray/v2fly, hysteria with clearer output and checks
  - improve cgroup management log messages
  - add comprehensive help menu for all commands
2025-08-11 07:17:23 +07:00
taamarin
82618ef4e4 fix: revert socket MARK rules in box.iptables to restore UDP connectivity
Ref: https://github.com/taamarin/box_for_magisk/issues/195
2025-08-09 14:45:48 +07:00
taamarin
0dcebed687 fix(service): add unified config error handler to update module status 2025-08-09 11:49:02 +07:00
taamarin
256c06f045 feat(service): improve config file handling (Sync BFR Manager) 2025-08-09 11:49:02 +07:00
taamarin
d8a5229700 chore(scripts): unify output suppression format to >/dev/null 2>&1 2025-08-09 11:48:48 +07:00
github-actions[bot]
275b04ea44 v1.9.1 2025-08-09 11:09:03 +07:00
taamarin
19641a3f14 ci: refine release workflow 2025-08-02 07:21:40 +07:00
taamarin
5c1c5a72bd fix(iptables): switch to --set-xmark and reorder TProxy skip e4114de391 2025-08-02 03:46:56 +07:00
taamarin
a40d57cd96 v1.9.0 2025-07-20 06:22:54 +07:00
taamarin
0a59c0448a fix(box): use busybox paste for better compatibility on older Android 2025-07-20 04:24:38 +07:00
taamarin
128006d6e4 Update README 2025-07-20 02:46:11 +07:00
taamarin
97e2db3781 fix(box): remove all '0:, 10: and :999' prefixes from package list in Clash(tun) config 2025-07-20 02:05:12 +07:00
taamarin
42b355f0e4 fix: sanitize package list before inserting into config
- Remove "0:" prefix from package names before injecting into Sing-box and Clash configurations.
- Ensures consistent formatting of include/exclude package lists.
- Prevents malformed entries in sing_config and clash_config.
2025-07-20 01:26:39 +07:00
NOOBie
b4a2c00ee2 fix: duplicate dns address output on some devices (#191) 2025-07-10 22:50:14 +07:00
taamarin
2dcc4ca30d Updated find_packages_uid() to compute UID based on user ID and app ID for entries like "user:package". 2025-07-10 21:16:54 +07:00
taamarin
361e4210f5 feat: Add sbfr shortcut for direct execution 2025-06-25 15:29:26 +07:00
ratabb
c9c4be52b0 Improve box.iptables logic with Android version check via major version parsing (#189) 2025-06-18 17:51:21 +07:00
taamarin
16f2455413 update readme 2025-06-17 01:48:43 +07:00
taamarin
cac3186215 hysteria: update config and Validated network_mode in iptables and service 2025-06-16 01:06:22 +07:00
twnesss
c80f57a024 Extend routing/NAT rules for tun device
- Add POSTROUTING MASQUERADE rule for tun interface
- Re-enable IPv6 rules for ULA (`fc00::/7`, `fd00::/8`) and link-local (`fe80::/10`)
2025-06-03 20:17:25 +07:00
twnesss
a8ee2493a9 feat(cgroup): refactor memcg/cpuset/blkio logic, update settings
- Parameterize PID file and fallback values
- Improve detection and assignment of cgroup paths
- Update default memcg limit to 100M, cpuset CPU range, blkio weight
- Refine CPU core detection using /proc/[pid]/stat
2025-05-26 10:29:32 +07:00
twnesss
3b6fe424c9 refactor: simplify sing-box(1.12+) config, remove legacy rules and sniff options 2025-05-25 23:31:44 +07:00
twnesss
b43b05937a feat(cron): improve crond handling and cleanup
- Replaced existing crond startup logic with cleaner, safer implementation.
- Added `pkill` fallback mechanism for stopping `crond`.
- Removed redundant `touch` and `chmod` on crontab file; now using descriptive header and appending additional config from `crontab.cfg`.
- Adjusted logging messages for clarity ("crond enable"/"crond disable").
- Updated service status emojis in `description=` fields for better UX.
2025-05-25 23:10:53 +07:00
Шоколад
1619f1944c fix: force redir-host mode when fake-ip is used with GID, packages, or AP ignore list 2025-05-02 10:18:16 +07:00
ratabb
02f1be31b2 Filters out local DNS info ipv4 only & local IP as array (#182)
* info local DNS only ipv4
* info local IP treat as array, same as local DNS
2025-03-15 17:59:16 +07:00
ratabb
13e773c861 add info local IP & DNS at box.services status (#180) 2025-03-05 23:41:04 +07:00
Agus Suristyono
6b8d7005a2 Add skip_mount to prevent suspicious mountpoint detections. (#179)
* Add skip_mount to prevent suspicious mountpoints.

Since the scripts and binary had it's own separate folder, we don't need to mount anything on top of overlayfs.
This prevent detection of suspicious mountpoints.
Documentation: https://topjohnwu.github.io/Magisk/guides.html#magisk-modules

* add skip_mount extraction command to customize.sh

forgot about that, silly me :P
2025-02-20 20:00:42 +07:00
Шоколад
9fbaa9914b Misc 2025-02-09 12:24:51 +07:00
Шоколад
8b000cd4c2 feat: update TUN device handling https://github.com/taamarin/box_for_magisk/issues/177
- Change default TUN device from utun to meta (Clash).
- Rename TUN interface from utun9 to sing (Sing-Box).
- Disable /dev/net/tun creation.
- Set mixed as the default stack.
2025-02-09 01:31:37 +07:00
Шоколад
80c5d7313c Update upload-artifact action from v3 to v4 2025-02-03 19:52:42 +07:00
Шоколад
1672bb721f refactor box.iptables: Improve readability and structure 2025-02-03 19:51:19 +07:00
Шоколад
982a1aad5e fix condition for fake-ip range in box.iptables based on enhanced-mode 2025-01-16 14:19:48 +07:00
Шоколад
57f9dbd4d1 feat: Improve download handling by adding curl fallback 2024-12-25 17:14:50 +07:00
Шоколад
7caf827136 Added logic to use curl if available for file downloading, falling back to wget if curl is not found. https://github.com/taamarin/box_for_magisk/issues/172 2024-12-25 15:30:47 +07:00
Шоколад
1278e2a635 v1.8 2024-12-22 18:10:41 +07:00
dependabot-preview[bot]
6abd57ab6e readme 2024-12-14 21:17:45 +07:00