mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 05:24:55 +03:00
poc: psutil for process watcher
This commit is contained in:
parent
9870213fff
commit
0c1a75eedd
@ -3,3 +3,4 @@ cx_Freeze
|
||||
cx_Logging; sys_platform == 'win32'
|
||||
lief; sys_platform == 'win32'
|
||||
pywin32; sys_platform == 'win32'
|
||||
psutil
|
||||
|
@ -2,7 +2,9 @@ import sys
|
||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||
import json
|
||||
import urllib.parse
|
||||
import psutil
|
||||
from downloader import Downloader
|
||||
from time import time
|
||||
|
||||
torrent_port = sys.argv[1]
|
||||
http_port = sys.argv[2]
|
||||
@ -33,6 +35,15 @@ class Handler(BaseHTTPRequestHandler):
|
||||
if self.path == "/healthcheck":
|
||||
self.send_response(200)
|
||||
self.end_headers()
|
||||
|
||||
if self.path == "/process":
|
||||
start_time = time()
|
||||
process_path = set([proc.info["exe"] for proc in psutil.process_iter(['exe'])])
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "application/json")
|
||||
self.end_headers()
|
||||
self.wfile.write(json.dumps(list(process_path)).encode('utf-8'))
|
||||
print(time() - start_time)
|
||||
|
||||
def do_POST(self):
|
||||
if self.path == "/action":
|
||||
|
Loading…
Reference in New Issue
Block a user