Browse Source

check more types

master^2
lilydjwg 9 months ago
parent
commit
ad4cf53296
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      main.py

+ 5
- 1
main.py View File

@@ -26,6 +26,10 @@ except ImportError:
pass

SCRIPT_PATH = 'elimage'
RISKY_TYPES = [
'application/x-dosexec',
'application/x-executable',
]

@lru_cache()
def guess_mime_using_file(content):
@@ -132,7 +136,7 @@ class IndexHandler(tornado.web.RequestHandler):
h = m.hexdigest()
model.add_image(uid, h, file['filename'], len(file['body']))
ftype = guess_mime_using_file(file['body'])[0]
if ftype == 'application/x-dosexec':
if ftype in RISKY_TYPES:
await check_executable(
self.request.remote_ip,
h, file['body'], file['filename'])


Loading…
Cancel
Save