Skip to main content

This package serves as a mean to save passwords securely in Windows 10 machines. It uses PowerShell's SecureString function and objects.

Installation

You install this package simply from PyPI.org by:

pip install pysecstring

You could pip install directly from this github repository - which is the development repository.

Also, you could install it by git cloning this repository and poetry install it.

git clone https://github.com/gwangjinkim/pysecstring.git

cd pysecstring
poetry install

Usage

The functions encrypt() and decrypt() serve as pure Python equivalents of the ConvertTo-SecureString (or Read-Host -AsSecureString) and the ConvertFrom-SecureString functions in PowerShell.

set_credentials() asks you for entering your username and password (starred input), which will store your credentials in two separate files in form of SecureStrings (hexed binary - with a seed generated inside your computer).

get_credentials() reads these stored files and packs the credentials into a CredentialObject also known from PowerShell (but a Python equivalent version of it). When probing for .password and .username properties from this credential, property-methods decrypt them immediately into plain text (but they are nowhere stored in plain text form - to enhance safety).

At any time point and place in your script, username and password are stored only in their encrypted form.

set_credentials() and get_credentials() work only when run on the same machine. Because different machines use different salts for encryption and decryption.

# save your credentials in the files `.\.user` and `.\.pass` in your machine:
username_file = '.\.user'
pass_file = '.\.pass'
set_credentials(username_file, pass_file)
# then PowerShell asks you for input of username and pass
# and these are stored in the username and pass files in an encrypted form - SecureString

# reads-in the SecureStrings and return them as one credential object
co = get_credentials(username_file, pass_file) 


# these credential object you can probe using property methods to get the decrypted plain text forms on the fly
co.username # returns decrypted username
co.password # returns decrypted password
# the decryption happens when the properties are called (property objects)

This repository started as a fork of aznashwan/py-securestring.

Metadata

Release files for pysecstring 0.1.9

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

Source distribution (sdist)

Source distribution for pysecstring 0.1.9
File Size Uploaded Provenance Actions
pysecstring-0.1.9.tar.gz 4.9 kB Without provenance Details for pysecstring-0.1.9.tar.gz

Built distribution (wheel)

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

Total release size: 9.9 kB

Release files / pysecstring-0.1.9.tar.gz

Download URL pysecstring-0.1.9.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c0b1575061d48abc185dccd577536208eff6f3168bfa3ce8697f53b3ea5e9af9
BLAKE2b-256 checksum
How to use checksums
84cde788e12666d9aa4e6f97f234f960ba1935416fe804b1c978657d63fed286
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Windows/10

Release files / pysecstring-0.1.9-py3-none-any.whl

Download URL pysecstring-0.1.9-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6e0add8696ac9d48766da68710729a71b06d3063be746d1c9abf90682c15ce4
BLAKE2b-256 checksum
How to use checksums
17df42760781bb1a7e9886b695c52f58b087fa8c8eae7a97b70b8a722bf27e43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Windows/10

Security for pysecstring 0.1.9

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