mirror of
https://github.com/miloira/wxhook.git
synced 2024-11-22 02:19:26 +08:00
version 0.0.7
This commit is contained in:
parent
5251487872
commit
f0a9340a51
2
setup.py
2
setup.py
@ -18,7 +18,7 @@ URL = 'https://github.com/miloira/wxhook'
|
||||
EMAIL = '690126048@qq.com'
|
||||
AUTHOR = 'Msky'
|
||||
REQUIRES_PYTHON = '>=3.8.0'
|
||||
VERSION = '0.0.6'
|
||||
VERSION = '0.0.7'
|
||||
|
||||
# What packages are required for this module to be executed?
|
||||
REQUIRED = [
|
||||
|
@ -1,3 +1,3 @@
|
||||
from .core import Bot
|
||||
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
|
@ -70,10 +70,11 @@ class Bot:
|
||||
|
||||
try:
|
||||
code, output = start_wechat_with_inject(self.remote_port)
|
||||
if code == 1:
|
||||
raise Exception(output)
|
||||
except Exception:
|
||||
output = get_pid(self.remote_port)
|
||||
code, output = get_pid(self.remote_port)
|
||||
|
||||
if code == 1:
|
||||
raise Exception(output)
|
||||
|
||||
self.process = psutil.Process(int(output))
|
||||
|
||||
|
@ -33,9 +33,9 @@ def get_processes(process_name: str) -> typing.List[psutil.Process]:
|
||||
return processes
|
||||
|
||||
|
||||
def get_pid(port: int) -> int:
|
||||
def get_pid(port: int) -> typing.Tuple[int, int]:
|
||||
output = subprocess.run(f"netstat -ano | findStr \"{port}\"", capture_output=True, text=True, shell=True).stdout
|
||||
return int(output.split("\n")[0].split("LISTENING")[-1])
|
||||
return 0, int(output.split("\n")[0].split("LISTENING")[-1])
|
||||
|
||||
|
||||
def parse_xml(xml: str) -> dict:
|
||||
|
Loading…
Reference in New Issue
Block a user