Skip to main content

build Documentation Status workflow scc badge fair-software badge DOI

icon

sirup: simple IP rotation using python

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.

The logo was generated using Chat-GPT and Micorosoft Co-Pilot on July 18th 2024 at 9:32am using this prompt.

Metadata

Release files for sirup 0.2.4

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.4
File Size Uploaded Provenance
sirup-0.2.4.tar.gz 22.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 38.4 kB

Release files / sirup-0.2.4.tar.gz

Download URL sirup-0.2.4.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8e1c41b050093d8cf9b5cb7f4efd2771fe24eb568353e83b5e1d8feba0a688ee
BLAKE2b-256 checksum
How to use checksums
f19545aa5f41f3f3f58da624339fee0922f475687c18fc33ed8c1a3dce15b452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

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

Download URL sirup-0.2.4-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb67a7608934244be6c0dbf5cd4cc9fffcd84e457c9dcfaae488343d4001cabb
BLAKE2b-256 checksum
How to use checksums
a22334fb338974c571dd747e24396623d8cee1745358bc612b8eb556b547e9ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Security for sirup 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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