Uniproxy


NameUniproxy JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://github.com/kun-codes/Uniproxy
SummaryCross platform python library to set system-wide proxy and bypass domains for proxy.
upload_time2024-11-03 09:33:47
maintainerNone
docs_urlNone
authorkun-codes
requires_python<4.0,>=3.8
licenseLGPL-2.0-or-later
keywords proxy system-wide cross-platform bypass domains
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![banner](https://gistcdn.githack.com/kun-codes/238e08354c3aede326d34a9694627314/raw/6fcfcb7399ee70e4dc204c1168d1d2ea74b995f9/uniproxy-banner.svg)

<div align="center">
    <img alt="GitHub License" src="https://img.shields.io/github/license/kun-codes/Uniproxy">
    <a href="https://wakatime.com/badge/user/8585bb79-1d4a-4ee6-8234-62bc87ecba58/project/03ec9bf9-b700-4399-9af8-4c840209bb13"><img src="https://wakatime.com/badge/user/8585bb79-1d4a-4ee6-8234-62bc87ecba58/project/03ec9bf9-b700-4399-9af8-4c840209bb13.svg" alt="wakatime"></a>
    <img alt="PyPI - Version" src="https://img.shields.io/pypi/v/uniproxy">
    <img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/uniproxy">
</div>

<h1 align="center">Uniproxy</h1>
<p align="center">Cross-platform python library to set system-wide proxy and proxy bypass domains.</p>

> [!IMPORTANT]
> Uniproxy doesn't provide a proxy server. It only sets the system-wide proxy settings.

## Features

- **Cross Platform:** Uniproxy is cross-platform and can be used on Windows, macOS and Linux.
- **System Wide Proxy:** Uniproxy can be used to set system-wide proxy for the host.
- **Bypassing Domains:** Uniproxy can be used to set bypass domains which don't go through the system-wide proxy.
- **Environment Variables:** Uniproxy can also set environment variables for the proxy.


## Installation

```bash
$ pip3 install uniproxy
```

## Getting Started

Install the package as mentioned above and import it.

### Proxy setup

```python
import uniproxy

prox = uniproxy.Uniproxy(ip="127.0.0.1", port=8081)  ## Create a uniproxy instance
prox.set_proxy()  ## Set system-wide proxy without changing the current proxy enabled state for the OS
prox.set_proxy_enabled(True)  ## Enable system-wide proxy
```

This will first edit the OS Settings to set the proxy and then enable the proxy.

```python
import uniproxy

prox = uniproxy.Uniproxy(ip="127.0.0.1", port=8081)  ## Create a uniproxy instance
prox.join()  ## Change
```

As an alternative, you can also use the above method to set the proxy and enable it directly.

### Bypass Domains

```python
import uniproxy

prox = uniproxy.Uniproxy(ip="127.0.0.1", port=8081)  ## Create a uniproxy instance
prox.set_bypass_domains(["www.google.com", "www.facebook.com"])  ## Set bypass domains
```

This will set the bypass domains for the proxy. The domains mentioned in the list will not pass through the proxy. Environment variables `no_proxy` and `NO_PROXY` will also be set.

### Turn off Proxy

```python
import uniproxy

prox = uniproxy.Uniproxy(ip="127.0.0.1", port=8081)  ## Create a uniproxy instance
prox.set_proxy_enabled(False)  ## Disable system-wide proxy
```

This will disable the system-wide proxy.

### Delete Proxy

```python
import uniproxy

prox = uniproxy.Uniproxy(ip="127.0.0.1", port=8081)  ## Create a uniproxy instance
prox.delete_proxy()  ## Delete the proxy settings
```

This will delete the proxy settings from the system and set them to OS defaults.

### Get Proxy Details

```python
import uniproxy

prox = uniproxy.Uniproxy(ip="127.0.0.1", port=8081)  ## Create a uniproxy instance
prox.join()
print(prox.get_proxy())  ## Get the proxy details
```

This will output the following (on Linux, KDE)

```
{
    "is_enable": True,
    "http": {"ip_address": "127.0.0.1", "port": "8081"},
    "https": {"ip_address": "127.0.0.1", "port": "8081"},
    "ftp": {"ip_address": "127.0.0.1", "port": "8081"},
}
```

### Get Bypass Domains

```python
import uniproxy

prox = uniproxy.Uniproxy(ip="127.0.0.1", port=8081)  ## Create a uniproxy instance
prox.set_bypass_domains(["www.google.com", "www.facebook.com"])  ## Set bypass domains
print(prox.get_bypass_domains())  ## Get bypass domains
```

This will output the following

```
['www.google.com', 'www.facebook.com']
```

### MacOS Specific Functionality

#### Get default network service

```python
import uniproxy

prox = uniproxy.Uniproxy(ip="127.0.0.1", port=8081)  ## Create a uniproxy instance
print(prox.proxy.get_default_network_service())  ## Get the default network service
```

This will output the following (depends on the system and current network configuration):

```
Wi-Fi
```

Default network service is determined by parsing the output of `route -n get default` command. If it fails for some reason the default network service is found out by parsing the output of `networksetup -listallnetworkservices` command and returning the first network service which is not disabled.

## Known Issues

- Uniproxy only works on SystemD based Linux systems.
- Uniproxy only supports KDE and GNOME desktop environments on Linux.

## Credits

- [hash3liZer/Proxverter](https://github.com/hash3liZer/Proxverter): for providing the initial base for the project.
- [zzzgydi/sysproxy-rs](https://github.com/zzzgydi/sysproxy-rs): for providing help with the macOS implementation.
- [Proxy Server page on Arch wiki](https://wiki.archlinux.org/title/Proxy_server#Environment_variables): for providing information on environment variables on linux.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kun-codes/Uniproxy",
    "name": "Uniproxy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "proxy, system-wide, cross-platform, bypass domains",
    "author": "kun-codes",
    "author_email": "77796630+throwaway69420-69420@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/fb/2a/f4f138109bbe365588b6773e77e58da9e5608eca1bea8fbd6e6bdecda8f1/uniproxy-0.1.4.tar.gz",
    "platform": null,
    "description": "![banner](https://gistcdn.githack.com/kun-codes/238e08354c3aede326d34a9694627314/raw/6fcfcb7399ee70e4dc204c1168d1d2ea74b995f9/uniproxy-banner.svg)\n\n<div align=\"center\">\n    <img alt=\"GitHub License\" src=\"https://img.shields.io/github/license/kun-codes/Uniproxy\">\n    <a href=\"https://wakatime.com/badge/user/8585bb79-1d4a-4ee6-8234-62bc87ecba58/project/03ec9bf9-b700-4399-9af8-4c840209bb13\"><img src=\"https://wakatime.com/badge/user/8585bb79-1d4a-4ee6-8234-62bc87ecba58/project/03ec9bf9-b700-4399-9af8-4c840209bb13.svg\" alt=\"wakatime\"></a>\n    <img alt=\"PyPI - Version\" src=\"https://img.shields.io/pypi/v/uniproxy\">\n    <img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/uniproxy\">\n</div>\n\n<h1 align=\"center\">Uniproxy</h1>\n<p align=\"center\">Cross-platform python library to set system-wide proxy and proxy bypass domains.</p>\n\n> [!IMPORTANT]\n> Uniproxy doesn't provide a proxy server. It only sets the system-wide proxy settings.\n\n## Features\n\n- **Cross Platform:** Uniproxy is cross-platform and can be used on Windows, macOS and Linux.\n- **System Wide Proxy:** Uniproxy can be used to set system-wide proxy for the host.\n- **Bypassing Domains:** Uniproxy can be used to set bypass domains which don't go through the system-wide proxy.\n- **Environment Variables:** Uniproxy can also set environment variables for the proxy.\n\n\n## Installation\n\n```bash\n$ pip3 install uniproxy\n```\n\n## Getting Started\n\nInstall the package as mentioned above and import it.\n\n### Proxy setup\n\n```python\nimport uniproxy\n\nprox = uniproxy.Uniproxy(ip=\"127.0.0.1\", port=8081)  ## Create a uniproxy instance\nprox.set_proxy()  ## Set system-wide proxy without changing the current proxy enabled state for the OS\nprox.set_proxy_enabled(True)  ## Enable system-wide proxy\n```\n\nThis will first edit the OS Settings to set the proxy and then enable the proxy.\n\n```python\nimport uniproxy\n\nprox = uniproxy.Uniproxy(ip=\"127.0.0.1\", port=8081)  ## Create a uniproxy instance\nprox.join()  ## Change\n```\n\nAs an alternative, you can also use the above method to set the proxy and enable it directly.\n\n### Bypass Domains\n\n```python\nimport uniproxy\n\nprox = uniproxy.Uniproxy(ip=\"127.0.0.1\", port=8081)  ## Create a uniproxy instance\nprox.set_bypass_domains([\"www.google.com\", \"www.facebook.com\"])  ## Set bypass domains\n```\n\nThis will set the bypass domains for the proxy. The domains mentioned in the list will not pass through the proxy. Environment variables `no_proxy` and `NO_PROXY` will also be set.\n\n### Turn off Proxy\n\n```python\nimport uniproxy\n\nprox = uniproxy.Uniproxy(ip=\"127.0.0.1\", port=8081)  ## Create a uniproxy instance\nprox.set_proxy_enabled(False)  ## Disable system-wide proxy\n```\n\nThis will disable the system-wide proxy.\n\n### Delete Proxy\n\n```python\nimport uniproxy\n\nprox = uniproxy.Uniproxy(ip=\"127.0.0.1\", port=8081)  ## Create a uniproxy instance\nprox.delete_proxy()  ## Delete the proxy settings\n```\n\nThis will delete the proxy settings from the system and set them to OS defaults.\n\n### Get Proxy Details\n\n```python\nimport uniproxy\n\nprox = uniproxy.Uniproxy(ip=\"127.0.0.1\", port=8081)  ## Create a uniproxy instance\nprox.join()\nprint(prox.get_proxy())  ## Get the proxy details\n```\n\nThis will output the following (on Linux, KDE)\n\n```\n{\n    \"is_enable\": True,\n    \"http\": {\"ip_address\": \"127.0.0.1\", \"port\": \"8081\"},\n    \"https\": {\"ip_address\": \"127.0.0.1\", \"port\": \"8081\"},\n    \"ftp\": {\"ip_address\": \"127.0.0.1\", \"port\": \"8081\"},\n}\n```\n\n### Get Bypass Domains\n\n```python\nimport uniproxy\n\nprox = uniproxy.Uniproxy(ip=\"127.0.0.1\", port=8081)  ## Create a uniproxy instance\nprox.set_bypass_domains([\"www.google.com\", \"www.facebook.com\"])  ## Set bypass domains\nprint(prox.get_bypass_domains())  ## Get bypass domains\n```\n\nThis will output the following\n\n```\n['www.google.com', 'www.facebook.com']\n```\n\n### MacOS Specific Functionality\n\n#### Get default network service\n\n```python\nimport uniproxy\n\nprox = uniproxy.Uniproxy(ip=\"127.0.0.1\", port=8081)  ## Create a uniproxy instance\nprint(prox.proxy.get_default_network_service())  ## Get the default network service\n```\n\nThis will output the following (depends on the system and current network configuration):\n\n```\nWi-Fi\n```\n\nDefault network service is determined by parsing the output of `route -n get default` command. If it fails for some reason the default network service is found out by parsing the output of `networksetup -listallnetworkservices` command and returning the first network service which is not disabled.\n\n## Known Issues\n\n- Uniproxy only works on SystemD based Linux systems.\n- Uniproxy only supports KDE and GNOME desktop environments on Linux.\n\n## Credits\n\n- [hash3liZer/Proxverter](https://github.com/hash3liZer/Proxverter): for providing the initial base for the project.\n- [zzzgydi/sysproxy-rs](https://github.com/zzzgydi/sysproxy-rs): for providing help with the macOS implementation.\n- [Proxy Server page on Arch wiki](https://wiki.archlinux.org/title/Proxy_server#Environment_variables): for providing information on environment variables on linux.\n",
    "bugtrack_url": null,
    "license": "LGPL-2.0-or-later",
    "summary": "Cross platform python library to set system-wide proxy and bypass domains for proxy.",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/kun-codes/Uniproxy",
        "Repository": "https://github.com/kun-codes/Uniproxy"
    },
    "split_keywords": [
        "proxy",
        " system-wide",
        " cross-platform",
        " bypass domains"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e93828c5d85e272d7da7b45b203bbd0a1f3086b3925a2dfc98f763520a6a783b",
                "md5": "9c973144dd1886656ab14459c34502ef",
                "sha256": "c390519a287b0bdd4f8580ce8f6ee0075370d1b0d17431b9af995b31777b3e1a"
            },
            "downloads": -1,
            "filename": "uniproxy-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c973144dd1886656ab14459c34502ef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 20790,
            "upload_time": "2024-11-03T09:33:46",
            "upload_time_iso_8601": "2024-11-03T09:33:46.126596Z",
            "url": "https://files.pythonhosted.org/packages/e9/38/28c5d85e272d7da7b45b203bbd0a1f3086b3925a2dfc98f763520a6a783b/uniproxy-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb2af4f138109bbe365588b6773e77e58da9e5608eca1bea8fbd6e6bdecda8f1",
                "md5": "2c0351caf1f0d2ff07822db3f479c849",
                "sha256": "0a46aee3dfb7e98d6f1a809e01a5f957155715e451856c0bf707b5e85fc8eb0d"
            },
            "downloads": -1,
            "filename": "uniproxy-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "2c0351caf1f0d2ff07822db3f479c849",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 20218,
            "upload_time": "2024-11-03T09:33:47",
            "upload_time_iso_8601": "2024-11-03T09:33:47.852643Z",
            "url": "https://files.pythonhosted.org/packages/fb/2a/f4f138109bbe365588b6773e77e58da9e5608eca1bea8fbd6e6bdecda8f1/uniproxy-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-03 09:33:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kun-codes",
    "github_project": "Uniproxy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "uniproxy"
}
        
Elapsed time: 0.58119s