| 4024 | |
| 4025 | # 执行SHELL命令 |
| 4026 | def ExecShell(self, get): |
| 4027 | disabled = ['vi', 'vim', 'top', 'passwd', 'su'] |
| 4028 | get.shell = get.shell.strip() |
| 4029 | tmp = get.shell.split(' ') |
| 4030 | if tmp[0] in disabled: |
| 4031 | return public.returnMsg(False, 'FILE_SHELL_ERR', (tmp[0],)) |
| 4032 | shellStr = '''#!/bin/bash |
| 4033 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
| 4034 | export PATH |
| 4035 | cd %s |
| 4036 | %s |
| 4037 | ''' % (get.path, get.shell) |
| 4038 | public.writeFile('/tmp/panelShell.sh', shellStr) |
| 4039 | public.ExecShell( |
| 4040 | 'nohup bash /tmp/panelShell.sh > /tmp/panelShell.pl 2>&1 &') |
| 4041 | return public.returnMsg(True, 'FILE_SHELL_EXEC') |
| 4042 | |
| 4043 | # 取SHELL执行结果 |
| 4044 | def GetExecShellMsg(self, get): |