One Hat Cyber Team
Your IP :
216.73.216.50
Server IP :
157.15.65.100
Server :
Linux 157-15-65-100.cprapid.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
Server Software :
Apache
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
web-monitoring-tool
/
Edit File:
get_domains.py
#!/opt/cloudlinux/venv/bin/python3 -bb # coding=utf-8 # # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2020 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENCE.TXT # import csv import urllib.parse from clcommon import cpapi from sentry import init_wmt_sentry_client, setup_logger domains_path = "/var/lve/wmt/domains.csv" def write_domains(): logger = setup_logger('write_domains') try: with open(domains_path, 'w', newline='') as csvfile: writer = csv.writer(csvfile) if cpapi.CP_NAME == cpapi.PLESK_NAME: users = [_cpinfo[0] for _cpinfo in cpapi.cpinfo(keyls=('cplogin',))] else: users = cpapi.cpusers() if not users: return domain_set = set() for user in users: try: for domain, _ in cpapi.userdomains(user): # Convert domain name to http://www.domain.com format # https://stackoverflow.com/questions/21659044/how-can-i-prepend-http-to-a-url-if-it-doesnt-begin-with-http p = urllib.parse.urlparse(domain, 'http') netloc = p.netloc or p.path path = p.path if p.netloc else '' # Uncomment for http only # p = urllib.parse.ParseResult('http', netloc, path, *p[3:]) p = urllib.parse.ParseResult(p.scheme, netloc, path, *p[3:]) url = p.geturl() if url not in domain_set: domain_set.add(url) writer.writerow([url]) except Exception as e: logger.exception(e) except Exception as e: logger.exception(e) if __name__ == "__main__": # execute only if run as a script init_wmt_sentry_client() write_domains()
Simpan