semvec/pypi-packages huggingface dataset:
vst-python-aes256 0.1.1
en-/decrypt AES256-CBC/GCM


# VST_Python_AES256

### **AES Class**

```python
AESRoutine(Password, Mode, Encoding)
```

**Password**: *str* -> SHA256 of this will get used as AES Key

*optional:* **Mode**: *str* -> "CBC", "GCM" -> en-/decryption mode -> **default: GCM**

*optional:* **Encoding**: *str* -> "base64", "" -> encoding of encrypted msg -> **default: base64**





### **Methods**

```python
encrypt(Text)
```

Text: str -> Plaintext to encrypt -> returns bytes

```python
decrypt(Text)
```

Text: str -> Encrypted text to decrypt -> returns str





### **CBC Format**

**[random generated iv[16 bytes] + encrypted msg[]]**

***! Notice:** before encryption, the msg gets padded with PKCS#7*

***! Notice:** if base64 is specified as encoding, the outcome gets encoded as base64 before returning*

### **GCM Format**

**[random generated nonce[12 bytes] + encrypted msg[] + gcm tag]**

***! Notice:** if base64 is specified as encoding, the outcome gets encoded as base64 before returning*





### **Sample Usage**

```python
aes_routine = AESRoutine("Password", "cbc", "base64")
encrypted_msg = aes_routine.encrypt("Text")
decrypted_msg = aes_routine.decrypt(encrypted_msg)
print(encrypted_msg == decrypted_msg)
-> True
```

***! Notice:** GCM mode is preferred as its authenticated*
suef-simpletcp 0.0.4
Simple solution to get started with TCP Servers and Clients
Requires Python: >=3.6
Keywords: tcp simple easy

# TCP

This repository contains simplefied classes to use TCP sockets much easier.

## Usage

```python
from multiprocessing import Process
from suef_simpletcp import Server, Client
from suef_simpletcp import BaseConnection

class MyServer(Server):
    def onClientConnect(self, client: BaseConnection):
        while True:
            try:
                if client.get().lower() == 'ping':
                    client.send('Pong!')
            except KeyboardInterrupt:
                pass
    
    def onClientDisconnect(self, client: BaseConnection, error: Exception):
        print(f'Connection to Client (ip: {client.ip}, port: {client.port}) got interrupted. Reason: {error.__class__.__name__}')

if __name__ == "__main__":
    # running server in different process, because it blocks further code execution (it's not asynchronous)
    server = MyServer('127.0.0.1', 1074)
    serverProcess = Process(target=server.start, args=())
    serverProcess.start()


    with Client('127.0.0.1', 1074) as client:
        client.send('ping')
        print(client.get()) # output: Pong!
    serverProcess.terminate()
```
adminpy 0.5.1
Admin escalator module for Python
Requires Python: >=3.6

# adminpy - Python Admin access for most platforms

This module makes it easy to check system platform type and gain admin rights for scripts that require it.

This utilises PyUAC on the Windows platform and requires the use of Sudo on *NIX systems for admin rights escalation.

The purpose of this is to try and make people's life easier when needed more rights for python scripts.

[adminpy on Github](https://github.com/leezhiwei/adminpy)

# Usage of the module

There are 3 functions of this module

1. The sysinfo() function outputs whether the script recognises which type of system it's running on.

Example: On a Windows system, the script will output,"You are running on a Windows-based system."

2. The admincheck() function will output a "Yes" or "No", depending on if it has root or admin privilege

3. The runadmin() function will utilise ctypes function or Sudo (for linux) to relaunch script if does not have root or admin privilege

# Requirements

* This module requires [PyUAC](https://github.com/Preston-Landers/pyuac) and [PyWin32](https://pypi.org/project/pywin32/) package to be installed on a Windows system.
* This module requires Python 3, and does not support Python 2.