
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
Overview
This script demonstrates cryptographic operations like AES encryption/decryption, RSA encryption/decryption, and hashing using Python's pycryptodome, base64, and hashlib library.
Features
AES Encryption (ECB): Encrypts and decrypts data using AES in ECB mode.
RSA Key Pair Generation: Creates 2048-bit RSA keys.
RSA Encryption/Decryption: Uses PKCS1_OAEP padding for secure RSA operations.
Hashing: Supports MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512.
Dependencies
pip install -r requirements.txt
Function Details
AES Encryption/Decryption
aes_encrypt_ecb(data, key)
Encrypts plaintext using AES in ECB mode.
Args:
data (str): The plaintext to encrypt.
key (bytes): A key of length 16, 24, or 32 bytes.
Returns:
Encrypted data (bytes).Function Details
aes_decrypt_ecb(ciphertext, key)
Decrypts AES-encrypted ciphertext in ECB mode.
Args:
ciphertext (bytes): The encrypted data.
key (bytes):
The decryption key.
Returns:
Decrypted plaintext (str).
RSA Encryption/Decryption
generate_rsa_keys()
Generates a pair of RSA public and private keys.
Returns:
private_key (bytes): RSA private key.
public_key (bytes): RSA public key.
rsa_encrypt(plaintext, public_key)
Encrypts plaintext using an RSA public key.
Args:
plaintext (str): The plaintext to encrypt.
public_key (bytes): The RSA public key.
Returns:
Encrypted data (bytes).
rsa_decrypt(encrypted_data, private_key)
Decrypts RSA-encrypted data using a private key.
Args:
encrypted_data (bytes): The encrypted data.
private_key (bytes): The RSA private key.
Returns:
Decrypted plaintext (str).
All hashing functions:
md5_hash(data): Generates an MD5 hash of the input data.
sha1_hash(data): Generates a SHA-1 hash.
sha224_hash(data): Generates a SHA-224 hash.
sha256_hash(data): Generates a SHA-256 hash.
sha384_hash(data): Generates a SHA-384 hash.
sha512_hash(data): Generates a SHA-512 hash.
Args: data (str): Input string to hash.
Returns: Hash value (str).
Outputs
RSA: Encrypts and decrypts plaintext securely.
AES: Encrypts and decrypts text using AES with a random key.
Hashing: Generates cryptographic hashes for text.
Security Notes
ECB mode leaks patterns; use safer modes like CBC or GCM for production.
This script is for educational purposes only.
License
This project is licensed under the Apache2 reset License
FAQs
A simple AES and RSA encryption package
We found that encryptions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.