Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Multilingual library made for validation, various form fields, such as: email, cpf, cnpj, credit card, and much more.
This package provides Python functions to validate various forms fields.
Documentation: https://multiformvalidator.netlify.app/documentation/py
Feel free to find bugs and report them to me. Your feedback is highly appreciated. Hugs from Gabriel Logan!
If you want to help me, you can buy me a coffee (:
pip install multiform-validator
This package contains various modules for validating different types of data. Below are the available validation modules:
Here is an example of how to use the functions in this package:
from multiform_validator import (
cnpjIsValid,
cpfIsValid,
getOnlyEmail,
identifyFlagCard,
isCreditCardValid,
isEmail,
passwordStrengthTester,
validateBRPhoneNumber,
isValidImage
)
print("Is email", isEmail("foo@bar.com")) # True
print("Get only email", getOnlyEmail("awdawd wadawd wda awd jhony@gmail.com awdawdawd")) # jhony@gmail.com
print("Password strength", passwordStrengthTester("aA1!asd@qd2asd")) # Strong
print("Is CPF valid", cpfIsValid("123.456.789-02")['isValid']) # False
print("Is CNPJ valid", cnpjIsValid("12.345.678/0001-09")) # { 'isValid': False, 'errorMsg': 'CNPJ is not valid' }
print("Is credit card valid", isCreditCardValid("5117 2161 1334 8362")) # True
print("Identify flag card", identifyFlagCard("5117 2161 1334 8362")) # Mastercard
print("Validate BR phone number", validateBRPhoneNumber("(11) 91234-5678")) # { 'isValid': True, 'errorMsg': None }
import os
from pathlib import Path
from multiform_validator import isValidImage
# Resolve the file path
file_path = Path.cwd() / 'static' / 'uploads'
retrieved_file = file_path / filename
# Read the first 4 bytes of the file
with open(retrieved_file, 'rb') as f:
file_buffer = f.read(4)
print(isValidImage(file_buffer)) # True or False
All params with default values are optional.
def isEmail(email: str) -> bool:
pass
def getOnlyEmail(text: str, multiple=False, clean_domain=False, repeat_email=False) -> str:
pass
def passwordStrengthTester(password: str) -> str:
pass
defaultErrorMsgCPF = [
'CPF invalid',
'CPF must have 11 numerical digits',
'CPF is not valid',
'Unknown error',
]
def cpfIsValid(cpf: str, errorMsg=defaultErrorMsgCPF) -> Dict[str, Union[bool, str, None]]:
pass
default_error_msgCNPJ = [
'CNPJ invalid',
'CNPJ must have 14 numerical digits',
'CNPJ is not valid',
'Unknown error'
]
def cnpjIsValid(cnpj: str, errorMsg=default_error_msgCNPJ) -> Dict[str, Union[bool, str, None]]:
pass
def isCreditCardValid(cardNumber: str) -> bool:
pass
def identifyFlagCard(cardNumber: str) -> str:
pass
default_error_msg = ['Invalid value passed', 'Invalid phone number', 'Unknown error']
def validateBRPhoneNumber(phoneNumber: str, errorMsg=default_error_msg) -> Dict[str, Union[bool, str, None]]:
pass
def isValidImage(file_buffer: bytes) -> bool:
pass
Feel free to explore the various functions and experiment with different inputs to understand their behavior. If you encounter any issues or have suggestions, don't hesitate to reach out to me. Your feedback is valuable and helps improve the package. Happy coding!
FAQs
Multilingual library made for validation, various form fields, such as: email, cpf, cnpj, credit card, and much more.
We found that multiform-validator 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.