Skip to main content

rlogfi provides a way to interact with PowerShell subprocesses in a detached and asynchronous manner

pip install rlogfi

Tested against Windows 10 / Python 3.11 / Anaconda / BlueStacks

Asynchronous I/O:

By using asyncio and aiofiles, the script can perform I/O operations asynchronously, allowing for more efficient handling of multiple subprocess streams simultaneously. This can be particularly useful when dealing with long-running commands or when responsiveness is crucial. It also helps to avoid deadlocks, since Start-Process allows the redirection of stdout/stdin: -RedirectStandardOutput / -RedirectStandardError

Detached Execution:

The script creates a detached subprocess for running PowerShell commands, which means it operates independently of the parent process. This can be advantageous in scenarios where you need to run commands in the background or interact with PowerShell without blocking the main Python program. Instead of cmd.exe, you can start any other app that loops forever (e.g., a proxy server). The process won't close when Python closes.

Error Handling and Reconnection:

The script includes error handling mechanisms to handle exceptions and reconnect to the subprocess if the connection to stdin is lost. This ensures robustness in scenarios where the subprocess may encounter issues or terminate unexpectedly.

Customization and Control:

The class structure allows for customization of various parameters such as execution policy, working directory, and output redirection. Users can tailor the behavior of the subprocess to suit their specific requirements.

from rlogfi import PowerShellDetachedInteractive

interactivepwsh = PowerShellDetachedInteractive(
    executable=r"c:\windows\system32\cmd.exe",
    logfolder="c:\\newlogggg",
    working_dir=None,
    execution_policy="Unrestricted",
    arguments=["dir", "c:\\Windows"],
    WhatIf="",
    Verb="",
    UseNewEnvironment="",
    Wait="",
    stdinadd="",
    WindowStyle="Hidden",
)

# executing commandos 
stdout, stderr = interactivepwsh.sendcommand("dir")
print(stdout, stderr)
so, se = interactivepwsh.sendcommand("netstat")
so, se = interactivepwsh.sendcommand("cd\\")
so, se = interactivepwsh.sendcommand("ls")

Metadata

Release files for rlogfi 0.10

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

Source distribution (sdist)

Source distribution for rlogfi 0.10
File Size Uploaded Provenance Actions
rlogfi-0.10.tar.gz 13.3 kB Without provenance Details for rlogfi-0.10.tar.gz

Built distribution (wheel)

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

Total release size: 26.6 kB

Release files / rlogfi-0.10.tar.gz

Download URL rlogfi-0.10.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d81e8b1459080efdcf3bf4ddd49a2a43586bb3e77ffa79df2fea1db9c8b11750
BLAKE2b-256 checksum
How to use checksums
4c6e75793f4e2ab0c93d3ae079c17709ec392e091875c562e3c3be3543c7ec73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / rlogfi-0.10-py3-none-any.whl

Download URL rlogfi-0.10-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47501f63de0aa74cdc97189aeed2bd8979b315fd98107cc6c1b05f9c30afbe0e
BLAKE2b-256 checksum
How to use checksums
539203f6e970bd9fb6d2507755527a9a393c2d2dd46befb7cf5a3499298b808c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for rlogfi 0.10

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