mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-02 01:27:27 -04:00
tweaking
This commit is contained in:
10
docker/tanner/phpox/dist/sandbox.py
vendored
10
docker/tanner/phpox/dist/sandbox.py
vendored
@ -23,12 +23,16 @@ import json
|
||||
import asyncio
|
||||
import hashlib
|
||||
import argparse
|
||||
import functools
|
||||
|
||||
from aiohttp import web
|
||||
from asyncio.subprocess import PIPE
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
_pretty_dumps = functools.partial(json.dumps, sort_keys=True, indent=4)
|
||||
|
||||
|
||||
class PHPSandbox(object):
|
||||
@classmethod
|
||||
def php_tag_check(cls, script):
|
||||
@ -51,7 +55,7 @@ class PHPSandbox(object):
|
||||
self.stdout_value += line + b'\n'
|
||||
|
||||
@asyncio.coroutine
|
||||
def sandbox(self, script, phpbin="php7.0"):
|
||||
def sandbox(self, script, phpbin="php7"):
|
||||
if not os.path.isfile(script):
|
||||
raise Exception("Sample not found: {0}".format(script))
|
||||
|
||||
@ -96,12 +100,12 @@ def api(request):
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
ret['file_md5'] = file_md5
|
||||
return web.Response(body=json.dumps(ret, sort_keys=True, indent=4).encode('utf-8'))
|
||||
return web.json_response(ret, dumps=_pretty_dumps)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--phpbin", help="PHP binary, ex: php7.0", default="php7.0")
|
||||
parser.add_argument("--phpbin", help="PHP binary, ex: php7", default="php7")
|
||||
args = parser.parse_args()
|
||||
phpbin = args.phpbin
|
||||
|
||||
|
Reference in New Issue
Block a user