Validate arbitrary base64-encoded image uploads as incoming data urls while preserving image integrity but removing EXIF and unwanted artifacts and mitigating RCE-exploit potential.
Project description
jericho-validator
Validate arbitrary image uploads from incoming data urls while preserving file integrity but removing EXIF and unwanted artifacts and RCE exploit potential.
Installation
PyPi: pip install jericho-validator
Manually: python setup.py install
Example Usage
from jericho_validator import Jericho
# [i] View on GitHub for example files
with open('example.png.b64') as f:
data = f.read()
try:
# Check the data URL (image)
j = Jericho.jericho(data)
except Jericho.Exceptions.ImageTooLarge:
print('Image is too large.')
except Jericho.Exceptions.EmptyFileName:
print('File name is empty.')
except Jericho.Exceptions.UnsupportedImageType:
print('Image type not supported.')
except Exception as e:
print(e)
if j.isValid:
print('Image is valid.')
print('Image size in bytes: ' + str(j.sizeBytes))
print('Image dimensions: ' + str(j.dimensions))
print('Image filename: ' + j.filename)
print('Image extension: ' + j.extension)
print('Image format prefix: ' + j.formatPrefix)
else:
print('Image is invalid.')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for jericho_validator-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b8f8a24fd586af062e62024a11008af80603ed69ef2838fdbbb1293f35ed65d |
|
MD5 | d77c1146ba8a1fd9ea95b53d066ec38d |
|
BLAKE2b-256 | 4d05ab488adbf8ade77268522374b367bfba4b6fa75db76c51c651a7a6ac9473 |