This project is not responsible for: damaged devices, corrupted SD cards, or burnt SoCs.
Please ensure that your configuration files do not cause traffic loops, as this can result in your phone continuously restarting.
If you have no idea how to configure this module, you may need applications such as ClashForAndroid, ClashMetaForAndroid, v2rayNG, Surfboard, SagerNet, AnXray, NekoBox, etc.
- Download the module's zip package from the RELEASE and install it through
Magisk
/KernelSU
. During installation, you will be asked whether to download the complete package. You can choose either complete download or separate download later, then reboot your device. - This mod supports direct updates in
Magisk Manager
(updated mods will take effect without rebooting the device).
This module includes the following kernels:
The corresponding configuration for the kernel is ${bin_name}
, which can be set to (clash
| xray
| v2ray
| sing-box
).
Each core operates in the directory /data/adb/box/bin/${bin_name}
, and the core name is determined by the bin_name
in the /data/adb/box/settings.ini
file.
Make sure you are connected to the internet and run the following command to update the kernel file:
# Update the selected kernel, based on `${bin_name}`.
su -c /data/adb/box/scripts/box.tool upcore
If you are using clash/sing-box
as the selected kernel, you may also need to run the following command to open the control panel:
# Update the admin panel for `clash/sing-box`.
su -c /data/adb/box/scripts/box.tool upyacd
Alternatively, you can do it all at once (which may consume unnecessary storage space).
# Update all files, including various kernel types.
su -c /data/adb/box/scripts/box.tool all
The following core services are referred to as BFM:
- The following core services are collectively referred to as BFM.
- You can enable or disable the module to start or stop the BFM services in real time through the Magisk Manager application without having to reboot the device. Starting the service may take a few seconds, and stopping the service will take effect immediately.
- For the core configuration of
bin_name
, please refer to the Kernel Updates section for the configuration. - Each core configuration file needs to be customized by the user, and the script will check the validity of the configuration. The results of the check will be stored in the
/data/adb/box/run/runs.log
file. - Tip: Both
clash
andsing-box
come with pre-configured scripts for transparent proxy. For further configuration, please refer to the official documentation. Documentation links: Official Clash Documentation, Official sing-box Documentation
- By default, BFM provides a proxy for all applications (APP) from all Android users.
- If you want BFM to proxy all applications (APP), except for some specific applications, please open the file /data/adb/box/settings.ini, change the value of proxy_mode to "blacklist" (default), and add the applications to be excluded to the packages_list, for example: packages_list=("com.termux" "org.telegram.messenger").
- If you only want to proxy specific applications (APP), use the "whitelist" mode.
- When the value of proxy_mode is set to "TUN", transparent proxy will not function, and only the corresponding kernel will start supporting TUN. Currently, only "clash" and "sing-box" are available.
- If Clash is used, the blacklist and whitelist will not apply in fake-ip mode
- BFM utilizes TPROXY to transparently proxy TCP+UDP traffic (default). If it is detected that the device does not support TPROXY, open the file /data/adb/box/settings.ini and change network_mode="redirect" to REDIRECT, which only uses TCP proxying.
- Open the file /data/adb/box/settings.ini and change the value of network_mode to redirect, tproxy, or mixed.
- redirect: Use redirect mode for TCP proxying.
- tproxy: Use tproxy mode for TCP + UDP proxying.
- mixed: Use redirect mode for TCP and tun mode for UDP proxying
- Make sure to save the changes to the configuration file and restart the BFM service or the device for the modifications to take effect.
- BFM transparently proxies localhost and hotspot (including USB tethering) by default.
- Open the file /data/adb/box/settings.ini using a text editor, Find the
ignore_out_list
parameter in the file, update the value of ignore_out_list by addingwlan+
to it. This will bypass transparent proxy for Wi-Fi connections. - If you want to enable proxying for hotspots, follow these additional steps:
- Find the
ap_list
parameter in the settings.ini file. - Update the value of
ap_list
by addingwlan+
. This will enable proxying for hotspots
- Find the
- maybe ap+ / wlan+ for Mediatek devices
- If you are unsure about the name of the access point (AP), you can use the ifconfig command in the Terminal to determine the AP name.
- Open the file /data/adb/box/settings.ini using a text editor.
- Locate the parameter
run_crontab
in the file. - Change the value of
run_crontab
to true. - Set the
interval_update
parameter according to your desired schedule. The default value is @daily, which means the updates will occur once daily. You can customize it to your preferred interval using cron syntax. - Save the changes to the configuration file.
- To execute the Cron Job and trigger the updates, follow these steps:
# run command
su -c /data/adb/box/scripts/box.service cron
- This command will execute the Cron Job and initiate the updates for Geo and Subs based on the configured schedule.
- Ensure that you have the necessary permissions to execute the command. The updates will automatically occur according to the specified schedule once you have enabled the Cron Job and executed the command.
- If you want to have full control over BFM by running commands manually, you can create a new file named /data/adb/box/manual. In this case, the BFM service will not start automatically when your device is powered on, and you will not be able to control the start or stop of the service through the Magisk Manager application.
- By creating the /data/adb/box/manual file, you take manual control over BFM and can execute commands as needed to manage its operations. Please note that modifying system files requires appropriate permissions, and any manual changes should be made with caution.
-
The BFM service script is /data/adb/box/scripts/box.service
-
Star BFM:
# This command will initiate the BFM service and start its operations.
su -c /data/adb/box/scripts/box.service start
- Stop BFM:
# This command will stop the BFM service and halt its operations.
su -c /data/adb/box/scripts/box.service stop
- When executing these commands, the Terminal will print logs simultaneously and output them to the log file.
-
Skrip proxy transparan adalah /data/adb/box/scripts/box.iptables.
-
Enable transparent proxy:
# This command will enable the transparent proxy functionality.
su -c /data/adb/box/scripts/box.iptables enable
- Disable transparent proxy:
# This command will disable the transparent proxy functionality.
su -c /data/adb/box/scripts/box.iptables disable
- When executing these commands, make sure you have the necessary permissions. The script box.iptables is responsible for managing the transparent proxy functionality in BFM.
To update both the subscription and the Geo database simultaneously, you can use the following command:
# This command will update both the subscription and the Geo database at the same time.
su -c /data/adb/box/scripts/box.tool geosub
Alternatively, if you prefer to update them separately, you can use the following commands:
# This command will update the subscription data.
su -c /data/adb/box/scripts/box.tool subs
By running these commands, you will be able to update the subscription and the Geo database as needed.
# This command will update the Geo database.
su -c /data/adb/box/scripts/box.tool geox
- When modifying any of the core configuration files, ensure that the tproxy-related configurations match the definitions in the /data/adb/box/settings.ini file.
- If your device has a public IP address, you can add that IP address to the internal network in the /data/adb/box/scripts/box.iptables file to prevent loopback traffic.
- The logs for the BFM service can be found in the directory /data/adb/box/run.
- Please note that modifying these files requires appropriate permissions. Make sure to carefully follow the instructions and validate any changes made to the configuration files.
You can run the following command to get other related operating instructions:
su -c /data/adb/box/scripts/box.tool
# usage: $0 {rconf|reload|upyacd|upcore|upyq|cgroup|port|geox|subs|geosub|all}
su -c /data/adb/box/scripts/box.service
# usage: $0 {start|stop|restart|usage|cron}
su -c /data/adb/box/scripts/box.iptables
# usage: $0 {enable|disable|renew}
-
An install that removes this module from Magisk Manager, will remove the file /data/adb/service.d/box_service.sh and the BFM data directory at /data/adb/box.
-
Remove the BFM data directory by running the following command:
# This command will delete the BFM data directory located at /data/adb/box.
su -c rm -rf /data/adb/box
# This command will delete the BFM service script located at /data/adb/service.d/box_service.sh
su -c rm -rf /data/adb/service.d/box_service.sh