[Bugfix] 修复任务执行args为空的bug

pull/2155/head
ibuler 2018-12-12 18:03:28 +08:00
parent a99d5609fa
commit 55ff82545a
2 changed files with 3 additions and 1 deletions

View File

@ -165,6 +165,8 @@ class AdHocRunner:
) )
def clean_args(self, module, args): def clean_args(self, module, args):
if not args:
return ''
if module not in self.command_modules_choices: if module not in self.command_modules_choices:
return args return args
if isinstance(args, str): if isinstance(args, str):

View File

@ -229,7 +229,7 @@ class AdHoc(models.Model):
history.result = raw history.result = raw
history.summary = summary history.summary = summary
return raw, summary return raw, summary
except IndexError as e: except Exception as e:
return {}, {"dark": {"all": str(e)}, "contacted": []} return {}, {"dark": {"all": str(e)}, "contacted": []}
finally: finally:
# f.close() # f.close()