perf: 命令上传 取消input长度限制

pull/12699/head
feng 9 months ago committed by Bryan
parent 4b7c0b8437
commit cea16fc41f

@ -2,10 +2,10 @@
import datetime import datetime
from django.db import transaction from django.db import transaction
from django.utils import timezone
from django.db.utils import OperationalError from django.db.utils import OperationalError
from common.utils.common import pretty_string from django.utils import timezone
from common.utils.common import pretty_string
from .base import CommandBase from .base import CommandBase
@ -19,9 +19,10 @@ class CommandStore(CommandBase):
""" """
保存命令到数据库 保存命令到数据库
""" """
cmd_input = pretty_string(command['input'])
self.model.objects.create( self.model.objects.create(
user=command["user"], asset=command["asset"], user=command["user"], asset=command["asset"],
account=command["account"], input=command["input"], account=command["account"], input=cmd_input,
output=command["output"], session=command["session"], output=command["output"], session=command["session"],
risk_level=command.get("risk_level", 0), org_id=command["org_id"], risk_level=command.get("risk_level", 0), org_id=command["org_id"],
timestamp=command["timestamp"] timestamp=command["timestamp"]

@ -15,7 +15,7 @@ class SimpleSessionCommandSerializer(serializers.ModelSerializer):
""" 简单Session命令序列类, 用来提取公共字段 """ """ 简单Session命令序列类, 用来提取公共字段 """
user = serializers.CharField(label=_("User")) # 限制 64 字符,见 validate_user user = serializers.CharField(label=_("User")) # 限制 64 字符,见 validate_user
asset = serializers.CharField(max_length=128, label=_("Asset")) asset = serializers.CharField(max_length=128, label=_("Asset"))
input = serializers.CharField(max_length=2048, label=_("Command")) input = serializers.CharField(label=_("Command"))
session = serializers.CharField(max_length=36, label=_("Session ID")) session = serializers.CharField(max_length=36, label=_("Session ID"))
risk_level = LabeledChoiceField( risk_level = LabeledChoiceField(
choices=RiskLevelChoices.choices, choices=RiskLevelChoices.choices,

Loading…
Cancel
Save