forked from Echocipher/AUTO-EARN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubdomain_monitor.py
More file actions
27 lines (20 loc) · 855 Bytes
/
subdomain_monitor.py
File metadata and controls
27 lines (20 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import time
import subprocess
from lib import config, server_push
from rich.console import Console
console = Console()
# 子域监控函数
def subdomain_status_check():
while True:
cmd = "ps -aux | grep oneforall.py | grep -v grep | awk '{print $2}'"
console.log('正在进行子域收集监控')
start_rsp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
time.sleep(config.server_sleep_time)
end_rsp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
if len(start_rsp.stdout.read().strip()) != 0:
console.log('子域收集中')
if len(end_rsp.stdout.read().strip()) == 0:
server_push.subdomain_status_push()
break
if __name__ == '__main__':
subdomain_status_check()