Skip to main content

sirup: simple IP rotation using python

build Documentation Status workflow scc badge fair-software badge RSD

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 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.

Metadata

Release files for sirup 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sirup 0.2.1
File Size Uploaded
sirup-0.2.1.tar.gz 22.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sirup 0.2.1
File Interpreter ABI Platform
sirup-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 38.6 kB

Release files / sirup-0.2.1.tar.gz

Download URL sirup-0.2.1.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
769254f18324c00ff55d3965f175802d52870dc4bef18bc390530bb0180b2f47
BLAKE2b-256 checksum
How to use checksums
d75b6f1d75c28eebf3370b49e4acd7d0f8848ba2ca45b9015521f97b6e1cbd75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / sirup-0.2.1-py3-none-any.whl

Download URL sirup-0.2.1-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04f84de66c67d9895a696f6b190c64b0d71014f9cd9a73a340d06f72e4dab1f2
BLAKE2b-256 checksum
How to use checksums
4f701fe5e482e7e7f881dfe79a871483832d113599abe4a94e167df51b29a849
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

This release

0.2.1 This release

2 release 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