Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iplocationchanger

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iplocationchanger

Reliable IP location changer using OpenVPN and WhatIsMyIP

  • 0.1.0
  • PyPI
  • Socket score

Maintainers
1

IP Location Changer

tests

Reliable IP location changer using OpenVPN and WhatIsMyIP.

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

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

# 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

python3 -m venv ./.venv
source ./.venv/bin/activate

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

Run tests

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 country codes as keys and paths to corresponding OpenVPN configuration files as values. A sample config file is shown below:

{
  "TR": "/assets/NCVPN-TR-Istanbul-TCP.ovpn",
  "AR": "/assets/NCVPN-AR-Buenos-Aires-TCP.ovpn"
}

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc