Top Related Projects
A simple way to block access to the internet per app
OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
Quick Overview
AFWall+ (Android Firewall+) is an advanced iptables-based firewall for Android devices. It provides granular control over network access for installed applications, allowing users to block or allow internet connectivity on a per-app basis. AFWall+ is particularly useful for privacy-conscious users and those looking to reduce data usage.
Pros
- Fine-grained control over app network access
- Supports both Wi-Fi and mobile data filtering
- Open-source and actively maintained
- Customizable profiles for different network environments
Cons
- Requires root access, which may void device warranty
- Can be complex for novice users
- May cause issues with some apps that rely on background data
- Potential battery drain due to constant monitoring of network traffic
Getting Started
To use AFWall+:
- Ensure your Android device is rooted.
- Download AFWall+ from the Google Play Store or F-Droid.
- Launch the app and grant root permissions when prompted.
- Select the apps you want to allow or block internet access for.
- Apply the rules by tapping the checkmark icon.
Note: Be cautious when blocking system apps, as it may cause unexpected behavior. It's recommended to start with blocking only user-installed apps until you're familiar with the app's functionality.
Competitor Comparisons
A simple way to block access to the internet per app
Pros of NetGuard
- User-friendly interface with easier app management
- Supports both Wi-Fi and mobile data filtering
- Offers additional features like address blocking and app-specific data usage monitoring
Cons of NetGuard
- Requires VPN connection, which may conflict with other VPN apps
- Less granular control over individual app permissions compared to AFWall+
Code Comparison
NetGuard (Java):
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, new FragmentMain()).commit();
}
AFWall+ (Java):
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Toolbar toolbar = findViewById(R.id.main_toolbar);
setSupportActionBar(toolbar);
}
Both projects use similar Android lifecycle methods, but NetGuard implements a fragment-based approach for its main activity, while AFWall+ uses a more traditional activity layout.
Summary
NetGuard offers a more user-friendly experience with additional features, but requires VPN usage. AFWall+ provides more granular control and doesn't require VPN, but has a steeper learning curve. Both projects are actively maintained and offer robust firewall solutions for Android devices.
OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
Pros of OpenSnitch
- Cross-platform support (Linux, macOS, Windows)
- More granular control with per-process rules
- User-friendly GUI for rule management
Cons of OpenSnitch
- Requires more system resources
- Steeper learning curve for configuration
- Less focus on mobile platforms
Code Comparison
AFWall+ (Java):
private void applyRules(RuleDataSet rules) {
List<String> cmds = new ArrayList<String>();
for (RuleData rule : rules) {
cmds.add(rule.getCommand());
}
applyRules(cmds);
}
OpenSnitch (Go):
func (r *Rule) Match(con *conman.Connection) bool {
if r.Enabled && r.Operator != nil {
return r.Operator.Match(con)
}
return false
}
AFWall+ is primarily designed for Android, using Java and focusing on iptables rules. It offers a simpler interface and is more lightweight, making it suitable for mobile devices.
OpenSnitch, written in Go, provides a more comprehensive network monitoring solution with advanced features like per-process rules and a desktop GUI. It's better suited for desktop environments and offers more flexibility in rule creation and management.
While AFWall+ excels in simplicity and mobile optimization, OpenSnitch offers more advanced features and cross-platform support, making it a stronger choice for desktop users who need granular control over network traffic.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
AFWall+ (Android Firewall+)
Description
Android Firewall+ (AFWall+) is an advanced iptables editor (GUI) for Android. It provides fine-grained control over which Android apps are allowed to access the network.
For more information and a community discussion ground, please visit the official XDA thread or the official Wiki page.
Index
- Description
- Availability
- Supports
- Highlights
- Features
- Bug Reports
- Limitations
- Compatibility
- Upgrading
- Permissions
- Frequently Asked Questions (FAQ)
- License
- Acknowledgements
- Compiling AFWall+
- Compile Native Binaries
- Contributing
- Translating
- Donations
Availability
AFWall can be downloaded via Google Play Store, GitHub or via F-Droid.
The changelog documents changes between each new release.
Supports
- Android versions 5.x to 11.x for 4.x - 2.9.9 for 2.x - 1.3.4.1
- Compatible with Magisk and LineageOS su.
- ARM/MIPS/x86 processors
- IPv4 & IPv6 protocols
- WiFi, mobile data, LAN, VPN, tether, roaming and Tor
- Multi-user (multiple profiles)
- Many languages (see Translating)
- Tasker and Locale plugin
- Xposed plugin
Highlights
- Easy to install
- Simple to use
- Free & open source
- No advertisements
- Built-in IPtables/BusyBox
Features
- List and search for all installed applications
- Sort installed applications by installation date, UUID or in alphabatical order
- Receive notification for any newly installed application, AFwall only list app with INTERNET_PERMISSION
- AFWall comes with it's logs service to see what's going on
- Display notifcations for blocked packets
- Filter blocked packet notifications per app
- Export & import rules ("Import All Rules" requires the donate version)
- Option to prevent data leaks during boot (requires init.d support or S-OFF)
- Password protection
- Option to manage iptable rules with a custom script
Device Admin to protect AFWall+ from uninstall(see here why it was removed)
Bug Reports
Please check GitHub's issues section for existing bugs and in case you like to submit a new one. Feature requests are also welcome.
Before you report any problem/bug, take a look into the how-to-report a bug section.
Limitations
- A firewall cannot protect against attacks that are performed outside the operating point. For example, if there is a Point-to-Point connection to the Internet.
- A firewall cannot prevent corporate data from being copied to a memory stick or HDD, and having these removed from the building.
- AFWall+ does not scan for virus/malware that may exist in the files that pass through it, because it is a firewall and not an antivirus solution.
- AFWall+ is not an ad-blocker.
- Some apps/script which are running under admin rights might bypassing AFWall because they overwrite the system own IPtables with their own rules. Make sure you only give trusted application superuser rights, most "su"-solutions have companion apps which showing which apps are running under which rights like MagisK, Chainfire's su etc.
Compatibility
AFWall+ has been successfully tested under Android versions 4.x - 9.x. and is reported to work with most Android variants, including stock or exotic ROMs.
We do not recommend using AFWall+ in combination with any of the similar solutions (Avast, Kaspersky, NetGuard etc) because this could result in conflicts or even data leaks (e.g. IPtables could get overwritten).
Upgrading
The upgrading mechanism is really simple, basically you can just "over-install" the new version over the old one, however this is the best pratice (which we recommended):
- Make a backup of the current version (e.g. via Titanium Backup).
- Do not remove the current version (otherwise your settings might getting reset).
- Download the latest AFWall+ version.
- Install the new version over the previous version.
- Done!
Permissions
AFWall+ asks for the following Android permissions:
- RECEIVE_BOOT_COMPLETED: Autostart (Bootup) AFWall+ after the system finishes booting.
- ACCESS_NETWORK_STATE: Allows AFWall+ to access information about networks (iptables).
- WRITE_EXTERNAL_STORAGE: Allows AFWall+ to write to external storage for debug log and export iptables rules.
- INTERNET: NetworkInterface.getNetworkInterfaces() needs android.permission.INTERNET. This is just being used to get the IPv4 and IPv6 addresses/subnets for each interface, so the LAN address ranges can be determined. Nothing is actually trying to access the network. Also take a look at Stackoverflow.
- ACCESS_WIFI_STATE: Used to detect the tether state.
- DEPRECATED
ACCESS_SUPERUSER: Standard to support Superuser/SuperSU (by Koushik/Chainfire)
Frequently Asked Questions
Having some problems with AFWall+? Check out our FAQ before reporting a bug or problem that may already be known or answered.
License
AFWall+ is released under the GNU General Public License v3.0 License.
Acknowledgements
The original codebase was derived from DroidWall by Rodrigo Rosauro. DroidWall was sold to AVAST in December 2011, and is no longer actively maintained.
This project also uses some other open-source libraries such as:
Project | License | Website |
Android Color Picker | Apache License 2.0 | https://github.com/attenzione/android-ColorPickerPreference |
Busybox | GNU GPLv2 | http://www.busybox.net |
DBFlow | MIT | https://github.com/Raizlabs/DBFlow |
Prettytime | Apache License 2.0 | https://github.com/ocpsoft/prettytime |
material-dialogs | MIT License | https://github.com/afollestad/material-dialogs |
iptables | GNU GPLv2 | http://netfilter.org/projects/iptables/index.html |
Libsuperuser | Apache License 2.0 | https://github.com/Chainfire/libsuperuser |
Locale Plugin | Apache License 2.0 | http://www.twofortyfouram.com |
Networklog | Mozilla Public License Version 2.0 | https://github.com/pragma-/networklog |
Root Tools | Apache License 2.0 | https://github.com/Stericson/RootTools |
Compiling the APK
Prerequisites:
- Android SDK in your $PATH (both platform-tools/ and tools/ directories)
- Javac 1.7 (or higher) and a recent version of Apache ant in your $PATH
- Git should be added in your $PATH
- Use the Android SDK Manager to install API 19 (or higher)
Quick start:
git clone git://github.com/ukanth/afwall
cd afwall
./gradlew clean assembleDebug
For complete instructions, please take a look at the Wiki's How To Compile AFWAll section.
Compiling Native Binaries
You can compile the external binaries like BusyBox or the IPtables yourself, on the host side, you'll need to install the following:
- NDK r10, nominally under /opt/android-ndk-r10
- Host-side gcc 4.7, make, etc. (Red Hat 'Development Tools' group or Debian build-essential)
- autoconf, automake, and libtool
This command will build the Android binaries and copy them into res/raw/
:
make -C external NDK=/opt/android-ndk-r10
Contributing
You can fork the repository and contribute using pull requests.
All contributions no matter if large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated. The pull requests and findings are usually getting reviewed and discussed with the developer and the community .
Translating
The res/values-*
dirs are kept up-to-date automatically via the Crowdin Translate Extension. See our official translation page in case you like to contribute.
AFWall+ is available in many languages but if yours is not included - or if it needs updating or improving - please create an account and use the translation system and commit your changes.
Donations
Donations are optional and helps the project in order to keep up the development. The official donation link is the one below which points to the official AFWall+ PayPal account. You optionally can buy the unlocker key via Google Play Store which unlocks additional features in AFWall+, the unlocker is not avbl. via F-Droid.
Top Related Projects
A simple way to block access to the internet per app
OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot