iplocationchanger


Nameiplocationchanger JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryReliable IP location changer using OpenVPN and WhatIsMyIP
upload_time2023-05-16 20:53:44
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2023 Faizudeen Kajogbola Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ip vpn openvpn
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # IP Location Changer

![tests](https://github.com/faaizz/iplocationchanger_python/actions/workflows/test.yaml/badge.svg)

Reliable IP location changer using [OpenVPN](https://openvpn.net/) and [WhatIsMyIP](https://www.whatismyip.com/).

This package allows changing the IP of the host machine by using openvpn configuration files (and optionally credentials), and verifying the IP location change using WhatIsMyIP.

## Usage
```python
from iplocationchanger.service.location_changer_service import LocationChangerService
from iplocationchanger.exception.location_changer_service_exception import LocationChangerServiceException


try:
  lcs = LocationChangerService(
    'reoiotiyotrkc77690543031b421b',
    {
      'TR': '/assets/NCVPN-TR-Istanbul-TCP.ovpn',
    },
    '/usr/local/openvpn',
    '/assets/openvpncredentials',
  )

  country = 'TR'
  try:
    lcs.connect_region(country)
    # Other code logic...

  except LocationChangerServiceException as e:
    # locaiton change failed
    logging.error(e)
    exit(1)
finally:
  lcs.disconnect_region()
```
### Standalone Execution
```shell
# Sample execution
python3 src/iplocationchanger/__main__.py \ 
  -w reoiotiyotrkc77690543031b421b \
  -l TR -o "/usr/local/openvpn" \
  -c "/assets/configmap.json" \
  -u "ncpuser@namecheap" -p "PaSsWoRd"
```


## Requirements
- Linux or macOS
- `openvpn` is installed on the host PC
- `openvpn` configuration files
- (optional) `openvpn` credentials
- WhatIsMyIP API Key
- User with `sudo` permissions without password requirements for `killall` and `openvpn`.

### Fulfilling `sudo` requirements without password prompt
Granting `sudo` requirements to a user without having them supply a password can be approached by editing the `/etc/sudoers` file as such:
```
username		ALL = (ALL) NOPASSWD: /usr/bin/killall, /usr/bin/openvpn
```

## Environment Setup
```shell
python3 -m venv ./.venv
source ./.venv/bin/activate

python -m pip install -r requirements/dev.txt
```

## Run tests
```shell
coverage run --rcfile .coveragerc  -m unittest discover -t src/ -s src/tests/unit

coverage report -m
```

## Config
Config files are JSON-formatted files with 2-letter [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes as `keys` and paths to corresponding OpenVPN configuration files as `values`.
A sample config file is shown below:
```json
{
  "TR": "/assets/NCVPN-TR-Istanbul-TCP.ovpn",
  "AR": "/assets/NCVPN-AR-Buenos-Aires-TCP.ovpn"
}
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "iplocationchanger",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "ip,vpn,openvpn",
    "author": "",
    "author_email": "Faizudeen Kajogbola <faizudeen@codecreek.cc>",
    "download_url": "https://files.pythonhosted.org/packages/6e/8a/47ba28f7bcc5016d779b0bcac92a67612e730426188bdecd15c1cc0d995f/iplocationchanger-0.1.0.tar.gz",
    "platform": null,
    "description": "# IP Location Changer\n\n![tests](https://github.com/faaizz/iplocationchanger_python/actions/workflows/test.yaml/badge.svg)\n\nReliable IP location changer using [OpenVPN](https://openvpn.net/) and [WhatIsMyIP](https://www.whatismyip.com/).\n\nThis package allows changing the IP of the host machine by using openvpn configuration files (and optionally credentials), and verifying the IP location change using WhatIsMyIP.\n\n## Usage\n```python\nfrom iplocationchanger.service.location_changer_service import LocationChangerService\nfrom iplocationchanger.exception.location_changer_service_exception import LocationChangerServiceException\n\n\ntry:\n  lcs = LocationChangerService(\n    'reoiotiyotrkc77690543031b421b',\n    {\n      'TR': '/assets/NCVPN-TR-Istanbul-TCP.ovpn',\n    },\n    '/usr/local/openvpn',\n    '/assets/openvpncredentials',\n  )\n\n  country = 'TR'\n  try:\n    lcs.connect_region(country)\n    # Other code logic...\n\n  except LocationChangerServiceException as e:\n    # locaiton change failed\n    logging.error(e)\n    exit(1)\nfinally:\n  lcs.disconnect_region()\n```\n### Standalone Execution\n```shell\n# Sample execution\npython3 src/iplocationchanger/__main__.py \\ \n  -w reoiotiyotrkc77690543031b421b \\\n  -l TR -o \"/usr/local/openvpn\" \\\n  -c \"/assets/configmap.json\" \\\n  -u \"ncpuser@namecheap\" -p \"PaSsWoRd\"\n```\n\n\n## Requirements\n- Linux or macOS\n- `openvpn` is installed on the host PC\n- `openvpn` configuration files\n- (optional) `openvpn` credentials\n- WhatIsMyIP API Key\n- User with `sudo` permissions without password requirements for `killall` and `openvpn`.\n\n### Fulfilling `sudo` requirements without password prompt\nGranting `sudo` requirements to a user without having them supply a password can be approached by editing the `/etc/sudoers` file as such:\n```\nusername\t\tALL = (ALL) NOPASSWD: /usr/bin/killall, /usr/bin/openvpn\n```\n\n## Environment Setup\n```shell\npython3 -m venv ./.venv\nsource ./.venv/bin/activate\n\npython -m pip install -r requirements/dev.txt\n```\n\n## Run tests\n```shell\ncoverage run --rcfile .coveragerc  -m unittest discover -t src/ -s src/tests/unit\n\ncoverage report -m\n```\n\n## Config\nConfig files are JSON-formatted files with 2-letter [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes as `keys` and paths to corresponding OpenVPN configuration files as `values`.\nA sample config file is shown below:\n```json\n{\n  \"TR\": \"/assets/NCVPN-TR-Istanbul-TCP.ovpn\",\n  \"AR\": \"/assets/NCVPN-AR-Buenos-Aires-TCP.ovpn\"\n}\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Faizudeen Kajogbola  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Reliable IP location changer using OpenVPN and WhatIsMyIP",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/Faaizz/iplocationchanger_python"
    },
    "split_keywords": [
        "ip",
        "vpn",
        "openvpn"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b8bad48076a53fdb220a7020035e4348066acfdd4238f5a17bf59646b6108b68",
                "md5": "b876149c02349b4f112f07da70c0107b",
                "sha256": "2fc120f383523d6b9ca9a9ab7f338c45dbd0f2e24fc04d3754369c47f7004b7b"
            },
            "downloads": -1,
            "filename": "iplocationchanger-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b876149c02349b4f112f07da70c0107b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 11042,
            "upload_time": "2023-05-16T20:53:42",
            "upload_time_iso_8601": "2023-05-16T20:53:42.743462Z",
            "url": "https://files.pythonhosted.org/packages/b8/ba/d48076a53fdb220a7020035e4348066acfdd4238f5a17bf59646b6108b68/iplocationchanger-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6e8a47ba28f7bcc5016d779b0bcac92a67612e730426188bdecd15c1cc0d995f",
                "md5": "11c7f35b24312259e605a10bfca572b5",
                "sha256": "b1a9a90818b209b348eaef7ebfb9c18e1f38e3b50f3dbafdbbc54378327bdd37"
            },
            "downloads": -1,
            "filename": "iplocationchanger-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "11c7f35b24312259e605a10bfca572b5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 8884,
            "upload_time": "2023-05-16T20:53:44",
            "upload_time_iso_8601": "2023-05-16T20:53:44.447396Z",
            "url": "https://files.pythonhosted.org/packages/6e/8a/47ba28f7bcc5016d779b0bcac92a67612e730426188bdecd15c1cc0d995f/iplocationchanger-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-16 20:53:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Faaizz",
    "github_project": "iplocationchanger_python",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "iplocationchanger"
}
        
Elapsed time: 0.06720s