| 778 | |
| 779 | |
| 780 | class Process(object): |
| 781 | process = RealProcess() |
| 782 | |
| 783 | # 获取进程列表 |
| 784 | def get_process_list(self): |
| 785 | return self.process.get_process_list() |
| 786 | |
| 787 | # 获取进程信息->pid |
| 788 | def get_process_info_by_pid(self, get: Any) -> dict: |
| 789 | if not hasattr(get, 'pid'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 790 | return self.process.get_process_info_by_pid(get.pid) |
| 791 | |
| 792 | # 通过name获取进程信息 |
| 793 | def get_process_info_by_name(self, get: Any) -> dict: |
| 794 | if not hasattr(get, 'name'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 795 | return self.process.get_process_info_by_name(get.name) |
| 796 | |
| 797 | def get_process_info_by_exec(self, get: Any) -> dict: |
| 798 | if not hasattr(get, 'cli'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 799 | return self.process.get_process_info_by_exec(get.cli) |
| 800 | |
| 801 | def get_process_info_by_port(self, get: Any) -> dict: |
| 802 | if not hasattr(get, 'port'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 803 | return self.process.get_process_info_by_port(get.port) |
| 804 | |
| 805 | def get_process_info_by_ip(self, get: Any) -> dict: |
| 806 | if not hasattr(get, 'ip'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 807 | return self.process.get_process_info_by_ip(get.ip) |
| 808 | |
| 809 | def get_process_info_by_openfile(self, get: Any) -> dict: |
| 810 | if not hasattr(get, 'file_path'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 811 | return self.process.get_process_info_by_openfile(get.file_path) |
| 812 | |
| 813 | # 获取进程树 |
| 814 | def get_process_tree(self, get: Any) -> dict: |
| 815 | if not hasattr(get, 'pid'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 816 | return self.process.get_process_tree(get.pid) |
| 817 | |
| 818 | # 结束进程pid |
| 819 | def kill_pid(self, get: Any) -> dict: |
| 820 | if not hasattr(get, 'pid'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 821 | return self.process.kill_pid(get.pid) |
| 822 | |
| 823 | # 结束进程名 |
| 824 | def kill_name(self, get: Any) -> dict: |
| 825 | if not hasattr(get, 'name'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 826 | return self.process.kill_name(get.name) |
| 827 | |
| 828 | # 结束进程树 |
| 829 | def kill_tree(self, get: Any) -> dict: |
| 830 | if not hasattr(get, 'pid'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 831 | return self.process.kill_tree(get.pid) |
| 832 | |
| 833 | # 结束所有进程 pid,进程名,进程树 |
| 834 | def kill_proc_all(self, get: Any) -> dict: |
| 835 | if not hasattr(get, 'pid'): return {'status': False, 'msg': '参数错误', 'data': {}} |
| 836 | return self.process.kill_proc_all(get.pid) |
| 837 |
no test coverage detected