TypeError: object of type 'int' has no len()
esgeeks opened this issue · 1 comments
Hi, I have installed all the dependencies successfully, however I get the following error when I run the program.
[07:43:55] [INFO] > Starting Automatic Operations
[07:43:55] [INFO] > Getting All Raw Images From Directory
0%| | 0/2 [00:00<?, ?it/s][07:43:55] [INFO] > Generating Metadata For: autoexp/image_raw/Image.png
[07:43:55] [INFO] > AES-256-GCM Encryption Successful
0%| | 0/2 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/esgeeks/Chaya/chaya.py", line 530, in <module>
chaya_start()
File "/home/esgeeks/Chaya/chaya.py", line 525, in chaya_start
run_manager()
File "/home/esgeeks/Chaya/chaya.py", line 366, in run_manager
RunType_AutoExp()
File "/home/esgeeks/Chaya/chaya.py", line 310, in RunType_AutoExp
AutoExp_Enc(raw_image_path, raw_image)
File "/home/esgeeks/Chaya/chaya.py", line 226, in AutoExp_Enc
lps_results_array = LPS_Encode(raw_image_path, image_information['secret_message'], image_information['steg_image_path'], startingPixel=(0,0))
File "/home/esgeeks/Chaya/core/steganography.py", line 97, in LPS_Encode
write(d[i], pixel, nextP, img)
File "/home/esgeeks/Chaya/core/steganography.py", line 46, in write
if len(p) == 4:
TypeError: object of type 'int' has no len()
Will it have to do with the dimensions of the image?
I can't figure out the error without the scenario like the payload you used, the image you used and if you removed the txt files called remove-this-file.txt from all autoexp subfolders etc.. Anyway, from my tests:
Yes has to do with the image size or dimensions being small. It can also happen if your image colors don't have enough least-significant-bits.
Here is an example from my test with 2 images. One is skull.png (very small icon with transparency) and other is nice.png (normal large image with a gta babe :D).
skull.png results in decode error because encoding could not be performed properly: https://ibb.co/d5yKK6G
nice.png results is perfect encoding and decoding: https://ibb.co/JRDg2dQ
The actual issue occurs here: lps_results_array = LPS_Encode(raw_image_path, image_information['secret_message'], image_information['steg_image_path'], startingPixel=(0,0))
where it's trying to encode your encrypted payload into the image, but fails.
As a good rule of thumb, avoid completely transparent backround images, very small images or icon and keep with ratio of payload to image size as 1KB payload for 100KB image. Don't worry, you can perform lossless compression to your PNG as an addition instead of FLIF. May be making that module for PNG - to - PNG lossless compression, but later.
Hope this helps.