Skip to main content

Disables internet access temporarily for a specified executable and executes it with certain arguments.

pip install procblockweb

Tested against Windows 10 / Python 3.11 / Anaconda

Needs admin rights!

How does it work?

Firewall Control:

The script checks the status of the Windows firewall. If it's off, it temporarily enables it before executing the main task.

Execution:

It generates a temporary PowerShell script to create a local user, block outbound and inbound traffic for a specified executable, and then executes the executable with specific arguments. The script monitors the execution of the specified process and cleans up (e.g., removes the added firewall rules, deletes the created local user) after the process finishes. If you don't close the process before shutting down your PC, this won't happen! It won't hurt, but you will end up with a lot of zombie firewall rules. The Python process can be closed after the function returns. The cleanup is done by a background powershell script.

Security:

It uses PowerShell to execute tasks, allowing for fine-grained control over system operations. The script removes added firewall rules and deletes the created local user after the task is completed, ensuring no residual changes are left behind.

Flexibility:

The script allows passing arguments to the executed executable and handles both inbound and outbound traffic blocking. It uses temporary files and directories for operations, ensuring that the system's integrity is maintained.

Error Handling:

The script incorporates error handling mechanisms, such as waiting for processes to finish and catching exceptions during cleanup operations.

Hidden Execution:

It sets the PowerShell window style to "Hidden" during execution, making the process less conspicuous to users. Overall, this script provides a robust way to temporarily disable internet access and execute a specified executable with controlled network access, ensuring security and clean-up afterward. It's particularly useful in scenarios where fine-grained control over network traffic and system operations is required.

Example

from procblockweb import disable_internet_and_run

(
    new_username, # firewall dummy data
    new_password, # firewall dummy data
    new_display_name1, # firewall dummy data
    new_display_name2, # firewall dummy data
    pidofproc, # pid of the process
) = disable_internet_and_run(
    exepath=r"C:\Program Files\BlueStacks_nxt\HD-Player.exe",
    args=("--instance", "Rvc64_26"),
)


(
    new_username_1,
    new_password_1,
    new_display_name1_1,
    new_display_name2_1,
    pidofproc_1,
) = disable_internet_and_run(
    exepath=r"C:\Program Files\Chromium\Application\chrome.exe"
)

Metadata

Release files for procblockweb 0.12

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

Source distribution (sdist)

Source distribution for procblockweb 0.12
File Size Uploaded Provenance Actions
procblockweb-0.12.tar.gz 6.9 kB Without provenance Details for procblockweb-0.12.tar.gz

Built distribution (wheel)

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

Total release size: 15.2 kB

Release files / procblockweb-0.12.tar.gz

Download URL procblockweb-0.12.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
74f71b020eca9ef71fa18893018516ec1e47a41add2dd435a9733b6375cc7603
BLAKE2b-256 checksum
How to use checksums
6b997ae54776d02c6114398828fdf4553036af12f6c6d94bc8348f47d4e3f844
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / procblockweb-0.12-py3-none-any.whl

Download URL procblockweb-0.12-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da49d017282b348b7431065b75c932a0829d80bf31b983d453e9a5c57b27ad8f
BLAKE2b-256 checksum
How to use checksums
6284636bb64ab0f379d6947873214985a03d75b8a1cd5e775aed9ca9a477810e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for procblockweb 0.12

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.

Release history Release notifications | RSS feed

This release

0.12 This release

2 release files No provenance

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