GuidoBartoli / sherloq

An open-source digital image forensic toolset
GNU General Public License v3.0
2.63k stars 242 forks source link

Can't Load Image on Windows 10 | And my Resolution #105

Open Mapaler opened 1 day ago

Mapaler commented 1 day ago

Description

When I click Load Image, nothing happens, show some errors in the terminal.

sherloq Version: 329dc57cf30a1877e5f4b9f241ac433115c9947d Windows Version: 10.0.19045.4894 Python Version: 3.11.9

Error Screenshot

WindowsTerminal_CWindowssystem32cmd exe_-_python__ sherloq py_0551

(venv) C:\Users\Mapaler\source\repos\sherloq>cd .\gui

(venv) C:\Users\Mapaler\source\repos\sherloq\gui>python .\sherloq.py
WARNING:tensorflow:From C:\Users\Mapaler\source\repos\sherloq\gui\noiseprint\noiseprint.py:18: The name tf.disable_v2_behavior is deprecated. Please use tf.compat.v1.disable_v2_behavior instead.

WARNING:tensorflow:From C:\Users\Mapaler\source\repos\sherloq\venv\Lib\site-packages\tensorflow\python\compat\v2_compat.py:98: disable_resource_variables (from tensorflow.python.ops.resource_variables_toggle) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
WARNING:tensorflow:From C:\Users\Mapaler\source\repos\sherloq\gui\noiseprint\noiseprint.py:30: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.

Traceback (most recent call last):
  File "C:\Users\Mapaler\source\repos\sherloq\gui\sherloq.py", line 319, in load_file
    filename, basename, image = load_image(self)
                                ^^^^^^^^^^^^^^^^
  File "C:\Users\Mapaler\source\repos\sherloq\gui\utility.py", line 203, in load_image
    raw_exts = [p[0][-3:] for p in mime_patterns][-12:]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Mapaler\source\repos\sherloq\gui\utility.py", line 203, in <listcomp>
    raw_exts = [p[0][-3:] for p in mime_patterns][-12:]
                ~^^^
IndexError: list index out of range

My Install and Run code

Built-in Virtual Environment

:: Win10 Store Version
python3.11 -m venv --upgrade-deps .\venv
:: Official website EXE Version
py -3.11 -m venv --upgrade-deps .\venv

Install dependence

pip install -r .\gui\requirements.txt -i https://mirrors.aliyun.com/pypi/simple
:: Replace python-magic to python-magic-bin
pip uninstall python-magic
pip install python-magic-bin -i https://mirrors.aliyun.com/pypi/simple

Run sherloq

call .\venv\Scripts\activate.bat
cd .\gui
python .\sherloq.py

pip list

Package Version
absl-py 2.1.0
astor 0.8.1
astunparse 1.6.3
certifi 2024.8.30
charset-normalizer 3.3.2
concurrent-iterator 0.2.6
contourpy 1.3.0
cycler 0.12.1
decorator 5.1.1
flatbuffers 24.3.25
fonttools 4.54.1
gast 0.6.0
google-pasta 0.2.0
grpcio 1.66.1
h5py 3.12.1
idna 3.10
joblib 1.4.2
keras 3.5.0
Keras-Applications 1.0.8
kiwisolver 1.4.7
libclang 18.1.1
lxml 4.9.4
Markdown 3.7
markdown-it-py 3.0.0
MarkupSafe 2.1.5
matplotlib 3.8.4
mdurl 0.1.2
ml-dtypes 0.3.2
namex 0.0.8
numpy 1.26.4
opencv-contrib-python-headless 4.10.0.84
opt_einsum 3.4.0
optree 0.12.1
packaging 24.1
pandas 1.5.3
pillow 10.4.0
pip 24.2
protobuf 4.25.5
Pygments 2.18.0
pyparsing 3.1.4
PySide6 6.7.3
PySide6_Addons 6.7.3
PySide6_Essentials 6.7.3
python-dateutil 2.9.0.post0
python-magic-bin 0.4.14
pytz 2024.2
PyWavelets 1.5.0
rawpy 0.19.1
requests 2.32.3
rich 13.8.1
scikit-learn 1.5.2
scipy 1.14.1
setuptools 75.1.0
sewar 0.4.6
shiboken6 6.7.3
six 1.16.0
tensorboard 2.16.2
tensorboard-data-server 0.7.2
tensorflow 2.16.2
tensorflow-intel 2.16.2
tensorflow-io-gcs-filesystem 0.31.0
termcolor 2.4.0
threadpoolctl 3.5.0
typing_extensions 4.12.2
urllib3 2.2.3
Werkzeug 3.0.4
wheel 0.44.0
wrapt 1.16.0
xgboost 1.6.2
Mapaler commented 1 day ago

Resolution

I don't know python, so please forgive me if there is any misunderstanding.

I'm guessing this sentence is to get the RAW format extension through the last three characters of the mime.

https://github.com/GuidoBartoli/sherloq/blob/329dc57cf30a1877e5f4b9f241ac433115c9947d/gui/utility.py#L203

I've had experience writing JavaScript, where [0] after p causes the first character to be fetched instead of the whole string, so trying to remove [0] works successfully.

    raw_exts = [p[-3:] for p in mime_patterns][-12:]

python3 11_(Line_10 jpg)_-_Sherloq_0 91f_0554