mpast / mobileAudit

Django application that performs SAST and Malware Analysis for Android APKs

Home Page:https://owasp.org/www-project-mobile-audit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error 500 export results to PDF

SinelnikovM opened this issue · comments

Hello.
Deploy mobileAudit version 2.2.1

After scan i press button @export@ get error 500.

And errros in logs:

mobileaudit-web-1 | [ERROR] 16/Dec/2022 08:55:24 - Internal Server Error: /export/1
mobileaudit-web-1 | Traceback (most recent call last):
mobileaudit-web-1 | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
mobileaudit-web-1 | response = get_response(request)
mobileaudit-web-1 | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
mobileaudit-web-1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
mobileaudit-web-1 | File "/usr/local/lib/python3.9/contextlib.py", line 79, in inner
mobileaudit-web-1 | return func(*args, **kwds)
mobileaudit-web-1 | File "/usr/local/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
mobileaudit-web-1 | return view_func(request, *args, **kwargs)
mobileaudit-web-1 | File "./app/views.py", line 463, in export
mobileaudit-web-1 | pdf = pdfkit.from_string(html, False, options)
mobileaudit-web-1 | File "/usr/local/lib/python3.9/site-packages/pdfkit/api.py", line 72, in from_string
mobileaudit-web-1 | return r.to_pdf(output_path)
mobileaudit-web-1 | File "/usr/local/lib/python3.9/site-packages/pdfkit/pdfkit.py", line 159, in to_pdf
mobileaudit-web-1 | raise IOError("wkhtmltopdf exited with non-zero code {0}. error:\n{1}".format(exit_code, stderr))
mobileaudit-web-1 | OSError: wkhtmltopdf exited with non-zero code 127. error:
mobileaudit-web-1 | /usr/bin/wkhtmltopdf: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
mobileaudit-web-1 |
mobileaudit-web-1 | [pid: 13|app: 0|req: 54/75] 192.168.144.4 () {54 vars in 1220 bytes} [Fri Dec 16 08:55:18 2022] GET /export/1 => generated 145 bytes in 6303 msecs (HTTP/1.0 500) 7 headers in 217 bytes (1 switches on core 0)

Hi @SinelnikovM,
Thanks for reporting, I've just merged the change that fix the issue,
Let me know if it works!

@mpast

Hello.
Problem not resolved.

I get error:

root@0d2369e30c57:/app# wkhtmltopdf
wkhtmltopdf: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory

Need additional step:
strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

Hi @SinelnikovM
Just to confirm, as some of the changes where to the Dockerfile, the docker image should be built again, have you run docker compose build before the up?
If that is the case, can you send me info about the version of your host so I can try to reproduce?
Thanks!

@mpast yes, i rebuild project with latest changes.
cat ./Dockerfile |grep libqt5gui5
apt-get install -y openjdk-11-jdk p11-kit wkhtmltopdf libqt5gui5 && \

Please read
microsoft/WSL#3023

Need add

RUN strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 after apt-get install proccess.