Skip to main content

sirup: simple IP rotation using python

build Documentation Status workflow scc badge fair-software badge DOI

A wrapper around the openvpn CLI to connect to VPN servers and rotate the IP address in python programs.

What is required

  • An account with a VPN service that supports openvpn (for instance ProtonVPN or surfshark).
  • A linux OS with superuser rights.
  • openvpn for linux. See here for installation instructions.

How to install

To install from pip, do:

python -m pip install sirup

To install sirup from GitHub repository, do:

python -m pip install 'sirup @ git+https://github.com/ivory-tower-private-power/sirup'

How to use sirup

The package has two functionalities: connecting to a VPN server, and rotating the IP address.

1. Start up

This step is necessary for both functionalities.

import os 
import getpass
import time 

seed = 123
mypass = "/path/to/credentials.txt" # the user name and password credentials from your user account with the VPN service
config_path = "/path/to/config/files/" # the .opvn configuration files from your VPN service

Functionality 1: Connecting to a single VPN server

The sirup.VPNConnector.VPNConnector class has two methods: connect and disconnect. They are used as follows.

from sirup.VPNConnector import VPNConnector

config_file = os.path.join(config_path, "name-of-one-config-file.ovpn")
pwd = getpass.getpass()

connector = VPNConnector(auth_file=mypass, config_file=config_file)

connector.connect(pwd=pwd)

time.sleep(10)
connector.disconnect(pwd=pwd)

Functionality 2: Using the IP rotation feature

The sirup.IPRotator.IPRotator class has three methods: connect(), rotate(), disconnect(). They are used as follows.

from sirup.IPRotator import IPRotator

rotator = IPRotator(auth_file=mypass, config_location=config_path, seed=seed) # will ask for the sudo password

rotator.connect()
print(rotator.connector.current_ip)

rotator.rotate()
print(rotator.connector.current_ip)

rotator.disconnect()

Note

Before using the package, have a look at "Making sure the VPN connection works correctly" to make sure the VPN service works properly.

Documentation

The documentation of sirup can be found on Read the Docs.

Contributing

If you want to contribute to the development of sirup, have a look at the contribution guidelines.

Credits

This package was created with Cookiecutter and the NLeSC/python-template.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sirup-0.2.3.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sirup-0.2.3-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file sirup-0.2.3.tar.gz.

File metadata

  • Download URL: sirup-0.2.3.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for sirup-0.2.3.tar.gz
Algorithm Hash digest
SHA256 af796d9d40a0caa4ed7d2152729b5bb8116e2e4217c97faecc42fa374de6423d
MD5 2c9742588b8765b52e52f2e9dc1e4a6a
BLAKE2b-256 67e8067c7a1eb8e04e5e14f03d3d8d9d884f74a025029e2d7c80b19e4dae27f9

See more details on using hashes here.

File details

Details for the file sirup-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: sirup-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for sirup-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a952887d72729f38dcd71eae177acc806016b4aa5c4784695accfb319634b692
MD5 f9ea5c97d31ae22acc6ebcd684753ae1
BLAKE2b-256 ea0a25cc4084a1f8bf5e3b588981a91b5abb05976a55a01097e70c3a5ecd032d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.4

2 files

This release

0.2.3 This release

2 files

0.2.2

2 files

0.2.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page