Skip to content

Commit

Permalink
Release 0.3-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
XploreInfinity committed Jul 3, 2022
1 parent c4240e9 commit a804187
Show file tree
Hide file tree
Showing 18 changed files with 310 additions and 749 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ __pycache__
elevate/__pycache__
swift_block/__pycache__
.vscode
testing
testing
build
dist
swift_block.egg-info
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## CHANGELOG

**Version 0.3-beta:**

* Created a Pypi package
* Several improvements and bug fixes in `elevate`
* Adjustments in code to adapt swift_block to run as a package
* Swift-Block will now create a launcher/start menu shortcut on first run
* Added an uninstaller

**Version 0.2-beta:**

* Windows testing completed.
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
recursive-include ./swift_block/assets/ *
recursive-include ./swift_block/ui/ *
recursive-include ./swift_block/ui/ *
60 changes: 37 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,72 @@
Version:0.2-beta
</p>

**About:**
## About:

Swiftblock is a free and open-source hosts file based ad,malware and tracker blocker written in Python's Pyqt6 framework.

**Features:**
## Features:

* Free & Open Source(SwiftBlock is licensed under GPLv3)
* Custom sources(You can easily add custom sources of hosts files)
* Custom Rules(You can manually redirect,allow or block specific hostnames!)
* Custom Rules(You can manually redirect,allow or block specific hostnames)
* Easy access(Swift-Block will create a launcher/start menu shortcut on first run)

**Supported Platforms:**
## Supported Platforms:

Most linux distributions, Windows, FreeBSD and MacOS[Testing on FreeBSD and MacOS is pending. Please note though, that I currently have no plans to test it on MacOS]
Most linux distributions, Windows, FreeBSD and MacOS[Not tested on FreeBSD and MacOS]

**Run Instructions:**
## Installation:

To run swift block,execute the following commands as root/Administrator in your terminal/command prompt:
* Open your terminal/command prompt and run the following command as superuser/administrator :
`python -m pip install swift_block`
* Now launch swift-block from your terminal/command-line by running this command(ensure you have internet first):
`swift-block`
* Swift-Block will pull hosts sources from the internet and create a launcher/start menu shortcut during the first run
* Swift-Block can be accessed from your DE's menu/start menu like any normal application from this point onwards.

* First get all the dependencies of swift_block by running the following:
* `python -m pip install pyqt6 requests` on Linux/FreeBSD/MacOS or `py -m pip install pyqt6 requests` on Windows
* Next,open the terminal/command prompt in the root folder of the project
* `cd swift_block`
* For Linux/FreeBSD/MacOS: `python __init__.py`
* For Windows `py __init__.py`
* Swift-Block should now be running
## Uninstallation:

**SPECIAL INSTRUCTIONS FOR WINDOWS USERS[VERY IMPORTANT]:**
* Open Swift-Block
* Go to the `About` tab and click on the `Uninstall` button
* It is not recommended to directly use pip to uninstall swift-block unless the above method fails
* To uninstall Swift-Block directly using pip, run this as superuser/administrator from your terminal/cmd:
`python -m pip uninstall swift_block`

Windows has issues with larger hosts files.The DNS Client service needs to be disabled to mitigate this. Recent changes in security within Windows 10 denies access to changing services via other tools except registry hacks. Use the [this cmd file](https://github.com/StevenBlack/hosts/blob/master/disable-dnscache-service-win.cmd)(Obviously,run this file as an Administrator) to make proper changes to the Windows registry. You will need to reboot your device once that's done.
## Building from source(for contributors):

**Why the weird way of distribution?**
* Clone this repo and open a terminal/cmd in the main project folder
* Run the following command as superuser/administrator:
`python -m pip install .`
* Swift-Block will be built & installed

I'm experiencing several issues with packaging and publishing swift-block on pypi,until I resolve those issues, I'm afraid this is the only way swift-block will be distributed.
## (IMPORTANT) SPECIAL INSTRUCTIONS FOR WINDOWS USERS:

**Why are my changes not applied?**
Windows has issues with larger hosts files.The DNS Client service needs to be disabled to mitigate this. Recent changes in security within Windows 10 denies access to changing services via other tools except registry hacks. Use [this bat file](https://github.com/StevenBlack/hosts/blob/master/disable-dnscache-service-win.bat))(Obviously,run this file as an Administrator) to make proper changes to the Windows registry. You will need to reboot your device once that's done.

## Why are my changes not applied?

Sometimes, to refresh the hosts file, a reboot is required. If you think your changes haven't been applied, either reboot or follow [this guide](https://github.com/StevenBlack/hosts#reloading-hosts-file).

**Inspiration:**
## Inspiration:

Swiftblock is inspired from [Adaway](https://adaway.org) and uses some UX concepts from it[No code from the project has been taken,however].

**For Contributors:**
## For Contributors:

* I've used qt-designer to create all the GUI interfaces,kindly use the same/another compatible designer for making any modifications in GUI. All the ui files are in `swift_block/ui`
* `swift_block/__init__.py` is the entry point/script executed to initialise everything
* `swift_block/main.py` is the home page of swift-block - it offers users options to manage their hosts sources,update source files, enable/disable swift-block and other misc. stuff.
* `swift_block/Parser.py` is the heart of swift-block, with low level functions for performing operations on hosts files and sources,first-start,restoring/replacing corrupt files,validation tasks, etc.[It is a non-GUI module]
* `swift_block/main.py` is the home page of swift-block - it offers users options to manage their hosts sources,update source files, enable/disable or uninstall swift-block, etc.
* `swift_block/Parser.py` is the heart of swift-block, with low level functions for performing operations on hosts files and sources,first-start,restoring/replacing corrupt files,validation tasks,uninstall scripts, etc.[It is a non-GUI module]
* `swift_block/RuleManager.py` is the GUI rule editor. It offers users options to block/redirect/allow custom/specific hostnames and also allow or redirect the hostnames being blocked by the source files
* Images and icons used within the GUI are stored in the `swift_block/assets` directory.
* `swift_block/elevate` is a sub-package that provides privilege escalation functionality(Required to read/write to the system hosts file). It is my modification of the original and currently broken [elevate](https://github.com/barneygale/elevate).

### Attribution:

* [Uninstall icons created by Us and Up - Flaticon](https://www.flaticon.com/free-icons/uninstall)

<hr />
Made with ❤️ by Xploreinfinity

P.S:Yes,I am aware swift-block's logo is that of [Swift lang](https://www.swift.org/), but there really aren't any better icons out there,sadly[None that suit the overall feel of swift-block,anyway].
28 changes: 22 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
import setuptools
'''
Copyright (C) 2021 xploreinfinity
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
'''

import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

setuptools.setup(
name="swift_block",
version="3.7",
version="0.3",
author="Xploreinfinity",
author_email="[email protected]",
license="GPLv3",
description="Swiftblock is a free and open-source hosts file based ad,malware and tracker blocker",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/XploreInfinity/swift-block",

entry_points={
'console_scripts': [
'gui_scripts': [
'swift-block =swift_block.__init__:main',
],
'console_scripts': [
'swift-block-win =swift_block.__init__:main',
],
},
project_urls={
"Bug Tracker": "https://github.com/XploreInfinity/swift-block/issues",
Expand All @@ -32,6 +43,11 @@
package_dir={"": ".",},
packages=setuptools.find_packages(where="."),
include_package_data=True,
install_requires=['pyqt6>=6.2.2'],
install_requires=[
'pyqt6>=6.2.2',
'requests',
'winshell; sys_platform == "win32"',
'pywin32; sys_platform == "win32"'
],
python_requires=">=3.6",
)
Loading

0 comments on commit a804187

Please sign in to comment.