CIRCL / AIL-framework

AIL framework - Analysis Information Leak framework. Project moved to https://github.com/ail-project
https://github.com/ail-project/ail-framework
GNU Affero General Public License v3.0
1.29k stars 283 forks source link

Internal Server Error in downloadHash #498

Closed tosto92 closed 4 years ago

tosto92 commented 4 years ago

After a fresh install and running the pystemon feeder I have an error when trying to open a decoded file.

If I attach the flask screen I have a TypeError: join() argument must be str or bytes, not 'NoneType' in b64_full_path = os.path.join(os.environ['AIL_HOME'], b64_path) (line 709 var/www/modules/hashDecoded/Flask_hashDecoded.py)

After some debugging I noticed that b64_path = r_serv_metadata.hget('metadata_hash:'+hash, 'saved_path') is None because the 'saved_path' key is not present in redis.

here an example of a hgetall on the same record {'binary_decoder': '5', 'estimated_type': 'application/octet-stream', 'first_seen': '2020/05/13', 'last_seen': '2020/05/13', 'nb_seen_in_all_pastes': '1', 'size': '64'}

and here the complete traceback

Traceback (most recent call last):
  File "/home/debian/ail-framework/AILENV/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/debian/ail-framework/AILENV/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/debian/ail-framework/AILENV/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/debian/ail-framework/AILENV/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/debian/ail-framework/AILENV/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/debian/ail-framework/AILENV/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/debian/ail-framework/AILENV/lib/python3.7/site-packages/flask_login/utils.py", line 272, in decorated_view
    return func(*args, **kwargs)
  File "./modules/Role_Manager.py", line 98, in decorated_view
    return func(*args, **kwargs)
  File "/home/debian/ail-framework//var/www/modules/hashDecoded/Flask_hashDecoded.py", line 709, in downloadHash
    b64_full_path = os.path.join(os.environ['AIL_HOME'], b64_path)
  File "/home/debian/ail-framework//AILENV/lib/python3.7/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/home/debian/ail-framework//AILENV/lib/python3.7/genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

Anyone having the same issue?

Terrtia commented 4 years ago

Hi @tosto92 !

Thanks for the report and the debugging !
Fixed with 5475660785000ec2d1c6d7ae2a04e099dc57a17a

tosto92 commented 4 years ago

Thanks! I can confirm that it is now fixed.