MobSF / Mobile-Security-Framework-MobSF

Mobile Security Framework (MobSF) is an automated, all-in-one mobile application (Android/iOS/Windows) pen-testing, malware analysis and security assessment framework capable of performing static and dynamic analysis.
https://opensecurity.in
GNU General Public License v3.0
17.4k stars 3.23k forks source link

[ERROR] PDF Report Generation Error #208

Closed TokenDev18 closed 8 years ago

TokenDev18 commented 8 years ago

I am receiving the following error when I try to download the pdf version of the report.

PDF Error: [ERROR] PDF Report Generation Error (/MobSF/Mobile-Security-Framework-MobSF-0.9.2/StaticAnalyzer/views.py, LINE 148 "pdf = pisa.pisaDocument(StringIO( "{0}".format(html.encode('utf-8'))), result, encoding='utf-8')"): global name 'pisa' is not defined

Please assist me in fixing this error.

Thanks in advance for your help!

ajinabraham commented 8 years ago

pip install -r requirements.txt && pip install html5lib==1.0b8should fix it

aaoconno commented 8 years ago

I confirm, ajinabraham commented on Aug 4, pip install html5lib==1.0b8, fixed the problem for me.

VijaySokkala commented 7 years ago

hi abraham, Could you pls help me to come out from below issue i.e I got error when i click on Download report link

"

Don't Play Around. An Error just popped in!

Inappropriate argument type.

init() got an unexpected keyword argument 'status_code' " above thing is an error

Thanks in advance

ajinabraham commented 7 years ago

Use the latest master

VijaySokkala commented 7 years ago

{"pdf_error": "Cannot Generate PDF", "err_details": "wkhtmltopdf exited with non-zero code 127. error:\n/usr/bin/wkhtmltopdf: error while loading shared libraries: libQt5WebKitWidgets.so.5: cannot open shared object file: No such file or directory\n"}

I got thiserror after clone the updated code and clcik on the Download report link

VijaySokkala commented 7 years ago

I have download the wkhtmltopdf.tar.xz and extracted extracted file consist 4 directories wt is the next step

VijaySokkala commented 7 years ago

ie bin, include, lib and share

here there is no python files for install

Thanks in advance

Thanks Vijay S

ajinabraham commented 7 years ago

Read the installation instruction of wkhtmltopdf

VijaySokkala commented 7 years ago

Thank you abraham An issue is resolved

VijaySokkala commented 7 years ago

I have copied bin folder files into /usr/bin/ folder of the system. Then ran the application and successfully generate the pdf report for the respective apk

VijaySokkala commented 7 years ago

I have copied bin folder files into /usr/bin/ folder of the system. Then ran the application and successfully generate the pdf report for the respective apk

pjadon-mn commented 5 years ago

I am getting 'bool' object has no attribute 'dumps' exception when I click on Download Report in Mob SF Static Analyzer

The below is shown on console [INFO] Fetching data from DB for PDF Report Generation (Android)

[INFO] Analysis is already Done. Fetching data from the DB... INFO: Could not find files for the given pattern(s). ←[1m←[91m[ERROR] 'bool' object has no attribute 'dumps'←[0m Internal Server Error: /PDF/

ajinabraham commented 5 years ago

Please provide logs

niklasgadau commented 5 years ago

I have the same issue: Here are my logs:

./logs/MobSF.log says: [2018-11-30 15:44:19] [ERROR] 'bool' object has no attribute 'dumps'

runserver log says: OS: Linux Platform: Linux-4.15.0-29-generic-x86_64-with-Ubuntu-18.04-bionic Dist: ('Ubuntu', '18.04', 'bionic') [WARNING] Could not find VirtualBox path. [INFO] MobSF Basic Environment Check [INFO] Checking for Update. [INFO] No updates available. System check identified no issues (0 silenced).

complete log: https://pastebin.com/eZnRd3FS

ajinabraham commented 5 years ago

Have you installed wkhtmltopdf?

niklasgadau commented 5 years ago

Yes, i did! (venv) nga@nga:~/Documents/Mobile-Security-Framework-MobSF$ sudo apt-get install wkhtmltopdf [sudo] password for nga: Reading package lists... Done Building dependency tree Reading state information... Done wkhtmltopdf is already the newest version (0.12.4-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

niklasgadau commented 5 years ago

Any other ideas to resolve this issue?

ajinabraham commented 5 years ago

This error comes when wkhtmltopdf is not installed properly/available to MobSF. Can you try this from terminal and see if it's working?

wkhtmltopdf http://google.com google.pdf
pjadon-mn commented 5 years ago

I tried this command from terminal, Below is the output:

C:\MobSF\Mobile-Security-Framework-MobSF-master\Mobile-Security-Framework-MobSF-master>wkhtmltopdf http://google.com google.pdf Loading pages (1/6) Counting pages (2/6) Resolving links (4/6) Loading headers and footers (5/6) Printing pages (6/6) Done

ajinabraham commented 5 years ago

Looks like wkhtmltopdf is working fine. Can you share the APK over email to investigate this further.

pjadon-mn commented 5 years ago

@ajinabraham, Now I am able to download report in Mob SF Static Analyzer, not sure how this got resolved. But I have another issue now on Dynamic Analysis. I see the below exception

[INFO] VM Starting [04/Dec/2018 12:40:23] "POST /DynamicAnalyzer/ HTTP/1.1" 200 32414 [04/Dec/2018 12:40:23] "GET /download/screen/screen.png HTTP/1.1" 302 0 [04/Dec/2018 12:40:24] "GET /error/ HTTP/1.1" 200 4750

[INFO] Setting up Dynamic Analysis Environment

[2018-12-04 13:49:47] [ERROR] Setting up Dynamic Analysis Environment (C:\MobSF\Mobile-Security-Framework-MobSF-master\Mobile-Security-Framework-MobSF-master\DynamicAnalyzer\views\android\dynamic.py, LINE 155 "start_proxy(settings.PORT, package)"): [WinError 2] The system cannot find the file specified [04/Dec/2018 13:49:47] "POST /GetEnv/ HTTP/1.1" 302 0 [04/Dec/2018 13:49:47] "GET /error/ HTTP/1.1" 200 4750

ajinabraham commented 5 years ago

Do you have capfuzz in your venv?

pjadon-mn commented 5 years ago

@ajinabraham

import subprocess import capfuzz subprocess.Popen(["capfuzz", "-m", "capture", "-p", "1337", "-n", "foo"]) Traceback (most recent call last): File "", line 1, in File "C:\Python36\lib\subprocess.py", line 707, in init restore_signals, start_new_session) File "C:\Python36\lib\subprocess.py", line 990, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified

I did install capfuzz pip install git+https://github.com/MobSF/CapFuzz.git

bloodzer0 commented 5 years ago

I am getting 'bool' object has no attribute 'dumps' exception when I click on Download Report in Mob SF Static Analyzer

The below is shown on console [INFO] Fetching data from DB for PDF Report Generation (Android)

[INFO] Analysis is already Done. Fetching data from the DB... INFO: Could not find files for the given pattern(s). ←[1m←[91m[ERROR] 'bool' object has no attribute 'dumps'←[0m Internal Server Error: /PDF/

I have encountered the same problem, I would like to ask how you solved it.

ajinabraham commented 5 years ago

If you have wkhtmltopdf installed and still seeing this. Please share the APK for further debugging.

Joyoe commented 5 years ago

wkhtmltopdf

Thanks a lot, by reinstalling wkhtmltopdf, my issue has gone!